[Fwd: Re: [patch] coffgen.c, degenerate case]

msnyder@sonic.net msnyder@sonic.net
Thu Jul 26 01:43:00 GMT 2007


DJ Delorie writes:
> msnyder@sonic.net writes:
>> --- 1446,1456 ----
>>     size = obj_raw_syment_count (abfd) * symesz;
>>
>>     syms = bfd_malloc (size);
>> !   if (syms == NULL)
>> !     if (size == 0)
>> !       return TRUE;
>> !     else
>> !       return FALSE;
>>
>>     if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
>>         || bfd_bread (syms, size, abfd) != size)
>
> Why not test earlier, and bypass the bfd_malloc completely?

Ummm... I can think of no good reason.

> Also, please add braces around the inner if/else so that the else
> doesn't appear ambiguous.

Gotcha -- except now I don't need a nested if.
Revised patch attached.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: coffgen3.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20070726/83984d24/attachment.txt>


More information about the Binutils mailing list