]> granicus.if.org Git - postgresql/commitdiff
Remove outside-the-scanner references to "yyleng".
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 8 Sep 2009 04:25:14 +0000 (04:25 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 8 Sep 2009 04:25:14 +0000 (04:25 +0000)
It seems the flex developers have decided to change yyleng from int to size_t.
This has already happened in the latest release of OS X, and will start
happening elsewhere once the next release of flex appears.  Rather than trying
to divine how it's declared in any particular build, let's just remove the one
existing not-very-necessary external usage.

Back-patch to all supported branches; not so much because users in the field
are likely to care about building old branches with cutting-edge flex, as
to keep OSX-based buildfarm members from having problems with old branches.

src/interfaces/ecpg/preproc/ecpg.header
src/interfaces/ecpg/preproc/extern.h

index c2091d28293c12feea9439a6118ac8fb06dedb11..709482641f6171ec36bb86e9c5464bee704ca41a 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.7 2009/06/10 23:11:52 petere Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.7.2.1 2009/09/08 04:25:14 tgl Exp $ */
 
 /* Copyright comment */
 %{
@@ -184,11 +184,7 @@ make3_str(char *str1, char *str2, char *str3)
 static char *
 make_name(void)
 {
-       char * name = (char *)mm_alloc(yyleng + 1);
-
-       strncpy(name, yytext, yyleng);
-       name[yyleng] = '\0';
-       return(name);
+       return mm_strdup(yytext);
 }
 
 static char *
@@ -220,7 +216,7 @@ create_questionmarks(char *name, bool array)
        for (; count > 0; count --)
        {
                sprintf(pacounter_buffer, "$%d", pacounter++);
-               result = cat_str(3, result, strdup(pacounter_buffer), make_str(" , "));
+               result = cat_str(3, result, mm_strdup(pacounter_buffer), make_str(" , "));
        }
 
        /* removed the trailing " ," */
index a7a125c13b26a33a19b5d79dffeaa4e290f5e41a..badf56fbf74c555c5741c22769abd418e8bb9334 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/extern.h,v 1.73 2009/06/11 14:49:13 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/extern.h,v 1.73.2.1 2009/09/08 04:25:14 tgl Exp $ */
 
 #ifndef _ECPG_PREPROC_EXTERN_H
 #define _ECPG_PREPROC_EXTERN_H
@@ -39,8 +39,7 @@ extern char *yytext,
 #ifdef YYDEBUG
 extern int     yydebug;
 #endif
-extern int     yylineno,
-                       yyleng;
+extern int     yylineno;
 extern FILE *yyin,
                   *yyout;
 extern char *output_filename;