From bb466d04556242aecbb0e6512f977ce869061fe6 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 26 Sep 2024 22:59:52 +0000 Subject: [PATCH] main: Use C99 style initializers Signed-off-by: Colin Walters --- tools/composefs-info.c | 20 ++++---- tools/mkcomposefs.c | 104 +++++++++++++++-------------------------- 2 files changed, 46 insertions(+), 78 deletions(-) diff --git a/tools/composefs-info.c b/tools/composefs-info.c index 8aea82e2..bf5b5e20 100644 --- a/tools/composefs-info.c +++ b/tools/composefs-info.c @@ -413,18 +413,14 @@ int main(int argc, char **argv) const char *bin = argv[0]; int opt; const struct option longopts[] = { - { - name: "basedir", - has_arg: required_argument, - flag: NULL, - val: OPT_BASEDIR - }, - { - name: "filter", - has_arg: required_argument, - flag: NULL, - val: OPT_FILTER - }, + { .name = "basedir", + .has_arg = required_argument, + .flag = NULL, + .val = OPT_BASEDIR }, + { .name = "filter", + .has_arg = required_argument, + .flag = NULL, + .val = OPT_FILTER }, {}, }; diff --git a/tools/mkcomposefs.c b/tools/mkcomposefs.c index ae291fd5..6050f0c1 100644 --- a/tools/mkcomposefs.c +++ b/tools/mkcomposefs.c @@ -1475,72 +1475,44 @@ static void usage(const char *argv0) int main(int argc, char **argv) { const struct option longopts[] = { - { - name: "skip-xattrs", - has_arg: no_argument, - flag: NULL, - val: OPT_SKIP_XATTRS - }, - { - name: "user-xattrs", - has_arg: no_argument, - flag: NULL, - val: OPT_USER_XATTRS - }, - { - name: "skip-devices", - has_arg: no_argument, - flag: NULL, - val: OPT_SKIP_DEVICES - }, - { - name: "use-epoch", - has_arg: no_argument, - flag: NULL, - val: OPT_USE_EPOCH - }, - { - name: "digest-store", - has_arg: required_argument, - flag: NULL, - val: OPT_DIGEST_STORE - }, - { - name: "print-digest", - has_arg: no_argument, - flag: NULL, - val: OPT_PRINT_DIGEST - }, - { - name: "print-digest-only", - has_arg: no_argument, - flag: NULL, - val: OPT_PRINT_DIGEST_ONLY - }, - { - name: "from-file", - has_arg: no_argument, - flag: NULL, - val: OPT_FROM_FILE - }, - { - name: "max-version", - has_arg: required_argument, - flag: NULL, - val: OPT_MAX_VERSION - }, - { - name: "min-version", - has_arg: required_argument, - flag: NULL, - val: OPT_MIN_VERSION - }, - { - name: "threads", - has_arg: required_argument, - flag: NULL, - val: OPT_THREADS - }, + { .name = "skip-xattrs", + .has_arg = no_argument, + .flag = NULL, + .val = OPT_SKIP_XATTRS }, + { .name = "user-xattrs", + .has_arg = no_argument, + .flag = NULL, + .val = OPT_USER_XATTRS }, + { .name = "skip-devices", + .has_arg = no_argument, + .flag = NULL, + .val = OPT_SKIP_DEVICES }, + { .name = "use-epoch", .has_arg = no_argument, .flag = NULL, .val = OPT_USE_EPOCH }, + { .name = "digest-store", + .has_arg = required_argument, + .flag = NULL, + .val = OPT_DIGEST_STORE }, + { .name = "print-digest", + .has_arg = no_argument, + .flag = NULL, + .val = OPT_PRINT_DIGEST }, + { .name = "print-digest-only", + .has_arg = no_argument, + .flag = NULL, + .val = OPT_PRINT_DIGEST_ONLY }, + { .name = "from-file", .has_arg = no_argument, .flag = NULL, .val = OPT_FROM_FILE }, + { .name = "max-version", + .has_arg = required_argument, + .flag = NULL, + .val = OPT_MAX_VERSION }, + { .name = "min-version", + .has_arg = required_argument, + .flag = NULL, + .val = OPT_MIN_VERSION }, + { .name = "threads", + .has_arg = required_argument, + .flag = NULL, + .val = OPT_THREADS }, {}, }; struct lcfs_write_options_s options = { 0 };