]> granicus.if.org Git - postgresql/commitdiff
Persuade tsearch/tsearch2 to work (or at least pass their regression
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 14 Sep 2003 18:44:23 +0000 (18:44 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 14 Sep 2003 18:44:23 +0000 (18:44 +0000)
tests) when using flex 2.5.31.  The fix is to *not* try to use palloc
and pfree for allocations within the lexer; when you do that, the
yy_buffer_stack gets freed at inopportune times.  The code is already
set up to do manual deallocation, so I see no particular advantage to
using palloc anyway.

contrib/tsearch/parser.l
contrib/tsearch2/wordparser/parser.l

index 2bf3dcba076bc13672fcd3d71215607fcb0b2430..17ac21dcd1c205bea9d867822d3036343ab46f5f 100644 (file)
@@ -7,16 +7,6 @@
 /* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
 #define fprintf(file, fmt, msg)  ereport(ERROR, (errmsg_internal("%s", msg)))
 
-/* postgres allocation function */
-#define free    pfree
-#define malloc  palloc
-#define realloc repalloc
-
-#ifdef strdup
-#undef strdup
-#endif
-#define strdup  pstrdup
-
 char *token = NULL;  /* pointer to token */
 char *s     = NULL;  /* to return WHOLE hyphenated-word */
 
index 23cfedaa201d6184ac65b7f50db703d47b380355..b7f5a0013b6803633c0139742757090b3eb213af 100644 (file)
@@ -8,16 +8,6 @@
 /* Avoid exit() on fatal scanner errors */
 #define fprintf(file, fmt, msg)  ts_error(ERROR, fmt, msg)
 
-/* postgres allocation function */
-#define free    pfree
-#define malloc  palloc
-#define realloc repalloc
-
-#ifdef strdup
-#undef strdup
-#endif
-#define strdup  pstrdup
-
 char *token = NULL;  /* pointer to token */
 char *s     = NULL;  /* to return WHOLE hyphenated-word */
 
@@ -303,6 +293,3 @@ void start_parse_str(char* str, int limit) {
        tsearch2_yy_switch_to_buffer( buf );
        BEGIN INITIAL;
 }
-
-
-