diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2001-09-15 14:04:47 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2001-09-15 14:04:47 +0000 |
commit | cb6edbcb190c1d42e02deae9532e24e059742f32 (patch) | |
tree | 45aae5c4dc09289e3c64fd42746ee1cea71aa7be /gcc/gcc.c | |
parent | 461c166993aa3bb3022e90451bbadcd24a0d1531 (diff) | |
download | gcc-cb6edbcb190c1d42e02deae9532e24e059742f32.zip gcc-cb6edbcb190c1d42e02deae9532e24e059742f32.tar.gz gcc-cb6edbcb190c1d42e02deae9532e24e059742f32.tar.bz2 |
collect2.c (main): Const-ification.
* collect2.c (main): Const-ification.
* gcc.c (translate_options, process_command): Use xstrdup in
lieu of xmalloc/strcpy.
(main): Use concat in lieu of xmalloc/strcpy/strcat.
cp:
* mangle.c (mangle_conv_op_name_for_type): Use concat in lieu of
xmalloc/strcpy/strcat.
From-SVN: r45631
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r-- | gcc/gcc.c | 20 |
1 files changed, 4 insertions, 16 deletions
@@ -1011,8 +1011,7 @@ translate_options (argcp, argvp) newv = (const char **) xrealloc (newv, newvsize); sp = target_option_translations[tott_idx].replacements; - np = (char *) xmalloc (strlen (sp) + 1); - strcpy (np, sp); + np = xstrdup (sp); while (1) { @@ -3910,15 +3909,13 @@ process_command (argc, argv) /* On some systems, ld cannot handle some options without a space. So split the option from its argument. */ char *part1 = (char *) xmalloc (2); - char *tmp; part1[0] = c; part1[1] = '\0'; switches[n_switches].part1 = part1; switches[n_switches].args = (const char **) xmalloc (2 * sizeof (const char *)); - switches[n_switches].args[0] = tmp = xmalloc (strlen (p)); - strcpy (tmp, &p[1]); + switches[n_switches].args[0] = xstrdup (p+1); switches[n_switches].args[1] = 0; } else @@ -5812,17 +5809,8 @@ main (argc, argv) /* If we have a GCC_EXEC_PREFIX envvar, modify it for cpp's sake. */ if (gcc_exec_prefix) - { - char *temp = (char *) xmalloc (strlen (gcc_exec_prefix) - + strlen (spec_version) - + strlen (spec_machine) + 3); - strcpy (temp, gcc_exec_prefix); - strcat (temp, spec_machine); - strcat (temp, dir_separator_str); - strcat (temp, spec_version); - strcat (temp, dir_separator_str); - gcc_exec_prefix = temp; - } + gcc_exec_prefix = concat (gcc_exec_prefix, spec_machine, dir_separator_str, + spec_version, dir_separator_str, NULL); /* Now we have the specs. Set the `valid' bits for switches that match anything in any spec. */ |