Skip to content

Commit 3f43446

Browse files
committed
Persuade tsearch/tsearch2 to work (or at least pass their regression
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.
1 parent 0441e26 commit 3f43446

File tree

2 files changed

+0
-23
lines changed

2 files changed

+0
-23
lines changed

contrib/tsearch/parser.l

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,6 @@
77
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
88
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
99

10-
/* postgres allocation function */
11-
#define free pfree
12-
#define malloc palloc
13-
#define realloc repalloc
14-
15-
#ifdef strdup
16-
#undef strdup
17-
#endif
18-
#define strdup pstrdup
19-
2010
char *token = NULL; /* pointer to token */
2111
char *s = NULL; /* to return WHOLE hyphenated-word */
2212

contrib/tsearch2/wordparser/parser.l

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@
88
/* Avoid exit() on fatal scanner errors */
99
#define fprintf(file, fmt, msg) ts_error(ERROR, fmt, msg)
1010

11-
/* postgres allocation function */
12-
#define free pfree
13-
#define malloc palloc
14-
#define realloc repalloc
15-
16-
#ifdef strdup
17-
#undef strdup
18-
#endif
19-
#define strdup pstrdup
20-
2111
char *token = NULL; /* pointer to token */
2212
char *s = NULL; /* to return WHOLE hyphenated-word */
2313

@@ -303,6 +293,3 @@ void start_parse_str(char* str, int limit) {
303293
tsearch2_yy_switch_to_buffer( buf );
304294
BEGIN INITIAL;
305295
}
306-
307-
308-

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy