summaryrefslogtreecommitdiff
path: root/gcc/protoize.c
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-07 02:36:41 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-07 02:36:41 +0000
commit713829e97b2cabe9369424002f6efb23a7c86aba (patch)
tree4078f3a9721ec2407abe016bdfff56e653a05da4 /gcc/protoize.c
parentda7052f68ce6c63c9b86c438a016f6052f2e8613 (diff)
downloadgcc-713829e97b2cabe9369424002f6efb23a7c86aba.tar.gz
* c-aux-info.c (concat): Don't define.
* cccp.c (my_strerror): Likewise. All callers changed to use xstrerror instead. (do_include): Call xstrdup, not xmalloc/strcpy. (grow_outbuf): Don't check if xrealloc returns NULL, it can't. (xmalloc, xrealloc, xcalloc, xstrdup): Don't define. * collect2.c (my_strsignal): Likewise. All callers changed to use strsignal instead. (locatelib): Call xstrdup, not xmalloc/strcpy. * 1750a.h (ASM_OUTPUT_INTERNAL_LABEL): Call xmalloc, not malloc. * dsp16xx.c (override_options): Call xstrdup, not xmalloc/strcpy. * i370.h (ASM_DECLARE_FUNCTION_NAME): Call xmalloc, not malloc. * mips.c (build_mips16_call_stub): Call xstrdup, not xmalloc/strcpy. * cppinit.c (cpp_options_init): Call xcalloc, not xmalloc/bzero. * dwarfout.c (dwarfout_init): Call concat, not xmalloc/strcpy/... * except.c (new_eh_region_entry): Call xmalloc/xrealloc, not malloc/realloc. (find_all_handler_type_matches): Likewise. Don't check return value. (get_new_handler, init_insn_eh_region, process_nestinfo): Call xmalloc, not malloc. (init_eh_nesting_info): Likewise. Call xcalloc, not xmalloc/bzero. * gcc.c (xstrerror, xmalloc, xrealloc): Don't define. (init_spec): Call xcalloc, not xmalloc/bzero. (set_spec): Call xstrdup, not save_string. (record_temp_file): Call xstrdup, not xmalloc/strcpy. (find_a_file): Call xstrdup, not xmalloc/strcpy. (process_command): Call xstrdup, not save_string. (main): Call xcalloc, not xmalloc/bzero. * gcov.c (xmalloc): Don't define. (create_program_flow_graph): Call xcalloc, not xmalloc/bzero. (scan_for_source_files): Call xstrdup, not xmalloc/strcpy. (output_data): Call xcalloc, not xmalloc/bzero. * haifa-sched.c (schedule_insns): Call xcalloc, not xmalloc/bzero. * mips-tdump.c (xmalloc): Don't define. (print_symbol): Call xmalloc, not malloc. (read_tfile): Call xcalloc, not calloc. * mips-tfile.c (xfree, my_strsignal, xmalloc, xcalloc, xrealloc): Don't define. All callers of xfree/my_strsignal changed to use free/strsignal instead. (allocate_cluster): Call xcalloc, not calloc. * objc/objc-act.c (lang_init): Call concat, not xmalloc/strcpy/... Fix memory leak, free allocated memory. * prefix.c (translate_name): Call xstrdup, not save_string. (update_path): Likewise. * profile.c (branch_prob): Call xstrdup, not xmalloc/strcpy. * protoize.c (xstrerror, xmalloc, xrealloc, xfree, savestring2): Don't define. Callers of xfree/savestring2 changed to use free/concat instead. * reload1.c (reload): Call xcalloc, not xmalloc/bzero. (init_elim_table): Likewise. * resource.c (init_resource_info): Likewise. * stupid.c (stupid_life_analysis): Likewise. * toplev.c (xmalloc, xcalloc, xrealloc, xstrdup): Don't define. (open_dump_file): Call concat, not xmalloc/strcpy/... (clean_dump_file): Likewise. (compile_file): Call xstrdup, not xmalloc/strcpy. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29148 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/protoize.c')
-rw-r--r--gcc/protoize.c103
1 files changed, 9 insertions, 94 deletions
diff --git a/gcc/protoize.c b/gcc/protoize.c
index 0f1b31ac794..1c187fc2f1c 100644
--- a/gcc/protoize.c
+++ b/gcc/protoize.c
@@ -600,73 +600,6 @@ notice VPARAMS ((const char *msgid, ...))
}
-char *
-xstrerror(e)
- int e;
-{
-
-#ifdef HAVE_STRERROR
- return strerror(e);
-
-#else
- if (!e)
- return "";
-
- if (e > 0 && e < sys_nerr)
- return sys_errlist[e];
-
- return "errno = ?";
-#endif
-}
-
-/* Allocate some space, but check that the allocation was successful. */
-/* alloca.c uses this, so don't make it static. */
-
-pointer_type
-xmalloc (byte_count)
- size_t byte_count;
-{
- register pointer_type rv = (pointer_type) malloc (byte_count);
- if (rv == NULL)
- {
- notice ("\n%s: virtual memory exceeded\n", pname);
- exit (FATAL_EXIT_CODE);
- }
- return rv;
-}
-
-/* Reallocate some space, but check that the reallocation was successful. */
-
-pointer_type
-xrealloc (old_space, byte_count)
- pointer_type old_space;
- size_t byte_count;
-{
- register pointer_type rv;
- if (old_space)
- rv = (pointer_type) realloc (old_space, byte_count);
- else
- rv = (pointer_type) malloc (byte_count);
- if (rv == NULL)
- {
- notice ("\n%s: virtual memory exceeded\n", pname);
- exit (FATAL_EXIT_CODE);
- }
- return rv;
-}
-
-/* Deallocate the area pointed to by an arbitrary pointer, but first, strip
- the `const' qualifier from it and also make sure that the pointer value
- is non-null. */
-
-void
-xfree (p)
- const_pointer_type p;
-{
- if (p)
- free ((NONCONST pointer_type) p);
-}
-
/* Make a copy of a string INPUT with size SIZE. */
static char *
@@ -679,21 +612,6 @@ savestring (input, size)
return output;
}
-/* Make a copy of the concatenation of INPUT1 and INPUT2. */
-
-static char *
-savestring2 (input1, size1, input2, size2)
- const char *input1;
- unsigned int size1;
- const char *input2;
- unsigned int size2;
-{
- char *output = (char *) xmalloc (size1 + size2 + 1);
- strcpy (output, input1);
- strcpy (&output[size1], input2);
- return output;
-}
-
/* More 'friendly' abort that prints the line and file.
config.h can #define abort fancy_abort if you like that sort of thing. */
@@ -1109,7 +1027,7 @@ add_symbol (p, s)
const char *s;
{
p->hash_next = NULL;
- p->symbol = savestring (s, strlen (s));
+ p->symbol = xstrdup (s);
p->ddip = NULL;
p->fip = NULL;
return p;
@@ -1157,7 +1075,7 @@ static void
free_def_dec (p)
def_dec_info *p;
{
- xfree (p->ansi_decl);
+ free ((NONCONST pointer_type) p->ansi_decl);
#ifndef UNPROTOIZE
{
@@ -1167,12 +1085,12 @@ free_def_dec (p)
for (curr = p->f_list_chain; curr; curr = next)
{
next = curr->chain_next;
- xfree (curr);
+ free ((NONCONST pointer_type) curr);
}
}
#endif /* !defined (UNPROTOIZE) */
- xfree (p);
+ free (p);
}
/* Unexpand as many macro symbol as we can find.
@@ -2072,12 +1990,9 @@ gen_aux_info_file (base_filename)
/* Store the full source file name in the argument vector. */
compile_params[input_file_name_index] = shortpath (NULL, base_filename);
/* Add .X to source file name to get aux-info file name. */
- compile_params[aux_info_file_name_index]
- = savestring2 (compile_params[input_file_name_index],
- strlen (compile_params[input_file_name_index]),
- ".X",
- 2);
-
+ compile_params[aux_info_file_name_index] =
+ concat (compile_params[input_file_name_index], ".X", NULL);
+
if (!quiet_flag)
notice ("%s: compiling `%s'\n",
pname, compile_params[input_file_name_index]);
@@ -2382,7 +2297,7 @@ start_over: ;
if (referenced_file_is_newer (aux_info_p, aux_info_mtime))
{
free (aux_info_base);
- xfree (aux_info_relocated_name);
+ free (aux_info_relocated_name);
if (keep_it && my_unlink (aux_info_filename) == -1)
{
int errno_val = errno;
@@ -2431,7 +2346,7 @@ start_over: ;
}
free (aux_info_base);
- xfree (aux_info_relocated_name);
+ free (aux_info_relocated_name);
}
#ifndef UNPROTOIZE