diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2011-04-06 11:36:27 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2011-04-06 11:36:27 +0000 |
commit | e2ddf551fe54f5fd63dbb0131d6835d07f172753 (patch) | |
tree | ee263115c37260360e628dc4fc5e029d18e30311 /usr.bin | |
parent | ecdee9dbaa69f9aa6f959777e5e515c31bb6a0f8 (diff) |
Avoid using NULL in non-pointer contexts: use 0 for integer values and '\0'
for chars.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cdio/cddb.c | 4 | ||||
-rw-r--r-- | usr.bin/ipcs/ipcs.c | 20 | ||||
-rw-r--r-- | usr.bin/kdump/kdump.c | 4 | ||||
-rw-r--r-- | usr.bin/mail/cmd1.c | 4 | ||||
-rw-r--r-- | usr.bin/mail/cmd2.c | 22 | ||||
-rw-r--r-- | usr.bin/mail/cmd3.c | 10 | ||||
-rw-r--r-- | usr.bin/mail/collect.c | 4 | ||||
-rw-r--r-- | usr.bin/mail/lex.c | 6 | ||||
-rw-r--r-- | usr.bin/netstat/route.c | 6 | ||||
-rw-r--r-- | usr.bin/oldrdist/expand.c | 4 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_hout.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-display-message.c | 4 | ||||
-rw-r--r-- | usr.bin/xstr/xstr.c | 4 |
13 files changed, 48 insertions, 48 deletions
diff --git a/usr.bin/cdio/cddb.c b/usr.bin/cdio/cddb.c index 4882f086d9d..848ddfa8450 100644 --- a/usr.bin/cdio/cddb.c +++ b/usr.bin/cdio/cddb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cddb.c,v 1.15 2008/04/27 23:06:40 fgsch Exp $ */ +/* $OpenBSD: cddb.c,v 1.16 2011/04/06 11:36:26 miod Exp $ */ /* * Copyright (c) 2002 Marc Espie. * @@ -295,7 +295,7 @@ cddb(const char *host_port, int n, struct cd_toc_entry *e, char *arg) } if (strcmp(line, "211") == 0 || strcmp(line, "212") == 0) { int number = strtonum(arg, 0, INT_MAX, &errstr); - if (errstr != NULL && *arg != NULL) { + if (errstr != NULL && *arg != '\0') { warnx("cddb: invalid index"); goto end; } diff --git a/usr.bin/ipcs/ipcs.c b/usr.bin/ipcs/ipcs.c index 22044023160..0e08268550e 100644 --- a/usr.bin/ipcs/ipcs.c +++ b/usr.bin/ipcs/ipcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipcs.c,v 1.23 2008/06/26 05:42:21 ray Exp $ */ +/* $OpenBSD: ipcs.c,v 1.24 2011/04/06 11:36:26 miod Exp $ */ /* $NetBSD: ipcs.c,v 1.25 2000/06/16 03:58:20 simonb Exp $ */ /*- @@ -448,7 +448,7 @@ msg_sysctl(void) mib[0] = CTL_KERN; mib[1] = KERN_SYSVMSG; len = sizeof(valid); - if (sysctl(mib, 2, &valid, &len, NULL, NULL) < 0) { + if (sysctl(mib, 2, &valid, &len, NULL, 0) < 0) { warn("sysctl(KERN_SYSVMSG)"); return; } @@ -465,7 +465,7 @@ msg_sysctl(void) /* totals only */ len = sizeof(struct msginfo); } else { - if (sysctl(mib, 3, NULL, &len, NULL, NULL) < 0) { + if (sysctl(mib, 3, NULL, &len, NULL, 0) < 0) { warn("sysctl(KERN_SYSVIPC_MSG_INFO)"); return; } @@ -474,7 +474,7 @@ msg_sysctl(void) if ((buf = malloc(len)) == NULL) err(1, "malloc"); msgsi = (struct msg_sysctl_info *)buf; - if (sysctl(mib, 3, msgsi, &len, NULL, NULL) < 0) { + if (sysctl(mib, 3, msgsi, &len, NULL, 0) < 0) { warn("sysctl(KERN_SYSVIPC_MSG_INFO)"); return; } @@ -519,7 +519,7 @@ shm_sysctl(void) mib[0] = CTL_KERN; mib[1] = KERN_SYSVSHM; len = sizeof(valid); - if (sysctl(mib, 2, &valid, &len, NULL, NULL) < 0) { + if (sysctl(mib, 2, &valid, &len, NULL, 0) < 0) { warn("sysctl(KERN_SYSVSHM)"); return; } @@ -537,7 +537,7 @@ shm_sysctl(void) /* totals only */ len = sizeof(struct shminfo); } else { - if (sysctl(mib, 3, NULL, &len, NULL, NULL) < 0) { + if (sysctl(mib, 3, NULL, &len, NULL, 0) < 0) { warn("sysctl(KERN_SYSVIPC_SHM_INFO)"); return; } @@ -546,7 +546,7 @@ shm_sysctl(void) if ((buf = malloc(len)) == NULL) err(1, "malloc"); shmsi = (struct shm_sysctl_info *)buf; - if (sysctl(mib, 3, shmsi, &len, NULL, NULL) < 0) { + if (sysctl(mib, 3, shmsi, &len, NULL, 0) < 0) { warn("sysctl(KERN_SYSVIPC_SHM_INFO)"); return; } @@ -590,7 +590,7 @@ sem_sysctl(void) mib[0] = CTL_KERN; mib[1] = KERN_SYSVSEM; len = sizeof(valid); - if (sysctl(mib, 2, &valid, &len, NULL, NULL) < 0) { + if (sysctl(mib, 2, &valid, &len, NULL, 0) < 0) { warn("sysctl(KERN_SYSVSEM)"); return; } @@ -608,7 +608,7 @@ sem_sysctl(void) /* totals only */ len = sizeof(struct seminfo); } else { - if (sysctl(mib, 3, NULL, &len, NULL, NULL) < 0) { + if (sysctl(mib, 3, NULL, &len, NULL, 0) < 0) { warn("sysctl(KERN_SYSVIPC_SEM_INFO)"); return; } @@ -617,7 +617,7 @@ sem_sysctl(void) if ((buf = malloc(len)) == NULL) err(1, "malloc"); semsi = (struct sem_sysctl_info *)buf; - if (sysctl(mib, 3, semsi, &len, NULL, NULL) < 0) { + if (sysctl(mib, 3, semsi, &len, NULL, 0) < 0) { warn("sysctl(KERN_SYSVIPC_SEM_INFO)"); return; } diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 5cc7f27ab55..cae3ea7830d 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kdump.c,v 1.48 2011/04/05 15:24:32 guenther Exp $ */ +/* $OpenBSD: kdump.c,v 1.49 2011/04/06 11:36:26 miod Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -96,7 +96,7 @@ static struct emulation emulations[] = { { "native", syscallnames, SYS_MAXSYSCALL }, { "linux", linux_syscallnames, LINUX_SYS_MAXSYSCALL }, { "svr4", svr4_syscallnames, SVR4_SYS_MAXSYSCALL }, - { NULL, NULL, NULL } + { NULL, NULL, 0 } }; struct emulation *current; diff --git a/usr.bin/mail/cmd1.c b/usr.bin/mail/cmd1.c index c9a411330b1..bcc29f63fc8 100644 --- a/usr.bin/mail/cmd1.c +++ b/usr.bin/mail/cmd1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd1.c,v 1.28 2009/10/27 23:59:40 deraadt Exp $ */ +/* $OpenBSD: cmd1.c,v 1.29 2011/04/06 11:36:26 miod Exp $ */ /* $NetBSD: cmd1.c,v 1.9 1997/07/09 05:29:48 mikel Exp $ */ /*- @@ -166,7 +166,7 @@ from(void *v) int *msgvec = v; int *ip; - for (ip = msgvec; *ip != NULL; ip++) + for (ip = msgvec; *ip != 0; ip++) printhead(*ip); if (--ip >= msgvec) dot = &message[*ip - 1]; diff --git a/usr.bin/mail/cmd2.c b/usr.bin/mail/cmd2.c index eb2c921440a..40944212eef 100644 --- a/usr.bin/mail/cmd2.c +++ b/usr.bin/mail/cmd2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd2.c,v 1.17 2009/10/27 23:59:40 deraadt Exp $ */ +/* $OpenBSD: cmd2.c,v 1.18 2011/04/06 11:36:26 miod Exp $ */ /* $NetBSD: cmd2.c,v 1.7 1997/05/17 19:55:10 pk Exp $ */ /* @@ -53,7 +53,7 @@ next(void *v) int *msgvec = v; int *ip, *ip2, list[2], mdot; - if (*msgvec != NULL) { + if (*msgvec != 0) { /* * If some messages were supplied, find the * first applicable one following dot using @@ -65,7 +65,7 @@ next(void *v) * Find the first message in the supplied * message list which follows dot. */ - for (ip = msgvec; *ip != NULL; ip++) + for (ip = msgvec; *ip != 0; ip++) if (*ip > mdot) break; if (*ip == 0) @@ -77,7 +77,7 @@ next(void *v) dot = mp; goto hitit; } - if (*ip2 != NULL) + if (*ip2 != 0) ip2++; if (*ip2 == 0) ip2 = msgvec; @@ -110,7 +110,7 @@ hitit: * Print dot. */ list[0] = dot - &message[0] + 1; - list[1] = NULL; + list[1] = 0; return(type(list)); } @@ -158,7 +158,7 @@ save1(char *str, int mark, char *cmd, struct ignoretab *ignore) printf("No messages to %s.\n", cmd); return(1); } - msgvec[1] = NULL; + msgvec[1] = 0; } if (f && getmsglist(str, msgvec, 0) < 0) return(1); @@ -271,7 +271,7 @@ deltype(void *v) list[0] = dot - &message[0] + 1; if (list[0] > lastdot) { touch(dot); - list[1] = NULL; + list[1] = 0; return(type(list)); } puts("At EOF"); @@ -291,18 +291,18 @@ delm(int *msgvec) struct message *mp; int *ip, last; - last = NULL; - for (ip = msgvec; *ip != NULL; ip++) { + last = 0; + for (ip = msgvec; *ip != 0; ip++) { mp = &message[*ip - 1]; touch(mp); mp->m_flag |= MDELETED|MTOUCH; mp->m_flag &= ~(MPRESERVE|MSAVED|MBOX); last = *ip; } - if (last != NULL) { + if (last != 0) { dot = &message[last-1]; last = first(0, MDELETED); - if (last != NULL) { + if (last != 0) { dot = &message[last-1]; return(0); } diff --git a/usr.bin/mail/cmd3.c b/usr.bin/mail/cmd3.c index bce23b10939..905144b839d 100644 --- a/usr.bin/mail/cmd3.c +++ b/usr.bin/mail/cmd3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd3.c,v 1.24 2009/10/27 23:59:40 deraadt Exp $ */ +/* $OpenBSD: cmd3.c,v 1.25 2011/04/06 11:36:26 miod Exp $ */ /* $NetBSD: cmd3.c,v 1.8 1997/07/09 05:29:49 mikel Exp $ */ /* @@ -276,7 +276,7 @@ marknew(void *v) int *msgvec = v; int *ip; - for (ip = msgvec; *ip != NULL; ip++) { + for (ip = msgvec; *ip != 0; ip++) { dot = &message[*ip-1]; dot->m_flag &= ~(MBOX|MREAD|MTOUCH); dot->m_flag |= MNEW|MSTATUS; @@ -299,7 +299,7 @@ preserve(void *v) puts("Cannot \"preserve\" in edit mode"); return(1); } - for (ip = msgvec; *ip != NULL; ip++) { + for (ip = msgvec; *ip != 0; ip++) { mesg = *ip; mp = &message[mesg-1]; mp->m_flag |= MPRESERVE; @@ -318,7 +318,7 @@ unread(void *v) int *msgvec = v; int *ip; - for (ip = msgvec; *ip != NULL; ip++) { + for (ip = msgvec; *ip != 0; ip++) { dot = &message[*ip-1]; dot->m_flag &= ~(MREAD|MTOUCH); dot->m_flag |= MSTATUS; @@ -336,7 +336,7 @@ messize(void *v) struct message *mp; int *ip, mesg; - for (ip = msgvec; *ip != NULL; ip++) { + for (ip = msgvec; *ip != 0; ip++) { mesg = *ip; mp = &message[mesg-1]; printf("%d: %d/%d\n", mesg, mp->m_lines, mp->m_size); diff --git a/usr.bin/mail/collect.c b/usr.bin/mail/collect.c index 63672bce745..204dc3606da 100644 --- a/usr.bin/mail/collect.c +++ b/usr.bin/mail/collect.c @@ -1,4 +1,4 @@ -/* $OpenBSD: collect.c,v 1.32 2009/10/27 23:59:40 deraadt Exp $ */ +/* $OpenBSD: collect.c,v 1.33 2011/04/06 11:36:26 miod Exp $ */ /* $NetBSD: collect.c,v 1.9 1997/07/09 05:25:45 mikel Exp $ */ /* @@ -523,7 +523,7 @@ forward(char *ms, FILE *fp, char *fn, int f) puts("No appropriate messages"); return(0); } - msgvec[1] = NULL; + msgvec[1] = 0; } if (tolower(f) == 'f') tabst = NULL; diff --git a/usr.bin/mail/lex.c b/usr.bin/mail/lex.c index 712d79df5b5..7690ce78330 100644 --- a/usr.bin/mail/lex.c +++ b/usr.bin/mail/lex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lex.c,v 1.33 2009/10/27 23:59:40 deraadt Exp $ */ +/* $OpenBSD: lex.c,v 1.34 2011/04/06 11:36:26 miod Exp $ */ /* $NetBSD: lex.c,v 1.10 1997/05/17 19:55:13 pk Exp $ */ /* @@ -397,7 +397,7 @@ execute(char *linebuf, int contxt) if (c == 0) { *msgvec = first(com->c_msgflag, com->c_msgmask); - msgvec[1] = NULL; + msgvec[1] = 0; } if (*msgvec == 0) { puts("No applicable messages"); @@ -427,7 +427,7 @@ execute(char *linebuf, int contxt) if (c == 0) { *msgvec = first(com->c_msgflag, com->c_msgmask); - msgvec[1] = NULL; + msgvec[1] = 0; } if (*msgvec == 0) { puts("No applicable messages"); diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 81eecc8eed6..4be3aa93dc4 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.87 2009/08/04 03:45:47 tedu Exp $ */ +/* $OpenBSD: route.c,v 1.88 2011/04/06 11:36:26 miod Exp $ */ /* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */ /* @@ -102,7 +102,7 @@ routepr(u_long rtree, u_long mtree, u_long af2idx, u_long rtbl_id_max, printf("Routing tables\n"); - if (rtree == NULL || af2idx == NULL) { + if (rtree == 0 || af2idx == 0) { printf("rt_tables: symbol not in namelist\n"); return; } @@ -138,7 +138,7 @@ routepr(u_long rtree, u_long mtree, u_long af2idx, u_long rtbl_id_max, } continue; } - if (af2rtafidx[i] == NULL) + if (af2rtafidx[i] == 0) /* no table for this AF */ continue; if ((rnh = rt_tables[af2rtafidx[i]]) == NULL) diff --git a/usr.bin/oldrdist/expand.c b/usr.bin/oldrdist/expand.c index 7b0cf800d65..e07ecd0e036 100644 --- a/usr.bin/oldrdist/expand.c +++ b/usr.bin/oldrdist/expand.c @@ -1,4 +1,4 @@ -/* $OpenBSD: expand.c,v 1.12 2009/10/27 23:59:41 deraadt Exp $ */ +/* $OpenBSD: expand.c,v 1.13 2011/04/06 11:36:26 miod Exp $ */ /* * Copyright (c) 1983, 1993 @@ -169,7 +169,7 @@ expstr(s) savec = *tail; *tail = '\0'; } - tp = lookup(cp, NULL, 0); + tp = lookup(cp, LOOKUP, 0); if (savec != '\0') *tail = savec; if (tp != NULL) { diff --git a/usr.bin/rpcgen/rpc_hout.c b/usr.bin/rpcgen/rpc_hout.c index db67323e3c6..2a2c0b5e674 100644 --- a/usr.bin/rpcgen/rpc_hout.c +++ b/usr.bin/rpcgen/rpc_hout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_hout.c,v 1.19 2010/09/01 14:43:34 millert Exp $ */ +/* $OpenBSD: rpc_hout.c,v 1.20 2011/04/06 11:36:26 miod Exp $ */ /* $NetBSD: rpc_hout.c,v 1.4 1995/06/11 21:49:55 pk Exp $ */ /* @@ -163,7 +163,7 @@ pargdef(def) } fprintf(fout, "};\n"); fprintf(fout, "typedef struct %s %s;\n", name, name); - pxdrfuncdecl(name, NULL); + pxdrfuncdecl(name, 0); fprintf(fout, "\n"); } } diff --git a/usr.bin/tmux/cmd-display-message.c b/usr.bin/tmux/cmd-display-message.c index 2576dfe6055..03de7d1e0cf 100644 --- a/usr.bin/tmux/cmd-display-message.c +++ b/usr.bin/tmux/cmd-display-message.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-display-message.c,v 1.9 2011/03/29 19:30:16 nicm Exp $ */ +/* $OpenBSD: cmd-display-message.c,v 1.10 2011/04/06 11:36:26 miod Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -52,7 +52,7 @@ cmd_display_message_exec(struct cmd *self, struct cmd_ctx *ctx) if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL) return (-1); - if (args_has(args, 't') != NULL) { + if (args_has(args, 't') != 0) { wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp); if (wl == NULL) return (-1); diff --git a/usr.bin/xstr/xstr.c b/usr.bin/xstr/xstr.c index 758f633055e..a04250fb09d 100644 --- a/usr.bin/xstr/xstr.c +++ b/usr.bin/xstr/xstr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xstr.c,v 1.16 2009/10/27 23:59:50 deraadt Exp $ */ +/* $OpenBSD: xstr.c,v 1.17 2011/04/06 11:36:26 miod Exp $ */ /* $NetBSD: xstr.c,v 1.5 1994/12/24 16:57:59 cgd Exp $ */ /* @@ -311,7 +311,7 @@ fgetNUL(char *obuf, int rmdr, FILE *file) while (--rmdr > 0 && (c = xgetc(file)) != 0 && c != EOF) *buf++ = c; *buf++ = 0; - return ((feof(file) || ferror(file)) ? NULL : 1); + return ((feof(file) || ferror(file)) ? 0 : 1); } int |