This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Display var_zinteger as signed
> 2011-07-04 Andrew Burgess <aburgess@broadcom.com>
>
> * cli/cli-setshow.c (do_setshow_command): Display var_zinteger
> variables as signed, not unsigned.
I'm not a fan of fall throughs, like this, because I think it
makes the code harder to read, but if no other maintainer has
an objection to it, then the patch is OK (please wait for a couple
of days to give everyone else a little time to comment on this).
> case var_integer:
> if (*(int *) c->var == INT_MAX)
> {
> fputs_filtered ("unlimited", stb->stream);
> + break;
> }
> - else
> - fprintf_filtered (stb->stream, "%d", *(int *) c->var);
> + /* else fall through */
> + case var_zinteger:
> + fprintf_filtered (stb->stream, "%d", *(int *) c->var);
> break;
I'd personally write this:
case var_integer:
case var_zinteger:
if (c->var_type == var_integer && *(int *) c->var == INT_MAX)
fputs_filtered ("unlimited", stb->stream);
else
fprintf_filtered (stb->stream, "%d", *(int *) c->var);
--
Joel