diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2000-11-17 04:16:55 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2000-11-17 04:16:55 +0000 |
commit | dd3b81b4218512cfedc271dfde65c6011b6aefe9 (patch) | |
tree | c69e8960a6ca95cfcc6c3cf270e4d450862696db /gcc/fixinc | |
parent | 5074c1fe97ed929e8bdbf49600bbe83c3722a5ec (diff) | |
download | gcc-dd3b81b4218512cfedc271dfde65c6011b6aefe9.zip gcc-dd3b81b4218512cfedc271dfde65c6011b6aefe9.tar.gz gcc-dd3b81b4218512cfedc271dfde65c6011b6aefe9.tar.bz2 |
mcore.c (mcore_expand_prolog): Call xmalloc/xrealloc, not malloc/realloc.
* mcore.c (mcore_expand_prolog): Call xmalloc/xrealloc, not
malloc/realloc.
* cpplib.c (glue_header_name): Likewise.
* fixincl.c (run_compiles, start_fixer): Likewise.
* fixlib.c (load_file_data): Likewise.
* mkdeps.c (munge): Likewise.
f:
* malloc.c (malloc_init): Call xmalloc, not malloc.
From-SVN: r37511
Diffstat (limited to 'gcc/fixinc')
-rw-r--r-- | gcc/fixinc/fixincl.c | 20 | ||||
-rw-r--r-- | gcc/fixinc/fixlib.c | 7 |
2 files changed, 6 insertions, 21 deletions
diff --git a/gcc/fixinc/fixincl.c b/gcc/fixinc/fixincl.c index e0513e5..a1d6817 100644 --- a/gcc/fixinc/fixincl.c +++ b/gcc/fixinc/fixincl.c @@ -474,14 +474,7 @@ run_compiles () { tFixDesc *p_fixd = fixDescList; int fix_ct = FIX_COUNT; - regex_t *p_re = (regex_t *) malloc (REGEX_COUNT * sizeof (regex_t)); - - if (p_re == (regex_t *) NULL) - { - fprintf (stderr, "fixincl ERROR: cannot allocate %d bytes for regex\n", - REGEX_COUNT * sizeof (regex_t)); - exit (EXIT_FAILURE); - } + regex_t *p_re = (regex_t *) xmalloc (REGEX_COUNT * sizeof (regex_t)); /* Make sure compile_re does not stumble across invalid data */ @@ -1036,14 +1029,9 @@ start_fixer (read_fd, p_fixd, pz_fix_file) else { tSCC z_cmd_fmt[] = "file='%s'\n%s"; - pz_cmd = (char*)malloc (strlen (p_fixd->patch_args[2]) - + sizeof( z_cmd_fmt ) - + strlen( pz_fix_file )); - if (pz_cmd == (char*)NULL) - { - fputs ("allocation failure\n", stderr); - exit (EXIT_FAILURE); - } + pz_cmd = (char*) xmalloc (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]; p_fixd->patch_args[2] = pz_cmd; diff --git a/gcc/fixinc/fixlib.c b/gcc/fixinc/fixlib.c index 1b134ee..d09474a 100644 --- a/gcc/fixinc/fixlib.c +++ b/gcc/fixinc/fixlib.c @@ -46,10 +46,7 @@ load_file_data (fp) if (space_left < 1024) { space_left += 4096; - if (pz_data) - pz_data = realloc ((void*)pz_data, space_left + space_used + 1 ); - else - pz_data = malloc (space_left + space_used + 1 ); + pz_data = xrealloc ((void*)pz_data, space_left + space_used + 1 ); } size_read = fread (pz_data + space_used, 1, space_left, fp); @@ -74,7 +71,7 @@ load_file_data (fp) space_used += size_read; } while (! feof (fp)); - pz_data = realloc ((void*)pz_data, space_used+1 ); + pz_data = xrealloc ((void*)pz_data, space_used+1 ); pz_data[ space_used ] = NUL; fclose (fp); |