diff --git a/driver/cflexor.lex b/driver/cflexor.lex index dd35c1fa2..526f8eaed 100644 --- a/driver/cflexor.lex +++ b/driver/cflexor.lex @@ -4,7 +4,7 @@ %{ /* - * Copyright (c) 2001 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -21,9 +21,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#ifdef HAVE_CVS_IDENT -#ident "$Id: cflexor.lex,v 1.11 2007/03/22 16:08:18 steve Exp $" -#endif # include "cfparse.h" # include "cfparse_misc.h" @@ -236,3 +233,17 @@ void cfreset(FILE*fd, const char*path) current_file = strdup(path); cflloc.first_line = 1; } + +/* + * 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 +} diff --git a/driver/cfparse.y b/driver/cfparse.y index 67d85db94..9ee38e7d3 100644 --- a/driver/cfparse.y +++ b/driver/cfparse.y @@ -1,6 +1,6 @@ %{ /* - * Copyright (c) 20001 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -17,10 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#ifdef HAVE_CVS_IDENT -#ident "$Id: cfparse.y,v 1.12 2007/04/19 02:52:53 steve Exp $" -#endif - # include "globals.h" # include "cfparse_misc.h" diff --git a/driver/cfparse_misc.h b/driver/cfparse_misc.h index b822bd7a9..708d79f93 100644 --- a/driver/cfparse_misc.h +++ b/driver/cfparse_misc.h @@ -1,7 +1,7 @@ #ifndef __cfparse_misc_H #define __cfparse_misc_H /* - * Copyright (c) 2001 Picture Elements, Inc. + * Copyright (c) 2001-2009 Picture Elements, Inc. * Stephen Williams (steve@picturel.com) * * This source code is free software; you can redistribute it @@ -38,6 +38,7 @@ int cflex(void); int cferror(const char *); int cfparse(void); void switch_to_command_file(const char *); +void destroy_lexor(); char *current_file; #endif diff --git a/driver/main.c b/driver/main.c index d53e3ab4c..266e88df4 100644 --- a/driver/main.c +++ b/driver/main.c @@ -937,7 +937,9 @@ int main(int argc, char **argv) return 1; } free(command_filename); + fclose(fp); } + destroy_lexor(); if (depfile) { fprintf(defines_file, "M:%s\n", depfile);