This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Add plugin interface to LD [1/4] Infrastructure.
- From: Richard Sandiford <richard dot sandiford at linaro dot org>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Dave Korn <dave dot korn dot cygwin at gmail dot com>, "binutils\ at sourceware dot org" <binutils at sourceware dot org>
- Date: Tue, 12 Oct 2010 09:32:26 +0100
- Subject: Re: [PATCH] Add plugin interface to LD [1/4] Infrastructure.
- References: <4C9AE5CA.80707@gmail.com> <4C9AE625.8030904@gmail.com> <4CACE2C8.8050202@redhat.com>
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.
Richard