This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] use xstrdup and friends more


On Tue, Mar 29, 2016 at 06:37:37AM -0400, tbsaunde+binutils@tbsaunde.org wrote:
> 	* config/tc-hppa.c (pa_space): Use xstrdup where appropriate.
> 	(pa_subspace): Likewise.
> 	(create_new_space): Likewise.
> 	(create_new_subspace): Likewise.
> 	* config/tc-mips.c (mips_lookup_insn): Likewise.
> 	* config/tc-tic4x.c (tic4x_asg): Likewise.
> 	* config/tc-tic54x.c (tic54x_eval): Likewise.
> 	(stag_add_field): Likewise.
> 	(tic54x_usect): Likewise.
> 	(tic54x_clink): Likewise.
> 	(tic54x_set_default_include): Likewise.
> 	(tic54x_include): Likewise.
> 	(tic54x_message): Likewise.
> 	(tic54x_sblock): Likewise.
> 	(tic54x_var): Likewise.
> 	(subsym_ismember): Likewise.
> 	(subsym_substitute): Likewise.
> 	* config/tc-xtensa.c (xg_replace_opname): Likewise.
> 	(xg_translate_sysreg_op): Likewise.
> 	(xg_translate_idioms): Likewise.
> 	(md_assemble): Likewise.
> 	(cache_literal_section): Likewise.

OK, but

> -  new_opname = (char *) xmalloc (strlen (sr_name) + 6);
> -  sprintf (new_opname, "%s.%s", *popname, sr_name);
> +  new_opname = concat (*popname, ".", sr_name, NULL);

here and other places you use concat, please pass (const char *) NULL
as the last argument.  The reason being that we are passing an
argument corresponding to the ellipsis in the prototype, and if NULL
is simply defined as 0 it may be that ints are passed differently to
char*.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]