This is the mail archive of the gdb-patches@sourceware.cygnus.com 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]

Re: small patch to 19991101 snapshot


>OK, Jimmy, want to be a code reviewer?
>How about the following, using a match flag
>instead of a goto?

This looks much more appealing and clean to me :).  I vote for this
change.

- Jimmy Guo, guo@cup.hp.com

>static void
>map_breakpoint_numbers (args, function)
>     char *args;
>     void (*function) PARAMS ((struct breakpoint *));
>{
>  register char *p = args;
>  char *p1;
>  register int num;
>  register struct breakpoint *b, *tmp;
>  int match;
>
>  if (p == 0)
>    error_no_arg ("one or more breakpoint numbers");
>
>  while (*p)
>    {
>      match = 0;
>      p1 = p;
>
>      num = get_number_or_range (&p1);
>      if (num == 0)
>        {
>          warning ("bad breakpoint number at or near '%s'", p);
>        }
>      else
>        {
>          ALL_BREAKPOINTS_SAFE (b, tmp)
>            if (b->number == num)
>              {
>                struct breakpoint *related_breakpoint =
>b->related_breakpoint;
>                match = 1;
>                function (b);
>                if (related_breakpoint)
>                  function (related_breakpoint);
>                break;
>              }
>          if (match == 0)
>            printf_unfiltered ("No breakpoint number %d.\n", num);
>        }
>      p = p1;
>    }
>}


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