summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2007-03-20 03:50:38 +0000
committertedu <tedu@openbsd.org>2007-03-20 03:50:38 +0000
commitb65df6796731fdd0e5addf4c6c1724de929a780c (patch)
tree328b6fca24b09a70459a577480af41662a5f5c52
parentremove some bogus *p, from charles longeau (diff)
downloadwireguard-openbsd-b65df6796731fdd0e5addf4c6c1724de929a780c.tar.xz
wireguard-openbsd-b65df6796731fdd0e5addf4c6c1724de929a780c.zip
remove some bogus *p tests from charles longeau
ok deraadt millert
-rw-r--r--usr.bin/chpass/edit.c6
-rw-r--r--usr.bin/column/column.c6
-rw-r--r--usr.bin/encrypt/encrypt.c4
-rw-r--r--usr.bin/fmt/fmt.c6
-rw-r--r--usr.bin/hexdump/parse.c6
-rw-r--r--usr.bin/less/tags.c6
-rw-r--r--usr.bin/make/arch.c6
-rw-r--r--usr.bin/make/cond.c4
-rw-r--r--usr.bin/make/for.c8
-rw-r--r--usr.bin/make/parse.c16
-rw-r--r--usr.bin/man/config.c8
-rw-r--r--usr.bin/newsyslog/newsyslog.c8
-rw-r--r--usr.bin/passwd/new_pwd.c4
-rw-r--r--usr.bin/sed/compile.c6
14 files changed, 48 insertions, 46 deletions
diff --git a/usr.bin/chpass/edit.c b/usr.bin/chpass/edit.c
index 1c453e25e34..a013cd79f83 100644
--- a/usr.bin/chpass/edit.c
+++ b/usr.bin/chpass/edit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: edit.c,v 1.29 2006/03/30 21:08:21 robert Exp $ */
+/* $OpenBSD: edit.c,v 1.30 2007/03/20 03:50:38 tedu Exp $ */
/* $NetBSD: edit.c,v 1.6 1996/05/15 21:50:45 jtc Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)edit.c 8.3 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: edit.c,v 1.29 2006/03/30 21:08:21 robert Exp $";
+static char rcsid[] = "$OpenBSD: edit.c,v 1.30 2007/03/20 03:50:38 tedu Exp $";
#endif
#endif /* not lint */
@@ -182,7 +182,7 @@ verify(char *tempname, struct passwd *pw)
goto bad;
}
while (isspace(*++p));
- for (q = p; *q && isprint(*q); q++) {
+ for (q = p; isprint(*q); q++) {
if (ep->except && strchr(ep->except,*q))
break;
}
diff --git a/usr.bin/column/column.c b/usr.bin/column/column.c
index c24cd6de8c6..5a3b17ff7d4 100644
--- a/usr.bin/column/column.c
+++ b/usr.bin/column/column.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: column.c,v 1.11 2006/03/10 19:14:58 otto Exp $ */
+/* $OpenBSD: column.c,v 1.12 2007/03/20 03:50:39 tedu Exp $ */
/* $NetBSD: column.c,v 1.4 1995/09/02 05:53:03 jtc Exp $ */
/*
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)column.c 8.4 (Berkeley) 5/4/95";
#endif
-static char rcsid[] = "$OpenBSD: column.c,v 1.11 2006/03/10 19:14:58 otto Exp $";
+static char rcsid[] = "$OpenBSD: column.c,v 1.12 2007/03/20 03:50:39 tedu Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -264,7 +264,7 @@ input(FILE *fp)
if (!list)
list = emalloc((maxentry = DEFNUM) * sizeof(char *));
while (fgets(buf, MAXLINELEN, fp)) {
- for (p = buf; *p && isspace(*p); ++p);
+ for (p = buf; isspace(*p); ++p);
if (!*p)
continue;
if (!(p = strchr(p, '\n'))) {
diff --git a/usr.bin/encrypt/encrypt.c b/usr.bin/encrypt/encrypt.c
index d66b8bfd451..0468f2d4034 100644
--- a/usr.bin/encrypt/encrypt.c
+++ b/usr.bin/encrypt/encrypt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: encrypt.c,v 1.25 2007/03/06 11:16:55 jmc Exp $ */
+/* $OpenBSD: encrypt.c,v 1.26 2007/03/20 03:50:39 tedu Exp $ */
/*
* Copyright (c) 1996, Jason Downs. All rights reserved.
@@ -77,7 +77,7 @@ trim(char *line)
}
ptr[1] = '\0';
- for (ptr = line; *ptr && isspace(*ptr); ptr++)
+ for (ptr = line; isspace(*ptr); ptr++)
;
return(ptr);
diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c
index b496cff313b..42b3574ce52 100644
--- a/usr.bin/fmt/fmt.c
+++ b/usr.bin/fmt/fmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fmt.c,v 1.25 2006/11/29 21:59:04 jmc Exp $ */
+/* $OpenBSD: fmt.c,v 1.26 2007/03/20 03:50:39 tedu Exp $ */
/* Sensible version of fmt
*
@@ -170,7 +170,7 @@
#ifndef lint
static const char rcsid[] =
- "$OpenBSD: fmt.c,v 1.25 2006/11/29 21:59:04 jmc Exp $";
+ "$OpenBSD: fmt.c,v 1.26 2007/03/20 03:50:39 tedu Exp $";
static const char copyright[] =
"Copyright (c) 1997 Gareth McCaughan. All rights reserved.\n";
#endif /* not lint */
@@ -497,7 +497,7 @@ might_be_header(const unsigned char *line)
if (!isupper(*line++))
return 0;
- while (*line && (isalnum(*line) || *line == '-'))
+ while (isalnum(*line) || *line == '-')
++line;
return (*line == ':' && isspace(line[1]));
}
diff --git a/usr.bin/hexdump/parse.c b/usr.bin/hexdump/parse.c
index 20b65b52908..e64c78cd56f 100644
--- a/usr.bin/hexdump/parse.c
+++ b/usr.bin/hexdump/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.15 2006/08/23 03:13:09 ray Exp $ */
+/* $OpenBSD: parse.c,v 1.16 2007/03/20 03:50:39 tedu Exp $ */
/* $NetBSD: parse.c,v 1.12 2001/12/07 13:37:39 bjh21 Exp $ */
/*
@@ -32,7 +32,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)parse.c 5.6 (Berkeley) 3/9/91";*/
-static char rcsid[] = "$OpenBSD: parse.c,v 1.15 2006/08/23 03:13:09 ray Exp $";
+static char rcsid[] = "$OpenBSD: parse.c,v 1.16 2007/03/20 03:50:39 tedu Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -72,7 +72,7 @@ addfile(char *name)
lbuf[len] = '\0';
buf = lbuf;
}
- for (p = buf; *p && isspace((unsigned char)*p); ++p);
+ for (p = buf; isspace((unsigned char)*p); ++p);
if (!*p || *p == '#')
continue;
add(p);
diff --git a/usr.bin/less/tags.c b/usr.bin/less/tags.c
index 2aebe160708..e4387ae63fa 100644
--- a/usr.bin/less/tags.c
+++ b/usr.bin/less/tags.c
@@ -715,7 +715,7 @@ getentry(buf, tag, file, line)
if (*p == 0)
return (-1);
*p++ = 0;
- for ( ; *p && isspace(*p); p++) /* (skip blanks) */
+ for ( ; isspace(*p); p++) /* (skip blanks) */
;
if (*p == 0)
return (-1);
@@ -727,7 +727,7 @@ getentry(buf, tag, file, line)
{
for ( ; *p && !isspace(*p); p++) /* (skip tag type) */
;
- for (; *p && isspace(*p); p++) /* (skip blanks) */
+ for (; isspace(*p); p++) /* (skip blanks) */
;
}
if (!isdigit(*p))
@@ -738,7 +738,7 @@ getentry(buf, tag, file, line)
if (*p == 0)
return (-1);
*p++ = 0;
- for ( ; *p && isspace(*p); p++) /* (skip blanks) */
+ for ( ; isspace(*p); p++) /* (skip blanks) */
;
if (*p == 0)
return (-1);
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c
index 01bd80600d4..1975d1a4583 100644
--- a/usr.bin/make/arch.c
+++ b/usr.bin/make/arch.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: arch.c,v 1.55 2006/01/20 23:10:19 espie Exp $ */
+/* $OpenBSD: arch.c,v 1.56 2007/03/20 03:50:39 tedu Exp $ */
/* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */
/*
@@ -261,7 +261,7 @@ Arch_ParseArchive(char **linePtr, /* Pointer to start of specification */
* a close paren). */
bool doSubst = false; /* true if need to substitute in memberName */
- while (*cp != '\0' && *cp != ')' && isspace(*cp))
+ while (isspace(*cp))
cp++;
memberName = cp;
while (*cp != '\0' && *cp != ')' && !isspace(*cp)) {
@@ -383,7 +383,7 @@ Arch_ParseArchive(char **linePtr, /* Pointer to start of specification */
* entrance to the loop, cp is guaranteed to point at a ')') */
do {
cp++;
- } while (*cp != '\0' && isspace(*cp));
+ } while (isspace(*cp));
*linePtr = cp;
return true;
diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c
index 9eafb5c5d87..3b85ca213f5 100644
--- a/usr.bin/make/cond.c
+++ b/usr.bin/make/cond.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: cond.c,v 1.32 2007/01/04 18:01:32 espie Exp $ */
+/* $OpenBSD: cond.c,v 1.33 2007/03/20 03:50:39 tedu Exp $ */
/* $NetBSD: cond.c,v 1.7 1996/11/06 17:59:02 christos Exp $ */
/*
@@ -644,7 +644,7 @@ CondHandleDefault(bool doEval)
/* A variable is empty when it just contains
* spaces... 4/15/92, christos */
char *p;
- for (p = val; *p && isspace(*p); p++)
+ for (p = val; isspace(*p); p++)
continue;
t = *p == '\0' ? True : False;
}
diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c
index 1447079c78c..0565d01fae0 100644
--- a/usr.bin/make/for.c
+++ b/usr.bin/make/for.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: for.c,v 1.30 2004/04/07 13:11:36 espie Exp $ */
+/* $OpenBSD: for.c,v 1.31 2007/03/20 03:50:39 tedu Exp $ */
/* $NetBSD: for.c,v 1.4 1996/11/06 17:59:05 christos Exp $ */
/*
@@ -139,7 +139,7 @@ For_Eval(const char *line)
For *arg;
unsigned long n;
- while (*ptr && isspace(*ptr))
+ while (isspace(*ptr))
ptr++;
/* Parse loop. */
@@ -157,7 +157,7 @@ For_Eval(const char *line)
return 0;
}
endVar = ptr++;
- while (*ptr && isspace(*ptr))
+ while (isspace(*ptr))
ptr++;
/* End of variable list ? */
if (endVar - wrd == 2 && wrd[0] == 'i' && wrd[1] == 'n')
@@ -204,7 +204,7 @@ For_Accumulate(For *arg, const char *line)
if (*ptr == '.') {
- for (ptr++; *ptr && isspace(*ptr); ptr++)
+ for (ptr++; isspace(*ptr); ptr++)
continue;
if (strncmp(ptr, "endfor", 6) == 0 &&
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index 5d6aacb9dd2..8f2a5bfdaa2 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: parse.c,v 1.70 2007/01/18 17:49:51 espie Exp $ */
+/* $OpenBSD: parse.c,v 1.71 2007/03/20 03:50:39 tedu Exp $ */
/* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */
/*
@@ -838,7 +838,7 @@ ParseDoDependency(char *line) /* the line to parse */
Parse_Error(PARSE_WARNING, "Extra target ignored");
}
} else {
- while (*cp && isspace(*cp)) {
+ while (isspace(*cp)) {
cp++;
}
}
@@ -885,7 +885,7 @@ ParseDoDependency(char *line) /* the line to parse */
/*
* Get to the first source
*/
- while (*cp && isspace(*cp)) {
+ while (isspace(*cp)) {
cp++;
}
line = cp;
@@ -997,7 +997,7 @@ ParseDoDependency(char *line) /* the line to parse */
if (savec != '\0') {
cp++;
}
- while (*cp && isspace(*cp)) {
+ while (isspace(*cp)) {
cp++;
}
line = cp;
@@ -1047,7 +1047,7 @@ ParseDoDependency(char *line) /* the line to parse */
ParseDoSrc(tOp, line);
}
- while (*cp && isspace(*cp)) {
+ while (isspace(*cp)) {
cp++;
}
line = cp;
@@ -1378,7 +1378,7 @@ ParseIsCond(Buffer linebuf, Buffer copy, char *line)
char *stripped;
- while (*line != '\0' && isspace(*line))
+ while (isspace(*line))
line++;
/* The line might be a conditional. Ask the conditional module
@@ -1389,7 +1389,7 @@ ParseIsCond(Buffer linebuf, Buffer copy, char *line)
do {
line = Parse_ReadNextConditionalLine(linebuf);
if (line != NULL) {
- while (*line != '\0' && isspace(*line))
+ while (isspace(*line))
line++;
stripped = strip_comments(copy, line);
}
@@ -1425,7 +1425,7 @@ ParseIsCond(Buffer linebuf, Buffer copy, char *line)
char *cp;
line+=5;
- while (*line != '\0' && isspace(*line))
+ while (isspace(*line))
line++;
for (cp = line; !isspace(*cp) && *cp != '\0';)
cp++;
diff --git a/usr.bin/man/config.c b/usr.bin/man/config.c
index 63a174f3279..00846df6c12 100644
--- a/usr.bin/man/config.c
+++ b/usr.bin/man/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.7 2005/10/17 19:08:46 otto Exp $ */
+/* $OpenBSD: config.c,v 1.8 2007/03/20 03:50:39 tedu Exp $ */
/* $NetBSD: config.c,v 1.7 1995/09/28 06:05:21 tls Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)config.c 8.8 (Berkeley) 1/31/95";
#else
-static char rcsid[] = "$OpenBSD: config.c,v 1.7 2005/10/17 19:08:46 otto Exp $";
+static char rcsid[] = "$OpenBSD: config.c,v 1.8 2007/03/20 03:50:39 tedu Exp $";
#endif
#endif /* not lint */
@@ -88,7 +88,7 @@ config(char *fname)
p[len - 1] = '\0'; /* Terminate the line. */
/* Skip leading space. */
- while (*p != '\0' && isspace(*p))
+ while (isspace(*p))
p++;
/* Skip empty/comment lines. */
if (*p == '\0' || *p == '#')
@@ -114,7 +114,7 @@ config(char *fname)
* has only a single token on it.
*/
if (!strcmp(p, "_build")) {
- while (*++t && isspace(*t));
+ while (isspace(*++t));
if ((ep = malloc(sizeof(ENTRY))) == NULL ||
(ep->s = strdup(t)) == NULL)
err(1, NULL);
diff --git a/usr.bin/newsyslog/newsyslog.c b/usr.bin/newsyslog/newsyslog.c
index 7980241749f..64f3f848595 100644
--- a/usr.bin/newsyslog/newsyslog.c
+++ b/usr.bin/newsyslog/newsyslog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newsyslog.c,v 1.83 2006/12/11 20:50:54 deraadt Exp $ */
+/* $OpenBSD: newsyslog.c,v 1.84 2007/03/20 03:50:39 tedu Exp $ */
/*
* Copyright (c) 1999, 2002, 2003 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -72,7 +72,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: newsyslog.c,v 1.83 2006/12/11 20:50:54 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: newsyslog.c,v 1.84 2007/03/20 03:50:39 tedu Exp $";
#endif /* not lint */
#ifndef CONF
@@ -938,7 +938,9 @@ age_old_log(struct conf_entry *ent)
char *
sob(char *p)
{
- while (p && *p && isspace(*p))
+ if (p == NULL)
+ return(p);
+ while (isspace(*p))
p++;
return (p);
}
diff --git a/usr.bin/passwd/new_pwd.c b/usr.bin/passwd/new_pwd.c
index 340dca8a720..add28d3b785 100644
--- a/usr.bin/passwd/new_pwd.c
+++ b/usr.bin/passwd/new_pwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: new_pwd.c,v 1.6 2005/05/01 02:56:28 deraadt Exp $ */
+/* $OpenBSD: new_pwd.c,v 1.7 2007/03/20 03:50:39 tedu Exp $ */
/* $KTH: new_pwd.c,v 1.11 1997/05/02 14:28:54 assar Exp $ */
/*
@@ -73,7 +73,7 @@ check_pw(char *pword)
return "That password collides with a system feature. Choose another.\n";
/* Don't allow all lower case passwords regardless of length */
- for (t = pword; *t && islower(*t); t++)
+ for (t = pword; islower(*t); t++)
;
if (*t == 0)
return "Please don't use an all-lower case password.\n"
diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c
index 89172c0707f..a3940542432 100644
--- a/usr.bin/sed/compile.c
+++ b/usr.bin/sed/compile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: compile.c,v 1.23 2007/01/09 08:37:44 otto Exp $ */
+/* $OpenBSD: compile.c,v 1.24 2007/03/20 03:50:39 tedu Exp $ */
/*-
* Copyright (c) 1992 Diomidis Spinellis.
@@ -35,7 +35,7 @@
#ifndef lint
/* from: static char sccsid[] = "@(#)compile.c 8.2 (Berkeley) 4/28/95"; */
-static const char rcsid[] = "$OpenBSD: compile.c,v 1.23 2007/01/09 08:37:44 otto Exp $";
+static const char rcsid[] = "$OpenBSD: compile.c,v 1.24 2007/03/20 03:50:39 tedu Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -139,7 +139,7 @@ compile(void)
#define EATSPACE() do { \
if (p) \
- while (*p && isascii(*p) && isspace(*p)) \
+ while (isascii(*p) && isspace(*p)) \
p++; \
} while (0)