[PATCH] Add plugin interface to LD [1/4] Infrastructure.
Dave Korn
dave.korn.cygwin@gmail.com
Tue Oct 12 11:12:00 GMT 2010
On 12/10/2010 09:32, Richard Sandiford wrote:
> Richard Henderson <rth@redhat.com> writes:
>>> + {
>>> + char *newfmt = xmalloc (strlen (format) + 3);
>>> + newfmt[0] = '%';
>>> + newfmt[1] = (level == LDPL_FATAL) ? 'F' : 'X';
>>> + strcpy (&newfmt[2], format);
>>> + vfinfo (stderr, newfmt, args, TRUE);
>>> + }
>> Probably better as
>>
>> newfmt = concat ((level == LDPL_FATAL ? "%F" : "%X"),
>> format, NULL);
>
> Plugging my favourite libiberty macro, there's also ACONCAT ((...))
> (which avoids the malloc and free). Should be safe for the kinds
> of string lengths we're talking about here.
It's been years since we had to worry about alloca portability, hasn't it?
I'll use it!
cheers,
DaveK
More information about the Binutils
mailing list