Remove outside-the-scanner references to "yyleng".
authorTom Lane <[email protected]>
Tue, 8 Sep 2009 04:26:17 +0000 (04:26 +0000)
committerTom Lane <[email protected]>
Tue, 8 Sep 2009 04:26:17 +0000 (04:26 +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/extern.h
src/interfaces/ecpg/preproc/preproc.y

index 3d1088a20715ef57002cda9bbdecc0b2f4d6e481..61c21ca98e27923eb98a3c830d75f1cd96ef7aab 100644 (file)
@@ -31,8 +31,7 @@ extern char *yytext,
 #ifdef YYDEBUG
 extern int     yydebug;
 #endif
-extern int     yylineno,
-                       yyleng;
+extern int     yylineno;
 extern FILE *yyin,
                   *yyout;
 
index bb839973d86ffe6d847cae5fff28d552b2441d62..6e7fe17460d1b030879a98609ab343b3414b8f38 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.263.2.23 2008/10/10 12:19:03 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.263.2.24 2009/09/08 04:26:17 tgl Exp $ */
 
 /* Copyright comment */
 %{
@@ -145,11 +145,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 *