diff options
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/collect2.c | 29 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/xref.c | 9 | ||||
-rw-r--r-- | gcc/dbxout.c | 6 | ||||
-rw-r--r-- | gcc/f/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/f/com.c | 17 | ||||
-rw-r--r-- | gcc/java/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/java/jvspec.c | 10 | ||||
-rw-r--r-- | gcc/profile.c | 3 |
10 files changed, 40 insertions, 57 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 97cb941..f2a7a3d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2001-04-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * 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. + 2001-04-22 Philipp Thomas <pthomas@suse.de> * ABOUT-GCC-NLS: Now that gettext 0.10.37 is out, diff --git a/gcc/collect2.c b/gcc/collect2.c index 63ec00d..4757b9f 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); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d827330..31019b2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2001-04-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * xref.c (GNU_xref_file): Use concat in lieu of xmalloc/sprintf. + 2001-04-23 Jason Merrill <jason_merrill@redhat.com> * except.c (build_throw): Wrap the initialization of the exception diff --git a/gcc/cp/xref.c b/gcc/cp/xref.c index cf99fcd..af35020 100644 --- a/gcc/cp/xref.c +++ b/gcc/cp/xref.c @@ -205,14 +205,7 @@ GNU_xref_file (name) if (FILE_NAME_ABSOLUTE_P (name) || ! wd_name) xf->outname = xf->name; else - { - char *nmbuf - = (char *) xmalloc (strlen (wd_name) + strlen (FILE_NAME_JOINER) - + strlen (name) + 1); - sprintf (nmbuf, "%s%s%s", wd_name, FILE_NAME_JOINER, name); - name = nmbuf; - xf->outname = nmbuf; - } + xf->outname = name = concat (wd_name, FILE_NAME_JOINER, name, NULL); fprintf (xref_file, "FIL %s %s 0\n", name, wd_name); diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 31c8596..1252e2b 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -395,11 +395,7 @@ dbxout_init (asm_file, input_file_name, syms) #endif { if (!cwd && (cwd = getpwd ()) && (!*cwd || cwd[strlen (cwd) - 1] != '/')) - { - char *wdslash = xmalloc (strlen (cwd) + sizeof (FILE_NAME_JOINER)); - sprintf (wdslash, "%s%s", cwd, FILE_NAME_JOINER); - cwd = wdslash; - } + cwd = concat (cwd, FILE_NAME_JOINER, NULL); if (cwd) { #ifdef DBX_OUTPUT_MAIN_SOURCE_DIRECTORY diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 5a9c6fe..f4ceb1c 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,8 @@ +Sun Apr 22 20:18:01 2001 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * com.c (ffecom_subscript_check_): Use concat in lieu of + xmalloc/sprintf. + 2001-04-21 Toon Moene <toon@moene.indiv.nluug.nl> * news.texi: Update release information for 0.5.27. diff --git a/gcc/f/com.c b/gcc/f/com.c index 52843e3..87d63f0 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -694,10 +694,8 @@ ffecom_subscript_check_ (tree array, tree element, int dim, int total_dims, switch (total_dims) { case 0: - var = xmalloc (strlen (array_name) + 20); - sprintf (var, "%s[%s-substring]", - array_name, - dim ? "end" : "start"); + var = concat (array_name, "[", (dim ? "end" : "start"), + "-substring]", NULL); len = strlen (var) + 1; arg1 = build_string (len, var); free (var); @@ -740,13 +738,10 @@ ffecom_subscript_check_ (tree array, tree element, int dim, int total_dims, convert (TREE_TYPE (element), integer_one_node))); - proc = xmalloc ((len = strlen (input_filename) - + IDENTIFIER_LENGTH (DECL_NAME (current_function_decl)) - + 2)); - - sprintf (&proc[0], "%s/%s", - input_filename, - IDENTIFIER_POINTER (DECL_NAME (current_function_decl))); + proc = concat (input_filename, "/", + IDENTIFIER_POINTER (DECL_NAME (current_function_decl)), + NULL); + len = strlen (proc) + 1; arg3 = build_string (len, proc); free (proc); diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index d6af9b3..43c5d49 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2001-04-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * jvspec.c (lang_specific_driver): Fix memory allocation + deficit, by using concat in lieu of xmalloc/sprintf. + 2001-04-20 Per Bothner <per@bothner.com> Fixes to compile multiple .class files at once. diff --git a/gcc/java/jvspec.c b/gcc/java/jvspec.c index 105f813..fd6ec5a 100644 --- a/gcc/java/jvspec.c +++ b/gcc/java/jvspec.c @@ -436,20 +436,14 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries) if (strcmp (argv[i], "-classpath") == 0 || strcmp (argv[i], "-CLASSPATH") == 0) { - char* patharg - = (char*) xmalloc (strlen (argv[i]) + strlen (argv[i+1]) + 3); - sprintf (patharg, "-f%s=%s", argv[i]+1, argv[i+1]); - arglist[j] = patharg; + arglist[j] = concat ("-f", argv[i]+1, "=", argv[i+1], NULL); i++; continue; } if (strcmp (argv[i], "-d") == 0) { - char *patharg = (char *) xmalloc (sizeof ("-foutput-class-dir=") - + strlen (argv[i + 1]) + 1); - sprintf (patharg, "-foutput-class-dir=%s", argv[i + 1]); - arglist[j] = patharg; + arglist[j] = concat ("-foutput-class-dir=", argv[i + 1], NULL); ++i; continue; } diff --git a/gcc/profile.c b/gcc/profile.c index 7b5169c..5225308 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -1090,8 +1090,7 @@ output_func_start_profiler () fnname = get_file_function_name ('I'); cfnname = IDENTIFIER_POINTER (fnname); - name = xmalloc (strlen (cfnname) + 5); - sprintf (name, "%sGCOV",cfnname); + name = concat (cfnname, "GCOV", NULL); fnname = get_identifier (name); free (name); |