[patch] Cleanup init_raw_breakpoint

Yao Qi yao@codesourcery.com
Fri Nov 11 01:56:00 GMT 2011


On 11/11/2011 02:45 AM, Pedro Alves wrote:
> ...
>> > +
>> > +  if (b->loc == NULL)
>> > +    b->loc = loc;
> I don't understand the need for the explicit NULL check.
> 
> When b->loc is NULL, this:
> 
>      for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next))
>       ;
>      *tmp = loc;
> 
> is the same as `b->loc = loc'?
> 

Hmmm, right.  Original code is able to handle NULL.  How about this new
patch?

-- 
Yao (齐尧)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-refactor-breakpoint.patch
Type: text/x-patch
Size: 4163 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20111111/f0c7c377/attachment.bin>


More information about the Gdb-patches mailing list