diff options
author | Bruce Korb <bkorb@gnu.org> | 2004-11-17 04:20:36 +0000 |
---|---|---|
committer | Bruce Korb <korbb@gcc.gnu.org> | 2004-11-17 04:20:36 +0000 |
commit | 43c1b5d29955cfc2c5c8343f4a5d2a8af818b542 (patch) | |
tree | b28c41db6ddb85cdbf9ff9376e5e0b2ba6795937 /fixincludes | |
parent | 13cf683781930f8de94b751c62d7f0c4f50bbecc (diff) | |
download | gcc-43c1b5d29955cfc2c5c8343f4a5d2a8af818b542.zip gcc-43c1b5d29955cfc2c5c8343f4a5d2a8af818b542.tar.gz gcc-43c1b5d29955cfc2c5c8343f4a5d2a8af818b542.tar.bz2 |
correct misuse of variables
From-SVN: r90789
Diffstat (limited to 'fixincludes')
-rw-r--r-- | fixincludes/ChangeLog | 5 | ||||
-rw-r--r-- | fixincludes/fixincl.c | 68 |
2 files changed, 40 insertions, 33 deletions
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 6f17a1d..9794c66 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,8 @@ +2004-11-15 Bruce Korb <bkorb@gnu.org> + + * fixincl.c(fix_with_system): correct misuse of variables and + incorrect application of "sizeof()". + 2004-11-13 Joseph S. Myers <joseph@codesourcery.com> * inclhack.def (hpux_maxint, limits_ifndefs, math_huge_val_ifndef, diff --git a/fixincludes/fixincl.c b/fixincludes/fixincl.c index 998ff7e..b361146 100644 --- a/fixincludes/fixincl.c +++ b/fixincludes/fixincl.c @@ -851,41 +851,43 @@ fix_with_system (tFixDesc* p_fixd, char* pz_cmd; char* pz_scan; size_t argsize; - int i; - tSCC *z_applyfix_prog[2] = { - "/../fixincludes/applyfix" EXE_EXT, - "/../../fixincludes/applyfix" EXE_EXT }; if (p_fixd->fd_flags & FD_SUBROUTINE) - for (i = 0; i < 2; i++) - { - struct stat buf; - - argsize = 32 - + strlen( pz_orig_dir ) - + sizeof( z_applyfix_prog ) - + strlen( pz_fix_file ) - + strlen( pz_file_source ) - + strlen( pz_temp_file ); - - pz_cmd = xmalloc (argsize); - - strcpy( pz_cmd, pz_orig_dir ); - pz_scan = pz_cmd + strlen( pz_orig_dir ); - strcpy( pz_scan, z_applyfix_prog ); - pz_scan += sizeof( z_applyfix_prog ) - 1; - - if (stat (pz_scan, &buf) != -1) - { - *(pz_scan++) = ' '; - /* - * Now add the fix number and file names that may be needed - */ - sprintf (pz_scan, "%ld \'%s\' \'%s\' \'%s\'", p_fixd - fixDescList, - pz_fix_file, pz_file_source, pz_temp_file); - break; - } - } + { + static const char z_applyfix_prog[] = + "/../fixincludes/applyfix" EXE_EXT; + + struct stat buf; + argsize = 32 + + strlen (pz_orig_dir) + + sizeof (z_applyfix_prog) + + strlen (pz_fix_file) + + strlen (pz_file_source) + + strlen (pz_temp_file); + + /* Allocate something sure to be big enough for our purposes */ + pz_cmd = xmalloc (argsize); + strcpy (pz_cmd, pz_orig_dir); + pz_scan = pz_cmd + strlen (pz_orig_dir); + + strcpy (pz_scan, z_applyfix_prog); + + /* IF we can't find the "applyfix" executable file at the first guess, + try one level higher up */ + if (stat (pz_cmd, &buf) == -1) + { + strcpy (pz_scan, "/.."); + strcpy (pz_scan+3, z_applyfix_prog); + } + + pz_scan += strlen (pz_scan); + + /* + * Now add the fix number and file names that may be needed + */ + sprintf (pz_scan, " %ld \'%s\' \'%s\' \'%s\'", p_fixd - fixDescList, + pz_fix_file, pz_file_source, pz_temp_file); + } else /* NOT an "internal" fix: */ { size_t parg_size; |