ivlpp - clear lexor dynamic state information for flex >= 2.5.9
For flex version 2.5.9 and later there is a function "yylex_destroy()" that clears any space dynamically allocated by the scanner.
This commit is contained in:
parent
049290d0fc
commit
1e06a2ddef
|
|
@ -22,6 +22,7 @@
|
|||
# include <stdio.h>
|
||||
|
||||
extern void reset_lexor(FILE*out, char*paths[]);
|
||||
extern void destroy_lexor();
|
||||
extern void load_precompiled_defines(FILE*src);
|
||||
extern void define_macro(const char*name, const char*value, int keyword,
|
||||
int argc);
|
||||
|
|
|
|||
|
|
@ -1803,3 +1803,17 @@ void reset_lexor(FILE* out, char* paths[])
|
|||
tail = isp;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Modern version of flex (>=2.5.9) can clean up the scanner data.
|
||||
*/
|
||||
void destroy_lexor()
|
||||
{
|
||||
# ifdef FLEX_SCANNER
|
||||
# if YY_FLEX_MAJOR_VERSION >= 2 && YY_FLEX_MINOR_VERSION >= 5
|
||||
# if defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION >= 9
|
||||
yylex_destroy();
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -370,6 +370,7 @@ int main(int argc, char*argv[])
|
|||
start scanning. */
|
||||
reset_lexor(out, source_list);
|
||||
if (yylex()) return -1;
|
||||
destroy_lexor();
|
||||
|
||||
if(depend_file) {
|
||||
fclose(depend_file);
|
||||
|
|
|
|||
Loading…
Reference in New Issue