[glib/glib-2-28] Treat optional arguments the same for long and short options



commit 563d1e3e7578f60a07d869dba34ef6ca81e34272
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Feb 25 08:45:28 2011 -0500

    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 files 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],



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]