ECPG check variables hidden by locals v2

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: ECPG check variables hidden by locals v2
Date: 2010-04-01 08:16:10
Message-ID: 4BB4564A.50906@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

here's a little beautified patch:
- more logical parameter order in ECPGdump_a_type()
- use mm_strdup() instead of strdup() (I notoriously forget this)
- actually bail out with ET_FATAL if the local variable is
of a different type than the global variable that was used in
the DECLARE in the global scope

Although with this patch we can only detect variables under
DECLARE SECTIONs, so we can't detect the scenario
in the attached test case. Should we? This test code would be
a good candidate for the Underhanded C Contest. :-)

Best regards,
Zoltán Böszörményi

--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/

Attachment Content-Type Size
pg90-ecpg-warn-hidden-vars-2-ctxdiff.patch text/x-patch 8.2 KB
test2.pgc text/plain 322 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gerd Koenig 2010-04-01 08:29:15 Re: Postgres 9.1 - Release Theme
Previous Message Dave Page 2010-04-01 08:13:16 Postgres 9.1 - Release Theme