This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] genmodes: don't truncate a mode name of length >= 7


Richard Guenther wrote:
> On Thu, Apr 19, 2012 at 10:35 PM, Jim Meyering <jim@meyering.net> wrote:
>> Richard Guenther wrote:
>>> Sure, my point was that the
>>>
>>> ? ? ? if (strlen (m->name) >= sizeof buf)
>>> ? ? ? ? {
>>> ? ? ? ? ? error ("%s:%d:mode name \"%s\" is too long",
>>> ? ? ? ? ? ? ? ? ?m->file, m->line, m->name);
>>> ? ? ? ? ? continue;
>>> ? ? ? ? }
>>>
>>> check does not account for the (conditional) prepending of 'C' and the
>>> snprintf would silently discard the last character of the name.
>>
>> Here's a patch for that. ?(passes make bootstrap)
>> Incidentally it removes the name-length limitation of 7 and it hoists
>> the xmalloc, which induces the single added free-before-continue.
>> There was some clean-up along the way: "q" was easy to eliminate, and
>> I pulled the two identical snprintf calls out of the "if" block and
>> replaced them with the buf[0] assignment and memcpy.
>
> Ok.

Thanks for the review.  Committed.


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