From 6103a72927636b97ba2c673678597b8f1f84c186 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Thu, 14 Feb 2008 20:12:10 -0500 Subject: [PATCH] ivlpp: Removed delayed_close This variable was used in yywrap purportedly to obviate hidden access to a file that should be closable. After investigating the code flex produces, it would seem that these fears are unfounded. Signed-off-by: Michael Witten --- ivlpp/lexor.lex | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ivlpp/lexor.lex b/ivlpp/lexor.lex index 028619851..f74a95d1b 100644 --- a/ivlpp/lexor.lex +++ b/ivlpp/lexor.lex @@ -1259,15 +1259,12 @@ static int yywrap() int line_mask_flag = 0; struct include_stack_t*isp = istack; istack = isp->next; - FILE *delayed_close = (FILE *) 0; /* Delete the current input buffers, and free the cell. */ yy_delete_buffer(YY_CURRENT_BUFFER); if (isp->file) { - /* Delay the close of this file, because the yyrestart - below seems to have some memory of this file. */ - delayed_close = isp->file; free(isp->path); + fclose(isp->file); } else { /* If I am printing line directives and I just finished macro substitution, I should terminate the line and @@ -1312,7 +1309,6 @@ static int yywrap() } yyrestart(istack->file); - if (delayed_close) fclose(delayed_close); return 0; } @@ -1321,7 +1317,6 @@ static int yywrap() top. If I need to print a line directive, do so. */ yy_switch_to_buffer(istack->yybs); - if (delayed_close) fclose(delayed_close); if (line_direct_flag && istack->path && !line_mask_flag) fprintf(yyout, "\n`line %u \"%s\" 2\n",