diff options
author | Sami Kerola | 2017-02-11 21:23:26 +0100 |
---|---|---|
committer | Karel Zak | 2017-02-20 12:58:49 +0100 |
commit | 87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3 (patch) | |
tree | 513541cfa347d7fc66e50137603489cb195c86de /sys-utils/swapon.c | |
parent | cfdisk: avoid use of VLA in combination with sizeof() [smatch scan] (diff) | |
download | kernel-qcow2-util-linux-87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3.tar.gz kernel-qcow2-util-linux-87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3.tar.xz kernel-qcow2-util-linux-87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3.zip |
misc: do not use plain 0 as NULL [smatch scan]
text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer
Since many 'struct option' has used zero as NULL make them more readable in
same go by reindenting, and using named argument requirements.
Reference: https://lwn.net/Articles/93577/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/swapon.c')
-rw-r--r-- | sys-utils/swapon.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c index 0982093d5..d0ad6bb6f 100644 --- a/sys-utils/swapon.c +++ b/sys-utils/swapon.c @@ -693,7 +693,7 @@ static int parse_options(struct swap_prop *props, const char *options) assert(props); assert(options); - if (mnt_optstr_get_option(options, "nofail", NULL, 0) == 0) + if (mnt_optstr_get_option(options, "nofail", NULL, NULL) == 0) props->no_fail = 1; if (mnt_optstr_get_option(options, "discard", &arg, &argsz) == 0) { @@ -845,21 +845,21 @@ int main(int argc, char *argv[]) }; static const struct option long_opts[] = { - { "priority", 1, 0, 'p' }, - { "discard", 2, 0, 'd' }, - { "ifexists", 0, 0, 'e' }, - { "options", 2, 0, 'o' }, - { "summary", 0, 0, 's' }, - { "fixpgsz", 0, 0, 'f' }, - { "all", 0, 0, 'a' }, - { "help", 0, 0, 'h' }, - { "verbose", 0, 0, 'v' }, - { "version", 0, 0, 'V' }, - { "show", 2, 0, SHOW_OPTION }, - { "noheadings", 0, 0, NOHEADINGS_OPTION }, - { "raw", 0, 0, RAW_OPTION }, - { "bytes", 0, 0, BYTES_OPTION }, - { NULL, 0, 0, 0 } + { "priority", required_argument, NULL, 'p' }, + { "discard", optional_argument, NULL, 'd' }, + { "ifexists", no_argument, NULL, 'e' }, + { "options", optional_argument, NULL, 'o' }, + { "summary", no_argument, NULL, 's' }, + { "fixpgsz", no_argument, NULL, 'f' }, + { "all", no_argument, NULL, 'a' }, + { "help", no_argument, NULL, 'h' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { "show", optional_argument, NULL, SHOW_OPTION }, + { "noheadings", no_argument, NULL, NOHEADINGS_OPTION }, + { "raw", no_argument, NULL, RAW_OPTION }, + { "bytes", no_argument, NULL, BYTES_OPTION }, + { NULL, 0, NULL, 0 } }; static const ul_excl_t excl[] = { /* rows and cols in ASCII order */ |