This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [RFA] Remove pre_expand_symtabs_matching quick_symbol_functions API


On Wed, 02 Jan 2013 18:54:27 +0100, Doug Evans wrote:
> Yeah, except I think this case is a valid instance to violate them.
> 
> An equivalent is:
> 
>   for (per_cu = dw2_symtab_iter_next (&iter);
>         per_cu != NULL;
>         per_cu = dw2_symtab_iter_next (&iter))
> 
> I could change foo_init/foo_next to foo_first/foo_next so that it
> works better with for(), but blech.

I find the following code appropriate in such cases:

while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL)
  {
  }
->
for (;;)
  {
    per_cu = dw2_symtab_iter_next (&iter);
    if (per_cu == NULL)
      break;
  }

Sorry for this nitpick.


Jan


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