From ee9e38ef6850ef1ce8da683425621898a35d5b5f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 25 Feb 2011 08:45:28 -0500 Subject: [PATCH] Treat optional arguments the same for long and short options This was noticed in bug 642825 and the change was proposed by Kjell Ahlstedt. --- glib/goption.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/glib/goption.c b/glib/goption.c index f09c7e1..276c7de 100644 --- a/glib/goption.c +++ b/glib/goption.c @@ -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], -- 2.7.4