From 713829e97b2cabe9369424002f6efb23a7c86aba Mon Sep 17 00:00:00 2001 From: ghazi Date: Tue, 7 Sep 1999 02:36:41 +0000 Subject: * 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 --- gcc/prefix.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'gcc/prefix.c') diff --git a/gcc/prefix.c b/gcc/prefix.c index 8b53d3a1dc7..c659c28e7be 100644 --- a/gcc/prefix.c +++ b/gcc/prefix.c @@ -282,7 +282,7 @@ translate_name (name) /* Remove any trailing directory separator from what we got. */ if (IS_DIR_SEPARATOR (prefix[strlen (prefix) - 1])) { - char * temp = save_string (prefix, strlen (prefix)); + char * temp = xstrdup (prefix); temp[strlen (temp) - 1] = 0; prefix = temp; } @@ -312,28 +312,24 @@ update_path (path, key) /* Convert DIR_SEPARATOR_2 to DIR_SEPARATOR. */ if (DIR_SEPARATOR != DIR_SEPARATOR_2) { - int i; - int len = strlen (path); - char *new_path = save_string (path, len); - for (i = 0; i < len; i++) - if (new_path[i] == DIR_SEPARATOR_2) - new_path[i] = DIR_SEPARATOR; + char *new_path = xstrdup (path); path = new_path; + do { + if (*new_path == DIR_SEPARATOR_2) + *new_path = DIR_SEPARATOR; + } while (*new_path++); } #endif #if defined (DIR_SEPARATOR) && !defined (DIR_SEPARATOR_2) if (DIR_SEPARATOR != '/') { - int i; - int len = strlen (path); - char *new_path = save_string (path, len); - - for (i = 0; i < len; i++) - if (new_path[i] == '/') - new_path[i] = DIR_SEPARATOR; - + char *new_path = xstrdup (path); path = new_path; + do { + if (*new_path == '/') + *new_path = DIR_SEPARATOR; + } while (*newpath++); } #endif -- cgit v1.2.1