Treat optional arguments the same for long and short options

This was noticed in bug 642825 and the change was proposed
by Kjell Ahlstedt.
This commit is contained in:
Matthias Clasen 2011-02-25 08:45:28 -05:00
parent c68c05a420
commit ee9e38ef68

View File

@ -1485,7 +1485,7 @@ parse_long_option (GOptionContext *context,
value = arg + len + 1;
else if (*idx < *argc - 1)
{
if (!(group->entries[j].flags & G_OPTION_FLAG_OPTIONAL_ARG))
if (!OPTIONAL_ARG (&group->entries[j]))
{
value = (*argv)[*idx + 1];
add_pending_null (context, &((*argv)[*idx + 1]), NULL);
@ -1510,8 +1510,7 @@ parse_long_option (GOptionContext *context,
}
}
}
else if (*idx >= *argc - 1 &&
group->entries[j].flags & G_OPTION_FLAG_OPTIONAL_ARG)
else if (*idx >= *argc - 1 && OPTIONAL_ARG (&group->entries[j]))
{
gboolean retval;
retval = parse_arg (context, group, &group->entries[j],