bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] argp: rename "struct group" to "struct argp_group"


From: Eric Wong
Subject: [PATCH] argp: rename "struct group" to "struct argp_group"
Date: Mon, 17 Feb 2014 22:20:02 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

This avoid conflicts with FreeBSD headers when using the
"freebsd-glue" package on Debian GNU/kFreeBSD

Reproducible with:
  ./configure LIBS=-lfreebsd-glue CFLAGS=-I/usr/include/freebsd

* lib/argp-parse.c (struct argp_group): rename from struct group
---
  Now I'm stuck on another failure, another email coming

 lib/argp-parse.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/lib/argp-parse.c b/lib/argp-parse.c
index 9ade452..3f6af2a 100644
--- a/lib/argp-parse.c
+++ b/lib/argp-parse.c
@@ -191,7 +191,7 @@ find_long_option (struct option *long_options, const char 
*name)
 /* The state of a "group" during parsing.  Each group corresponds to a
    particular argp structure from the tree of such descending from the top
    level argp passed to argp_parse.  */
-struct group
+struct argp_group
 {
   /* This group's parsing function.  */
   argp_parser_t parser;
@@ -208,7 +208,7 @@ struct group
   unsigned args_processed;
 
   /* This group's parser's parent's group.  */
-  struct group *parent;
+  struct argp_group *parent;
   unsigned parent_index;        /* And the our position in the parent.   */
 
   /* These fields are swapped into and out of the state structure when
@@ -221,7 +221,8 @@ struct group
    from STATE before calling, and back into state afterwards.  If GROUP has
    no parser, EBADKEY is returned.  */
 static error_t
-group_parse (struct group *group, struct argp_state *state, int key, char *arg)
+group_parse (struct argp_group *group, struct argp_state *state,
+             int key, char *arg)
 {
   if (group->parser)
     {
@@ -252,9 +253,9 @@ struct parser
   struct _getopt_data opt_data;
 
   /* States of the various parsing groups.  */
-  struct group *groups;
+  struct argp_group *groups;
   /* The end of the GROUPS array.  */
-  struct group *egroup;
+  struct argp_group *egroup;
   /* A vector containing storage for the CHILD_INPUTS field in all groups.  */
   void **child_inputs;
 
@@ -285,10 +286,10 @@ struct parser_convert_state
    into getopt options stored in SHORT_OPTS and LONG_OPTS; SHORT_END and
    CVT->LONG_END are the points at which new options are added.  Returns the
    next unused group entry.  CVT holds state used during the conversion.  */
-static struct group *
+static struct argp_group *
 convert_options (const struct argp *argp,
-                 struct group *parent, unsigned parent_index,
-                 struct group *group, struct parser_convert_state *cvt)
+                 struct argp_group *parent, unsigned parent_index,
+                 struct argp_group *group, struct parser_convert_state *cvt)
 {
   /* REAL is the most recent non-alias value of OPT.  */
   const struct argp_option *real = argp->options;
@@ -459,7 +460,7 @@ parser_init (struct parser *parser, const struct argp *argp,
              int argc, char **argv, int flags, void *input)
 {
   error_t err = 0;
-  struct group *group;
+  struct argp_group *group;
   struct parser_sizes szs;
   struct _getopt_data opt_data = _GETOPT_DATA_INITIALIZER;
   char *storage;
@@ -477,13 +478,13 @@ parser_init (struct parser *parser, const struct argp 
*argp,
     calc_sizes (argp, &szs);
 
   /* Lengths of the various bits of storage used by PARSER.  */
-  glen = (szs.num_groups + 1) * sizeof (struct group);
+  glen = (szs.num_groups + 1) * sizeof (struct argp_group);
   clen = szs.num_child_inputs * sizeof (void *);
   llen = (szs.long_len + 1) * sizeof (struct option);
   slen = szs.short_len + 1;
 
   /* Sums of previous lengths, properly aligned.  There's no need to
-     align gsum, since struct group is aligned at least as strictly as
+     align gsum, since struct argp_group is aligned at least as strictly as
      void * (since it contains a void * member).  And there's no need
      to align lsum, since struct option is aligned at least as
      strictly as char.  */
@@ -570,7 +571,7 @@ static error_t
 parser_finalize (struct parser *parser,
                  error_t err, int arg_ebadkey, int *end_index)
 {
-  struct group *group;
+  struct argp_group *group;
 
   if (err == EBADKEY && arg_ebadkey)
     /* Suppress errors generated by unparsed arguments.  */
@@ -669,7 +670,7 @@ parser_parse_arg (struct parser *parser, char *val)
      we're parsing is again the front of the arg vector.  */
   int index = --parser->state.next;
   error_t err = EBADKEY;
-  struct group *group;
+  struct argp_group *group;
   int key = 0;                  /* Which of ARGP_KEY_ARG[S] we used.  */
 
   /* Try to parse the argument in each parser.  */
@@ -726,7 +727,7 @@ parser_parse_opt (struct parser *parser, int opt, char *val)
        various starting positions in each group's SHORT_END field, we can
        determine which group OPT came from.  */
     {
-      struct group *group;
+      struct argp_group *group;
       char *short_index = strchr (parser->short_opts, opt);
 
       if (short_index)
@@ -938,7 +939,7 @@ __argp_input (const struct argp *argp, const struct 
argp_state *state)
 {
   if (state)
     {
-      struct group *group;
+      struct argp_group *group;
       struct parser *parser = state->pstate;
 
       for (group = parser->groups; group < parser->egroup; group++)
-- 
EW




reply via email to

[Prev in Thread] Current Thread [Next in Thread]