This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] use xstrdup and friends more
- From: Alan Modra <amodra at gmail dot com>
- To: tbsaunde+binutils at tbsaunde dot org
- Cc: binutils at sourceware dot org
- Date: Tue, 29 Mar 2016 21:57:40 +1030
- Subject: Re: [PATCH] use xstrdup and friends more
- Authentication-results: sourceware.org; auth=none
- References: <1459247857-8098-1-git-send-email-tbsaunde+binutils at tbsaunde dot org>
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