From aedbc6b7be014893838112d206a2ba5452e95605 Mon Sep 17 00:00:00 2001 From: rlar Date: Fri, 30 Dec 2011 17:43:41 +0000 Subject: [PATCH] cleanup scope of variable `big_buff2' --- ChangeLog | 4 ++++ src/frontend/inpcom.c | 29 +++++++++++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a8719264..40d67e692 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-12-30 Robert Larice + * inpcom.c : + cleanup scope of variable `big_buff2' + 2011-12-30 Robert Larice * inpcom.c : cleanup scope of variable `dir_name_flag' diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 59fbb68bf..032264eec 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -144,7 +144,6 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c char ipc_buffer[1025]; /* Had better be big enough */ int ipc_len; #endif - char big_buff2[5000]; char *new_title = NULL; char keep_char; int line_number = 1; /* sjb - renamed to avoid confusion with struct line */ @@ -297,12 +296,15 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c bool dir_name_flag = FALSE; - if ( dir_name != NULL ) sprintf( big_buff2, "%s/%s", dir_name, s ); - else sprintf( big_buff2, "./%s", s ); - newfp = inp_pathopen( s, "r" ); if ( !newfp ) { - dir_name_flag = TRUE; + char big_buff2[5000]; + + if ( dir_name ) + sprintf( big_buff2, "%s/%s", dir_name, s ); + else + sprintf( big_buff2, "./%s", s ); + newfp = inp_pathopen( big_buff2, "r" ); if ( !newfp ) { if ( copys ) @@ -311,6 +313,8 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c tfree(buffer); controlled_exit(EXIT_FAILURE); } + + dir_name_flag = TRUE; } library_file[num_libraries++] = strdup(s_lower); @@ -380,13 +384,16 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c { bool dir_name_flag = FALSE; - /* open file specified by .include statement */ - if ( dir_name != NULL ) sprintf( big_buff2, "%s/%s", dir_name, s ); - else sprintf( big_buff2, "./%s", s ); - newfp = inp_pathopen(s, "r"); if ( !newfp ) { - dir_name_flag = TRUE; + char big_buff2[5000]; + + /* open file specified by .include statement */ + if ( dir_name ) + sprintf( big_buff2, "%s/%s", dir_name, s ); + else + sprintf( big_buff2, "./%s", s ); + newfp = inp_pathopen( big_buff2, "r" ); if ( !newfp ) { perror(s); @@ -396,6 +403,8 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c tfree(buffer); /* allocated by readline() above */ controlled_exit(EXIT_FAILURE); } + + dir_name_flag = TRUE; } if ( dir_name_flag == FALSE ) {