* 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
+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,
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;
/* 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;
/* 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);
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);
+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
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);
#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
+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.
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);
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);
+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.
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;
}
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);