summaryrefslogtreecommitdiff
path: root/gcc/collect2.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2001-04-23 00:36:28 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2001-04-23 00:36:28 +0000
commitd4c3ec27386c2b61e46604c0674dbb1dac004310 (patch)
tree790252fc6f2f85414e4da728fab71c76dd6c9020 /gcc/collect2.c
parent2ac8a0f9c2464064ba2eb5cd9d63a4f8d6e3525b (diff)
downloadgcc-d4c3ec27386c2b61e46604c0674dbb1dac004310.tar.gz
collect2.c (main): Use concat in lieu of xmalloc/sprintf.
* collect2.c (main): Use concat in lieu of xmalloc/sprintf. (write_c_file_stat): Likewise. * dbxout.c (dbxout_init): Likewise. * profile.c (output_func_start_profiler): Likewise. cp: * xref.c (GNU_xref_file): Use concat in lieu of xmalloc/sprintf. f: * com.c (ffecom_subscript_check_): Use concat in lieu of xmalloc/sprintf. java: * jvspec.c (lang_specific_driver): Fix memory allocation deficit, by using concat in lieu of xmalloc/sprintf. From-SVN: r41495
Diffstat (limited to 'gcc/collect2.c')
-rw-r--r--gcc/collect2.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 63ec00dacfd..4757b9fb688 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -1269,9 +1269,8 @@ main (argc, argv)
if (exports.first)
{
- char *buf = xmalloc (strlen (export_file) + 5);
-
- sprintf (buf, "-bE:%s", export_file);
+ char *buf = concat ("-bE:", export_file, NULL);
+
*ld1++ = buf;
*ld2++ = buf;
@@ -1435,13 +1434,7 @@ main (argc, argv)
/* Tell the linker that we have initializer and finalizer functions. */
#ifdef LD_INIT_SWITCH
#ifdef COLLECT_EXPORT_LIST
- {
- /* option name + functions + colons + NULL */
- char *buf = xmalloc (strlen (LD_INIT_SWITCH)
- + strlen(initname) + strlen(fininame) + 3);
- sprintf (buf, "%s:%s:%s", LD_INIT_SWITCH, initname, fininame);
- *ld2++ = buf;
- }
+ *ld2++ = concat (LD_INIT_SWITCH, ":", initname, ":", fininame, NULL);
#else
*ld2++ = LD_INIT_SWITCH;
*ld2++ = initname;
@@ -1456,12 +1449,7 @@ main (argc, argv)
/* If we did not add export flag to link arguments before, add it to
second link phase now. No new exports should have been added. */
if (! exports.first)
- {
- char *buf = xmalloc (strlen (export_file) + 5);
-
- sprintf (buf, "-bE:%s", export_file);
- *ld2++ = buf;
- }
+ *ld2++ = concat ("-bE:", export_file, NULL);
add_to_list (&exports, initname);
add_to_list (&exports, fininame);
@@ -1878,13 +1866,8 @@ write_c_file_stat (stream, name)
notice ("\nwrite_c_file - output name is %s, prefix is %s\n",
output_file, prefix);
-#define INIT_NAME_FORMAT "_GLOBAL__FI_%s"
- initname = xmalloc (strlen (prefix) + sizeof (INIT_NAME_FORMAT) - 2);
- sprintf (initname, INIT_NAME_FORMAT, prefix);
-
-#define FINI_NAME_FORMAT "_GLOBAL__FD_%s"
- fininame = xmalloc (strlen (prefix) + sizeof (FINI_NAME_FORMAT) - 2);
- sprintf (fininame, FINI_NAME_FORMAT, prefix);
+ initname = concat ("_GLOBAL__FI_", prefix, NULL);
+ fininame = concat ("_GLOBAL__FD_", prefix, NULL);
free (prefix);