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]

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


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.

Attachment: coffgen3.txt
Description: Text document


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