Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mxqset: Use initializers with designators
Not all fields of struct argp_option and struct argp are initialized:

mxqset.c:192:5: warning: missing initializer for field ‘group’ of ‘const struct argp_option’ [-Wmissing-field-initializers]
     {"whitelist",               15, "",     0, NULL},
mxqset.c:196:21: warning: missing initializer for field ‘children’ of ‘const struct argp’ [-Wmissing-field-initializers]
 static const struct argp argp = { options, parser, NULL, NULL }

Use structure initializers with designators, which initialize all
remaining fields with their zero values.
  • Loading branch information
donald committed May 5, 2022
1 parent 0ea4705 commit 8318176
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mxqset.c
Expand Up @@ -186,14 +186,14 @@ static error_t parser (int key, char *arg, struct argp_state *state) {
}

static const struct argp_option options[] = {
{"closed", 10, NULL, 0, NULL},
{"open", 11, NULL, 0, NULL},
{"blacklist", 13, "", 0, NULL},
{"whitelist", 15, "", 0, NULL},
{ .name = "closed", .key = 10 },
{ .name = "open", .key = 11 },
{ .name = "blacklist", .key = 13 },
{ .name = "whitelist", .key = 15 },
{0}
};

static const struct argp argp = { options, parser, NULL, NULL };
static const struct argp argp = { .options = options, .parser = parser };

static __attribute__ ((noreturn)) void exit_usage(void) {
fprintf(stderr,
Expand Down

0 comments on commit 8318176

Please sign in to comment.