mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-01 13:51:21 +02:00
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.
This commit is contained in:
parent
0441e269ea
commit
3f43446e36
@ -7,16 +7,6 @@
|
|||||||
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
|
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
|
||||||
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
|
#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 *token = NULL; /* pointer to token */
|
||||||
char *s = NULL; /* to return WHOLE hyphenated-word */
|
char *s = NULL; /* to return WHOLE hyphenated-word */
|
||||||
|
|
||||||
|
@ -8,16 +8,6 @@
|
|||||||
/* Avoid exit() on fatal scanner errors */
|
/* Avoid exit() on fatal scanner errors */
|
||||||
#define fprintf(file, fmt, msg) ts_error(ERROR, fmt, msg)
|
#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 *token = NULL; /* pointer to token */
|
||||||
char *s = NULL; /* to return WHOLE hyphenated-word */
|
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 );
|
tsearch2_yy_switch_to_buffer( buf );
|
||||||
BEGIN INITIAL;
|
BEGIN INITIAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user