summaryrefslogtreecommitdiffstats
path: root/text-utils
diff options
context:
space:
mode:
authorSami Kerola2017-02-11 21:23:26 +0100
committerKarel Zak2017-02-20 12:58:49 +0100
commit87918040658f2fa9b1bf78f1f8f4f5c065a2e3a3 (patch)
tree513541cfa347d7fc66e50137603489cb195c86de /text-utils
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 'text-utils')
-rw-r--r--text-utils/col.c18
-rw-r--r--text-utils/colcrt.c2
-rw-r--r--text-utils/colrm.c6
-rw-r--r--text-utils/column.c18
-rw-r--r--text-utils/more.c4
-rw-r--r--text-utils/rev.c6
-rw-r--r--text-utils/tailf.c10
-rw-r--r--text-utils/ul.c10
8 files changed, 37 insertions, 37 deletions
diff --git a/text-utils/col.c b/text-utils/col.c
index 7bf3708bd..b35306e48 100644
--- a/text-utils/col.c
+++ b/text-utils/col.c
@@ -173,15 +173,15 @@ int main(int argc, char **argv)
int ret = EXIT_SUCCESS;
static const struct option longopts[] = {
- { "no-backspaces", no_argument, 0, 'b' },
- { "fine", no_argument, 0, 'f' },
- { "pass", no_argument, 0, 'p' },
- { "tabs", no_argument, 0, 'h' },
- { "spaces", no_argument, 0, 'x' },
- { "lines", required_argument, 0, 'l' },
- { "version", no_argument, 0, 'V' },
- { "help", no_argument, 0, 'H' },
- { NULL, 0, 0, 0 }
+ { "no-backspaces", no_argument, NULL, 'b' },
+ { "fine", no_argument, NULL, 'f' },
+ { "pass", no_argument, NULL, 'p' },
+ { "tabs", no_argument, NULL, 'h' },
+ { "spaces", no_argument, NULL, 'x' },
+ { "lines", required_argument, NULL, 'l' },
+ { "version", no_argument, NULL, 'V' },
+ { "help", no_argument, NULL, 'H' },
+ { NULL, 0, NULL, 0 }
};
setlocale(LC_ALL, "");
diff --git a/text-utils/colcrt.c b/text-utils/colcrt.c
index 346a10fff..ff8cd4694 100644
--- a/text-utils/colcrt.c
+++ b/text-utils/colcrt.c
@@ -224,7 +224,7 @@ static void colcrt(struct colcrt_control *ctl)
int main(int argc, char **argv)
{
- struct colcrt_control ctl = { 0 };
+ struct colcrt_control ctl = { NULL };
int opt;
enum { NO_UL_OPTION = CHAR_MAX + 1 };
diff --git a/text-utils/colrm.c b/text-utils/colrm.c
index d474696e7..b2816cd07 100644
--- a/text-utils/colrm.c
+++ b/text-utils/colrm.c
@@ -158,9 +158,9 @@ int main(int argc, char **argv)
int opt;
static const struct option longopts[] = {
- {"version", no_argument, 0, 'V'},
- {"help", no_argument, 0, 'h'},
- {NULL, 0, 0, 0}
+ {"version", no_argument, NULL, 'V'},
+ {"help", no_argument, NULL, 'h'},
+ {NULL, 0, NULL, 0}
};
setlocale(LC_ALL, "");
diff --git a/text-utils/column.c b/text-utils/column.c
index 2eb47a3ea..deeea855e 100644
--- a/text-utils/column.c
+++ b/text-utils/column.c
@@ -152,15 +152,15 @@ int main(int argc, char **argv)
static const struct option longopts[] =
{
- { "columns", 1, 0, 'c' }, /* deprecated */
- { "fillrows", 0, 0, 'x' },
- { "help", 0, 0, 'h' },
- { "output-separator", 1, 0, 'o' },
- { "output-width", 1, 0, 'c' },
- { "separator", 1, 0, 's' },
- { "table", 0, 0, 't' },
- { "version", 0, 0, 'V' },
- { NULL, 0, 0, 0 },
+ { "columns", required_argument, NULL, 'c' }, /* deprecated */
+ { "fillrows", no_argument, NULL, 'x' },
+ { "help", no_argument, NULL, 'h' },
+ { "output-separator", required_argument, NULL, 'o' },
+ { "output-width", required_argument, NULL, 'c' },
+ { "separator", required_argument, NULL, 's' },
+ { "table", no_argument, NULL, 't' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 },
};
setlocale(LC_ALL, "");
diff --git a/text-utils/more.c b/text-utils/more.c
index 76ba24a17..ea881e8ed 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -1481,7 +1481,7 @@ void do_shell(char *filename)
putsout(shell_line);
else {
ttyin(cmdbuf, sizeof(cmdbuf) - 2, '!');
- expanded = 0;
+ expanded = NULL;
rc = expand(&expanded, cmdbuf);
if (expanded) {
if (strlen(expanded) < sizeof(shell_line))
@@ -1634,7 +1634,7 @@ void execute(char *filename, char *cmd, ...)
signal(SIGQUIT, SIG_IGN);
if (catch_susp)
signal(SIGTSTP, SIG_DFL);
- while (wait(0) > 0) ;
+ while (wait(NULL) > 0) ;
signal(SIGINT, end_it);
signal(SIGQUIT, onquit);
if (catch_susp)
diff --git a/text-utils/rev.c b/text-utils/rev.c
index fe3884389..b4ae892f1 100644
--- a/text-utils/rev.c
+++ b/text-utils/rev.c
@@ -106,9 +106,9 @@ int main(int argc, char *argv[])
int ch, rval = EXIT_SUCCESS;
static const struct option longopts[] = {
- { "version", no_argument, 0, 'V' },
- { "help", no_argument, 0, 'h' },
- { NULL, 0, 0, 0 }
+ { "version", no_argument, NULL, 'V' },
+ { "help", no_argument, NULL, 'h' },
+ { NULL, 0, NULL, 0 }
};
setlocale(LC_ALL, "");
diff --git a/text-utils/tailf.c b/text-utils/tailf.c
index 9f175822c..78ead34f7 100644
--- a/text-utils/tailf.c
+++ b/text-utils/tailf.c
@@ -66,7 +66,7 @@ static void tailf(const char *filename, size_t lines, struct stat *st)
fd = open(filename, O_RDONLY);
if (fd < 0)
err(EXIT_FAILURE, _("cannot open %s"), filename);
- data = mmap(0, st->st_size, PROT_READ, MAP_SHARED, fd, 0);
+ data = mmap(NULL, st->st_size, PROT_READ, MAP_SHARED, fd, 0);
i = (size_t) st->st_size - 1;
/* humans do not think last new line in a file should be counted,
@@ -241,10 +241,10 @@ int main(int argc, char **argv)
struct stat st;
static const struct option longopts[] = {
- { "lines", required_argument, 0, 'n' },
- { "version", no_argument, 0, 'V' },
- { "help", no_argument, 0, 'h' },
- { NULL, 0, 0, 0 }
+ { "lines", required_argument, NULL, 'n' },
+ { "version", no_argument, NULL, 'V' },
+ { "help", no_argument, NULL, 'h' },
+ { NULL, 0, NULL, 0 }
};
setlocale(LC_ALL, "");
diff --git a/text-utils/ul.c b/text-utils/ul.c
index 5421c24a0..de6da8178 100644
--- a/text-utils/ul.c
+++ b/text-utils/ul.c
@@ -157,11 +157,11 @@ int main(int argc, char **argv)
FILE *f;
static const struct option longopts[] = {
- { "terminal", required_argument, 0, 't' },
- { "indicated", no_argument, 0, 'i' },
- { "version", no_argument, 0, 'V' },
- { "help", no_argument, 0, 'h' },
- { NULL, 0, 0, 0 }
+ { "terminal", required_argument, NULL, 't' },
+ { "indicated", no_argument, NULL, 'i' },
+ { "version", no_argument, NULL, 'V' },
+ { "help", no_argument, NULL, 'h' },
+ { NULL, 0, NULL, 0 }
};
setlocale(LC_ALL, "");