From 04b3acf4692edd57417582e932d915e44ca808ae Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 24 Dec 2004 08:07:29 +0000 Subject: [PATCH] (parser_init): Omit unnecessary alignments, and comment the alignments. --- lib/argp-parse.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/argp-parse.c b/lib/argp-parse.c index 509f6dea8..85e6b9033 100644 --- a/lib/argp-parse.c +++ b/lib/argp-parse.c @@ -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); -- 2.11.0