This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH:gdb/mi] Update a specified list of variable objects
On Tuesday 22 September 2009 Nick Roberts wrote:
> > I've tried to address this point below. It's even in unified diff format!
Thanks!
>
> Actually it's probably better to use isdigit like below
In fact, it's probably even easier than than. Note this code from
mi_cmd_var_create:
if (strcmp (name, "-") == 0)
{
xfree (name);
name = varobj_gen_name ();
}
else if (!isalpha (*name))
error (_("mi_cmd_var_create: name of object must begin with a letter"));
with this in mind,
> + print_values = PRINT_NO_VALUES;
> + else if (argc == 2 && isdigit (*argv[0]))
> + {
> + optind = 1;
> + print_values = mi_parse_values_option (argv[0]);
> + }
can be written like this:
else if (argc == 2 && (isdigit (*argv[0]) || *argv[0] == '-'))
{
optind = 1;
print_values = mi_parse_values_option (argv[0]);
}
> else
> - name = (argv[1]);
> + {
> + while (1)
> + {
> + int opt = mi_getopt ("mi_cmd_var_update",
> + argc, argv, opts, &optind, &optarg);
And this code can be dropped. What do you think?
- Volodya