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
This commit is contained in:
Kaveh R. Ghazi 2001-04-23 00:36:28 +00:00 committed by Kaveh Ghazi
parent 2ac8a0f9c2
commit d4c3ec2738
10 changed files with 40 additions and 57 deletions

View File

@ -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,

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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.

View File

@ -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);

View File

@ -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.

View File

@ -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;
}

View File

@ -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);