From 908f84c28da809408b977e5d5247ef7e60513e4d Mon Sep 17 00:00:00 2001 From: jsg Date: Sun, 20 Jul 2014 10:32:23 +0000 Subject: [PATCH] use NULL instead of 0 when dealing with pointers ok guenther@ --- usr.bin/telnet/genget.c | 10 +++++----- usr.bin/telnet/main.c | 6 +++--- usr.bin/telnet/ring.c | 10 +++++----- usr.bin/telnet/telnet.c | 22 +++++++++++----------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/usr.bin/telnet/genget.c b/usr.bin/telnet/genget.c index aaca4fb4d95..0752f5140e6 100644 --- a/usr.bin/telnet/genget.c +++ b/usr.bin/telnet/genget.c @@ -1,4 +1,4 @@ -/* $OpenBSD: genget.c,v 1.4 2014/07/20 06:39:41 guenther Exp $ */ +/* $OpenBSD: genget.c,v 1.5 2014/07/20 10:32:23 jsg Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -71,11 +71,11 @@ genget(char *name, char **table, int stlen) char **c, **found; int n; - if (name == 0) - return 0; + if (name == NULL) + return (NULL); - found = 0; - for (c = table; *c != 0; c = (char **)((char *)c + stlen)) { + found = NULL; + for (c = table; *c != NULL; c = (char **)((char *)c + stlen)) { if ((n = isprefix(name, *c)) == 0) continue; if (n < 0) /* exact match */ diff --git a/usr.bin/telnet/main.c b/usr.bin/telnet/main.c index bfeed1f0c7e..1c202d0ebce 100644 --- a/usr.bin/telnet/main.c +++ b/usr.bin/telnet/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.27 2014/07/20 10:18:10 guenther Exp $ */ +/* $OpenBSD: main.c,v 1.28 2014/07/20 10:32:23 jsg Exp $ */ /* $NetBSD: main.c,v 1.5 1996/02/28 21:04:05 thorpej Exp $ */ /* @@ -191,7 +191,7 @@ main(argc, argv) *argp++ = argv[0]; /* host */ if (argc > 1) *argp++ = argv[1]; /* port */ - *argp = 0; + *argp = NULL; if (setjmp(toplevel) != 0) Exit(0); @@ -202,7 +202,7 @@ main(argc, argv) } (void)setjmp(toplevel); for (;;) { - command(1, 0, 0); + command(1, NULL, 0); } return 0; } diff --git a/usr.bin/telnet/ring.c b/usr.bin/telnet/ring.c index 6c3d559ffd4..92efb304b90 100644 --- a/usr.bin/telnet/ring.c +++ b/usr.bin/telnet/ring.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ring.c,v 1.9 2014/07/20 09:59:42 guenther Exp $ */ +/* $OpenBSD: ring.c,v 1.10 2014/07/20 10:32:23 jsg Exp $ */ /* $NetBSD: ring.c,v 1.7 1996/02/28 21:04:07 thorpej Exp $ */ /* @@ -127,7 +127,7 @@ ring_at_mark(ring) ring_clear_mark(ring) Ring *ring; { - ring->mark = 0; + ring->mark = NULL; } /* @@ -155,7 +155,7 @@ ring_consumed(ring, count) if (ring->mark && (ring_subtract(ring, ring->mark, ring->consume) < count)) { - ring->mark = 0; + ring->mark = NULL; } ring->consume = ring_increment(ring, ring->consume, count); ring->consumetime = ++ring_clock; @@ -211,7 +211,7 @@ ring_empty_consecutive(ring) ring_full_count(ring) Ring *ring; { - if ((ring->mark == 0) || (ring->mark == ring->consume)) { + if ((ring->mark == NULL) || (ring->mark == ring->consume)) { if (ring_full(ring)) { return ring->size; /* nothing consumed, but full */ } else { @@ -230,7 +230,7 @@ ring_full_count(ring) ring_full_consecutive(ring) Ring *ring; { - if ((ring->mark == 0) || (ring->mark == ring->consume)) { + if ((ring->mark == NULL) || (ring->mark == ring->consume)) { if ((ring->supply < ring->consume) || ring_full(ring)) { return ring_subtract(ring, ring->top, ring->consume); } else { diff --git a/usr.bin/telnet/telnet.c b/usr.bin/telnet/telnet.c index e473b9993d9..e1cde5fc4a8 100644 --- a/usr.bin/telnet/telnet.c +++ b/usr.bin/telnet/telnet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: telnet.c,v 1.26 2014/07/20 10:18:10 guenther Exp $ */ +/* $OpenBSD: telnet.c,v 1.27 2014/07/20 10:32:23 jsg Exp $ */ /* $NetBSD: telnet.c,v 1.7 1996/02/28 21:04:15 thorpej Exp $ */ /* @@ -84,7 +84,7 @@ int globalmode, clienteof = 0; -char *prompt = 0; +char *prompt = NULL; int scheduler_lockout_tty = 0; @@ -457,7 +457,7 @@ dontoption(option) int is_unique(char *, char **, char **); static char *name_unknown = "UNKNOWN"; -static char *unknown[] = { 0, 0 }; +static char *unknown[] = { NULL, NULL }; char ** mklist(buf, name) @@ -468,7 +468,7 @@ mklist(buf, name) if (name) { if ((int)strlen(name) > 40) { - name = 0; + name = NULL; unknown[0] = name_unknown; } else { unknown[0] = name; @@ -487,13 +487,13 @@ mklist(buf, name) * Allocate an array to put the name pointers into */ argv = (char **)malloc((n+3)*sizeof(char *)); - if (argv == 0) + if (argv == NULL) return(unknown); /* * Fill up the array of pointers to names. */ - *argv = 0; + *argv = NULL; argvp = argv+1; n = 0; for (cp = cp2 = buf; (c = *cp); cp++) { @@ -554,9 +554,9 @@ mklist(buf, name) */ cp = *(argvp-1); *argvp++ = cp; - *argvp = 0; + *argvp = NULL; - if (*argv == 0) { + if (*argv == NULL) { if (name) *argv = name; else { @@ -591,7 +591,7 @@ int resettermname = 1; gettermname() { char *tname; - static char **tnamep = 0; + static char **tnamep = NULL; static char **next; int errret; @@ -612,7 +612,7 @@ gettermname() } next = tnamep; } - if (*next == 0) + if (*next == NULL) next = tnamep; return(*next++); } @@ -928,7 +928,7 @@ slc_init() localchars = 1; for (spcp = spc_data; spcp < &spc_data[NSLC+1]; spcp++) { spcp->val = 0; - spcp->valp = 0; + spcp->valp = NULL; spcp->flags = spcp->mylevel = SLC_NOSUPPORT; } -- 2.20.1