fixlib.c (load_file_data): Use XRESIZVEC in lieu of xrealloc.

* 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 <sys/wait.h>
        (run_compiles): Use XCNEWVEC instead of xcalloc.
        (fix_with_system, start_fixer): Use XNEWVEC instead of xmalloc.
        * fixfixes.c (FIX_PROC_HEAD, main): Likewise.

From-SVN: r99740
This commit is contained in:
Gabriel Dos Reis 2005-05-15 18:28:36 +00:00 committed by Gabriel Dos Reis
parent b4220f64e3
commit 03a9fcb862
5 changed files with 25 additions and 14 deletions

View File

@ -1,3 +1,13 @@
2005-05-15 Gabriel Dos Reis <gdr@integrable-solutions.net>
* 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 <sys/wait.h>
(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 <joseph@codesourcery.com>
* inclhack.def (stdio_stdarg_h, stdio_va_list): Bypass on

View File

@ -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

View File

@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA. */
#include "fixlib.h"
#include <sys/stat.h>
#include <sys/wait.h>
#if defined( HAVE_MMAP_FILE )
#include <sys/mman.h>
@ -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];

View File

@ -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;

View File

@ -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 );