From: gdr Date: Sun, 15 May 2005 18:28:36 +0000 (+0000) Subject: * fixlib.c (load_file_data): Use XRESIZVEC in lieu of xrealloc. X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=8d0afcccdc8ad93ff596ef95b44d520d6b3c73ae * fixlib.c (load_file_data): Use XRESIZVEC in lieu of xrealloc. * server.c (load_data): Likewise. (run_shell): Use XCNEW (char) in lieu of xcalloc (1, 1). * fixincl.c: #include (run_compiles): Use XCNEWVEC instead of xcalloc. (fix_with_system, start_fixer): Use XNEWVEC instead of xmalloc. * fixfixes.c (FIX_PROC_HEAD, main): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99740 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 6bb2424a59c..12901de214e 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,13 @@ +2005-05-15 Gabriel Dos Reis + + * fixlib.c (load_file_data): Use XRESIZVEC in lieu of xrealloc. + * server.c (load_data): Likewise. + (run_shell): Use XCNEW (char) in lieu of xcalloc (1, 1). + * fixincl.c: #include + (run_compiles): Use XCNEWVEC instead of xcalloc. + (fix_with_system, start_fixer): Use XNEWVEC instead of xmalloc. + * fixfixes.c (FIX_PROC_HEAD, main): Likewise. + 2005-05-10 Joseph S. Myers * inclhack.def (stdio_stdarg_h, stdio_va_list): Bypass on diff --git a/fixincludes/fixfixes.c b/fixincludes/fixfixes.c index 732092061a0..c883253123d 100644 --- a/fixincludes/fixfixes.c +++ b/fixincludes/fixfixes.c @@ -605,7 +605,7 @@ FIX_PROC_HEAD( wrap_fix ) * *both* the fix name and the file name. */ size_t ln = strlen( filname ) + strlen( p_fixd->fix_name ) + 14; - char* pz = xmalloc( ln ); + char* pz = XNEWVEC (char, ln); pz_name = pz; sprintf( pz, "FIXINC_WRAP_%s-%s", filname, p_fixd->fix_name ); @@ -770,7 +770,7 @@ main( int argc, char** argv ) return EXIT_FAILURE; } - pz_tmptmp = xmalloc (strlen (argv[4]) + 5); + pz_tmptmp = XNEWVEC (char, strlen (argv[4]) + 5); strcpy( pz_tmptmp, argv[4] ); /* Don't lose because "12345678" and "12345678X" map to the same diff --git a/fixincludes/fixincl.c b/fixincludes/fixincl.c index 8bd43dcb748..5f07afa408f 100644 --- a/fixincludes/fixincl.c +++ b/fixincludes/fixincl.c @@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA. */ #include "fixlib.h" #include +#include #if defined( HAVE_MMAP_FILE ) #include @@ -451,7 +452,7 @@ run_compiles (void) { tFixDesc *p_fixd = fixDescList; int fix_ct = FIX_COUNT; - regex_t *p_re = xcalloc (REGEX_COUNT, sizeof (regex_t)); + regex_t *p_re = XCNEWVEC (regex_t, REGEX_COUNT); /* Make sure compile_re does not stumble across invalid data */ @@ -866,7 +867,7 @@ fix_with_system (tFixDesc* p_fixd, + strlen (pz_temp_file); /* Allocate something sure to be big enough for our purposes */ - pz_cmd = xmalloc (argsize); + pz_cmd = XNEWVEC (char, argsize); strcpy (pz_cmd, pz_orig_dir); pz_scan = pz_cmd + strlen (pz_orig_dir); @@ -933,7 +934,7 @@ fix_with_system (tFixDesc* p_fixd, } /* Estimated buffer size we will need. */ - pz_scan = pz_cmd = xmalloc (argsize); + pz_scan = pz_cmd = XNEWVEC (char, argsize); /* How much of it do we allot to the program name and its arguments. */ parg_size = argsize - parg_size; @@ -1020,7 +1021,7 @@ start_fixer (int read_fd, tFixDesc* p_fixd, char* pz_fix_file) else { tSCC z_cmd_fmt[] = "file='%s'\n%s"; - pz_cmd = xmalloc (strlen (p_fixd->patch_args[2]) + pz_cmd = XNEWVEC (char, strlen (p_fixd->patch_args[2]) + sizeof (z_cmd_fmt) + strlen (pz_fix_file)); sprintf (pz_cmd, z_cmd_fmt, pz_fix_file, p_fixd->patch_args[2]); pz_cmd_save = p_fixd->patch_args[2]; diff --git a/fixincludes/fixlib.c b/fixincludes/fixlib.c index e56328b1621..7ab45c51497 100644 --- a/fixincludes/fixlib.c +++ b/fixincludes/fixlib.c @@ -48,7 +48,7 @@ load_file_data (FILE* fp) if (space_left < 1024) { space_left += 4096; - pz_data = xrealloc (pz_data, space_left + space_used + 1 ); + pz_data = XRESIZEVEC (char, pz_data, space_left + space_used + 1 ); } size_read = fread (pz_data + space_used, 1, space_left, fp); @@ -72,7 +72,7 @@ load_file_data (FILE* fp) space_used += size_read; } while (! feof (fp)); - pz_data = xrealloc (pz_data, space_used+1 ); + pz_data = XRESIZEVEC (char, pz_data, space_used+1 ); pz_data[ space_used ] = NUL; return pz_data; diff --git a/fixincludes/server.c b/fixincludes/server.c index 902fda15072..73db78b2e79 100644 --- a/fixincludes/server.c +++ b/fixincludes/server.c @@ -83,7 +83,7 @@ load_data (FILE* fp) t_bool got_done = BOOL_FALSE; text_size = sizeof (z_line) * 2; - pz_scan = pz_text = xmalloc (text_size); + pz_scan = pz_text = XNEWVEC (char, text_size); for (;;) { @@ -109,7 +109,7 @@ load_data (FILE* fp) size_t off = (size_t) (pz_scan - pz_text); text_size += 4096; - pz_text = xrealloc (pz_text, text_size); + pz_text = XRESIZEVEC (char, pz_text, text_size); pz_scan = pz_text + off; } } @@ -124,7 +124,7 @@ load_data (FILE* fp) while ((pz_scan > pz_text) && ISSPACE (pz_scan[-1])) pz_scan--; *pz_scan = NUL; - return xrealloc (pz_text, strlen (pz_text) + 1); + return XRESIZEVEC (char, pz_text, strlen (pz_text) + 1); } @@ -260,7 +260,7 @@ run_shell (const char* pz_cmd) if (server_id <= 0) { fprintf (stderr, zNoServer, pz_cmd); - return xcalloc (1, 1); + return XCNEW (char); } /* Make sure the process will pay attention to us, send the @@ -275,7 +275,7 @@ run_shell (const char* pz_cmd) if (server_id == NULLPROCESS) { fprintf (stderr, zNoServer, pz_cmd); - return xcalloc (1, 1); + return XCNEW (char); } /* Now try to read back all the data. If we fail due to either a @@ -295,7 +295,7 @@ run_shell (const char* pz_cmd) fprintf (stderr, "CLOSING SHELL SERVER - command failure:\n\t%s\n", pz_cmd); - pz = xcalloc (1, 1); + pz = XCNEW (char); } #ifdef DEBUG fprintf( stderr, "run_shell command success: %s\n", pz );