(parser_init): Omit unnecessary alignments, and comment the alignments.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 24 Dec 2004 08:07:29 +0000 (08:07 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 24 Dec 2004 08:07:29 +0000 (08:07 +0000)
lib/argp-parse.c

index 509f6dea8522303f778f8f524a62dbe7bdad31cb..85e6b9033e0d3fed574eeb99c8725d6f48c68bd3 100644 (file)
@@ -482,12 +482,18 @@ parser_init (struct parser *parser, const struct argp *argp,
 
   /* Lengths of the various bits of storage used by PARSER.  */
   glen = (szs.num_groups + 1) * sizeof (struct group);
-  gsum = alignto (glen, alignof (void *));
   clen = szs.num_child_inputs * sizeof (void *);
-  csum = alignto (gsum + clen, alignof (struct option));
   llen = (szs.long_len + 1) * sizeof (struct option);
-  lsum = alignto (csum + llen, alignof (char));
   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
+     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.  */
+  gsum = glen;
+  csum = alignto (gsum + clen, alignof (struct option));
+  lsum = csum + llen;
   ssum = lsum + slen;
 
   parser->storage = malloc (ssum);