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] Add plugin interface to LD [1/4] Infrastructure.


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


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