summaryrefslogtreecommitdiffstats
path: root/sys-utils/hwclock.c
diff options
context:
space:
mode:
authorSami Kerola2017-02-11 21:23:26 +0100
committerKarel Zak2017-02-20 12:58:49 +0100
commit87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3 (patch)
tree513541cfa347d7fc66e50137603489cb195c86de /sys-utils/hwclock.c
parentcfdisk: avoid use of VLA in combination with sizeof() [smatch scan] (diff)
downloadkernel-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/hwclock.c')
-rw-r--r--sys-utils/hwclock.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index 6de09fda8..9fae9df23 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -1457,7 +1457,7 @@ static void usage(const struct hwclock_control *ctl, const char *fmt, ...)
*/
int main(int argc, char **argv)
{
- struct hwclock_control ctl = { 0 };
+ struct hwclock_control ctl = { NULL };
struct timeval startup_time;
struct adjtime adjtime = { 0 };
/*
@@ -1487,44 +1487,44 @@ int main(int argc, char **argv)
};
static const struct option longopts[] = {
- {"adjust", 0, 0, 'a'},
- {"help", 0, 0, 'h'},
- {"show", 0, 0, 'r'},
- {"hctosys", 0, 0, 's'},
- {"utc", 0, 0, 'u'},
- {"version", 0, 0, 'v'},
- {"systohc", 0, 0, 'w'},
- {"debug", 0, 0, 'D'},
+ { "adjust", no_argument, NULL, 'a' },
+ { "help", no_argument, NULL, 'h' },
+ { "show", no_argument, NULL, 'r' },
+ { "hctosys", no_argument, NULL, 's' },
+ { "utc", no_argument, NULL, 'u' },
+ { "version", no_argument, NULL, 'v' },
+ { "systohc", no_argument, NULL, 'w' },
+ { "debug", no_argument, NULL, 'D' },
#ifdef __alpha__
- {"ARC", 0, 0, 'A'},
- {"arc", 0, 0, 'A'},
- {"Jensen", 0, 0, 'J'},
- {"jensen", 0, 0, 'J'},
- {"SRM", 0, 0, 'S'},
- {"srm", 0, 0, 'S'},
- {"funky-toy", 0, 0, 'F'},
+ { "ARC", no_argument, NULL, 'A' },
+ { "arc", no_argument, NULL, 'A' },
+ { "Jensen", no_argument, NULL, 'J' },
+ { "jensen", no_argument, NULL, 'J' },
+ { "SRM", no_argument, NULL, 'S' },
+ { "srm", no_argument, NULL, 'S' },
+ { "funky-toy", no_argument, NULL, 'F' },
#endif
- {"set", 0, 0, OPT_SET},
+ { "set", no_argument, NULL, OPT_SET },
#ifdef __linux__
- {"getepoch", 0, 0, OPT_GETEPOCH},
- {"setepoch", 0, 0, OPT_SETEPOCH},
+ { "getepoch", no_argument, NULL, OPT_GETEPOCH },
+ { "setepoch", no_argument, NULL, OPT_SETEPOCH },
#endif
- {"noadjfile", 0, 0, OPT_NOADJFILE},
- {"localtime", 0, 0, OPT_LOCALTIME},
- {"badyear", 0, 0, OPT_BADYEAR},
- {"directisa", 0, 0, OPT_DIRECTISA},
- {"test", 0, 0, OPT_TEST},
- {"date", 1, 0, OPT_DATE},
- {"epoch", 1, 0, OPT_EPOCH},
+ { "noadjfile", no_argument, NULL, OPT_NOADJFILE },
+ { "localtime", no_argument, NULL, OPT_LOCALTIME },
+ { "badyear", no_argument, NULL, OPT_BADYEAR },
+ { "directisa", no_argument, NULL, OPT_DIRECTISA },
+ { "test", no_argument, NULL, OPT_TEST },
+ { "date", required_argument, NULL, OPT_DATE },
+ { "epoch", required_argument, NULL, OPT_EPOCH },
#ifdef __linux__
- {"rtc", 1, 0, 'f'},
+ { "rtc", required_argument, NULL, 'f' },
#endif
- {"adjfile", 1, 0, OPT_ADJFILE},
- {"systz", 0, 0, OPT_SYSTZ},
- {"predict-hc", 0, 0, OPT_PREDICT_HC},
- {"get", 0, 0, OPT_GET},
- {"update-drift",0, 0, OPT_UPDATE},
- {NULL, 0, NULL, 0}
+ { "adjfile", required_argument, NULL, OPT_ADJFILE },
+ { "systz", no_argument, NULL, OPT_SYSTZ },
+ { "predict-hc", no_argument, NULL, OPT_PREDICT_HC },
+ { "get", no_argument, NULL, OPT_GET },
+ { "update-drift", no_argument, NULL, OPT_UPDATE },
+ { NULL, 0, NULL, 0 }
};
static const ul_excl_t excl[] = { /* rows and cols in ASCII order */