summaryrefslogtreecommitdiff
path: root/usr.bin/vgrind
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-05-05 08:17:40 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-05-05 08:17:40 +0000
commit1dd178d10d52af72110eff9f43e12997aa7310e8 (patch)
tree60fd3a3de06dc3e54ea6ba395515a3e1601538cb /usr.bin/vgrind
parent179646cc91aa531a871b4fe331cc6abfc64b7d44 (diff)
downloadsrc-test-1dd178d10d52af72110eff9f43e12997aa7310e8.tar.gz
src-test-1dd178d10d52af72110eff9f43e12997aa7310e8.zip
Replace homebrewed NIL by NULL
Notes
Notes: svn path=/head/; revision=282459
Diffstat (limited to 'usr.bin/vgrind')
-rw-r--r--usr.bin/vgrind/regexp.c80
-rw-r--r--usr.bin/vgrind/vfontedpr.c61
2 files changed, 69 insertions, 72 deletions
diff --git a/usr.bin/vgrind/regexp.c b/usr.bin/vgrind/regexp.c
index 2738507290af5..b23d7d94ed6b5 100644
--- a/usr.bin/vgrind/regexp.c
+++ b/usr.bin/vgrind/regexp.c
@@ -49,8 +49,6 @@ static const char sccsid[] = "@(#)regexp.c 8.1 (Berkeley) 6/6/93";
#include "extern.h"
-#define NIL 0
-
static void expconv(void);
bool _escaped; /* true if we are currently x_escaped */
@@ -151,10 +149,10 @@ convexp(char *re)
register char *cre; /* pointer to converted regular expression */
/* allocate room for the converted expression */
- if (re == NIL)
- return (NIL);
+ if (re == NULL)
+ return (NULL);
if (*re == '\0')
- return (NIL);
+ return (NULL);
cre = malloc (4 * strlen(re) + 3);
ccre = cre;
ure = re;
@@ -179,9 +177,9 @@ expconv()
register int temp;
/* let the conversion begin */
- acs = NIL;
- cs = NIL;
- while (*ure != NIL) {
+ acs = NULL;
+ cs = NULL;
+ while (*ure) {
switch (c = *ure++) {
case '\\':
@@ -189,7 +187,7 @@ expconv()
/* escaped characters are just characters */
default:
- if (cs == NIL || (*cs & STR) == 0) {
+ if (cs == NULL || (*cs & STR) == 0) {
cs = ccre;
*cs = STR;
SCNT(cs) = 1;
@@ -204,13 +202,13 @@ expconv()
case 'd':
case 'e':
case 'p':
- if (acs != NIL && acs != cs) {
+ if (acs != NULL && acs != cs) {
do {
temp = OCNT(acs);
OCNT(acs) = ccre - acs;
acs -= temp;
} while (temp != 0);
- acs = NIL;
+ acs = NULL;
}
cs = ccre;
*cs = META;
@@ -223,13 +221,13 @@ expconv()
/* just put the symbol in */
case '^':
case '$':
- if (acs != NIL && acs != cs) {
+ if (acs != NULL && acs != cs) {
do {
temp = OCNT(acs);
OCNT(acs) = ccre - acs;
acs -= temp;
} while (temp != 0);
- acs = NIL;
+ acs = NULL;
}
cs = ccre;
*cs = META;
@@ -245,13 +243,13 @@ expconv()
/* recurse and define a subexpression */
case '(':
- if (acs != NIL && acs != cs) {
+ if (acs != NULL && acs != cs) {
do {
temp = OCNT(acs);
OCNT(acs) = ccre - acs;
acs -= temp;
} while (temp != 0);
- acs = NIL;
+ acs = NULL;
}
cs = ccre;
*cs = OPER;
@@ -263,13 +261,13 @@ expconv()
/* return from a recursion */
case ')':
- if (acs != NIL) {
+ if (acs != NULL) {
do {
temp = OCNT(acs);
OCNT(acs) = ccre - acs;
acs -= temp;
} while (temp != 0);
- acs = NIL;
+ acs = NULL;
}
cs = ccre;
*cs = META;
@@ -281,7 +279,7 @@ expconv()
/* the third byte will contain an offset to jump over the */
/* alternate match in case the first did not fail */
case '|':
- if (acs != NIL && acs != cs)
+ if (acs != NULL && acs != cs)
OCNT(ccre) = ccre - acs; /* make a back pointer */
else
OCNT(ccre) = 0;
@@ -295,7 +293,7 @@ expconv()
/* if its not a metasymbol just build a scharacter string */
default:
- if (cs == NIL || (*cs & STR) == 0) {
+ if (cs == NULL || (*cs & STR) == 0) {
cs = ccre;
*cs = STR;
SCNT(cs) = 1;
@@ -306,13 +304,13 @@ expconv()
break;
}
}
- if (acs != NIL) {
+ if (acs != NULL) {
do {
temp = OCNT(acs);
OCNT(acs) = ccre - acs;
acs -= temp;
} while (temp != 0);
- acs = NIL;
+ acs = NULL;
}
return;
}
@@ -354,8 +352,8 @@ expmatch (register char *s, register char *re, register char *mstring)
bool matched; /* a temporary bool */
/* initial conditions */
- if (re == NIL)
- return (NIL);
+ if (re == NULL)
+ return (NULL);
cs = re;
matched = false;
@@ -383,7 +381,7 @@ expmatch (register char *s, register char *re, register char *mstring)
} else {
/* no match, error return */
- return (NIL);
+ return (NULL);
}
break;
@@ -406,7 +404,7 @@ expmatch (register char *s, register char *re, register char *mstring)
/* this is a grouping, recurse */
case '(':
ptr = expmatch (s, ONEXT(cs), mstring);
- if (ptr != NIL) {
+ if (ptr != NULL) {
/* the subexpression matched */
matched = 1;
@@ -422,7 +420,7 @@ expmatch (register char *s, register char *re, register char *mstring)
} else {
/* no match, error return */
- return (NIL);
+ return (NULL);
}
cs = OPTR(cs);
break;
@@ -443,20 +441,20 @@ expmatch (register char *s, register char *re, register char *mstring)
s1 = s;
do {
ptr = expmatch (s1, MNEXT(cs), mstring);
- if (ptr != NIL && s1 != s) {
+ if (ptr != NULL && s1 != s) {
/* we have a match, remember the match */
strncpy (mstring, s, s1 - s);
mstring[s1 - s] = '\0';
return (ptr);
- } else if (ptr != NIL && (*cs & OPT)) {
+ } else if (ptr != NULL && (*cs & OPT)) {
/* it was aoptional so no match is ok */
return (ptr);
- } else if (ptr != NIL) {
+ } else if (ptr != NULL) {
/* not optional and we still matched */
- return (NIL);
+ return (NULL);
}
if (!(isalnum(*s1) || *s1 == '_' ||
/* C++ destructor */
@@ -464,13 +462,13 @@ expmatch (register char *s, register char *re, register char *mstring)
/* C++ scope operator */
(strlen(s1) > 1 && *s1 == ':' && s1[1] == ':' &&
(s1++, true))))
- return (NIL);
+ return (NULL);
if (*s1 == '\\')
_escaped = _escaped ? false : true;
else
_escaped = false;
} while (*s1++);
- return (NIL);
+ return (NULL);
/* try to match anything */
case 'a':
@@ -482,30 +480,30 @@ expmatch (register char *s, register char *re, register char *mstring)
s1 = s;
do {
ptr = expmatch (s1, MNEXT(cs), mstring);
- if (ptr != NIL && s1 != s) {
+ if (ptr != NULL && s1 != s) {
/* we have a match */
return (ptr);
- } else if (ptr != NIL && (*cs & OPT)) {
+ } else if (ptr != NULL && (*cs & OPT)) {
/* it was aoptional so no match is ok */
return (ptr);
- } else if (ptr != NIL) {
+ } else if (ptr != NULL) {
/* not optional and we still matched */
- return (NIL);
+ return (NULL);
}
if (*s1 == '\\')
_escaped = _escaped ? false : true;
else
_escaped = false;
} while (*s1++);
- return (NIL);
+ return (NULL);
/* fail if we are currently _escaped */
case 'e':
if (_escaped)
- return(NIL);
+ return(NULL);
cs = MNEXT(cs);
break;
@@ -537,7 +535,7 @@ expmatch (register char *s, register char *re, register char *mstring)
} else
/* no match, error return */
- return (NIL);
+ return (NULL);
break;
/* check for end of line */
@@ -561,7 +559,7 @@ expmatch (register char *s, register char *re, register char *mstring)
} else
/* no match, error return */
- return (NIL);
+ return (NULL);
break;
/* check for start of line */
@@ -584,7 +582,7 @@ expmatch (register char *s, register char *re, register char *mstring)
} else
/* no match, error return */
- return (NIL);
+ return (NULL);
break;
/* end of a subexpression, return success */
diff --git a/usr.bin/vgrind/vfontedpr.c b/usr.bin/vgrind/vfontedpr.c
index af34fd76af52f..cb50261f98458 100644
--- a/usr.bin/vgrind/vfontedpr.c
+++ b/usr.bin/vgrind/vfontedpr.c
@@ -53,7 +53,6 @@ static const char sccsid[] = "@(#)vfontedpr.c 8.1 (Berkeley) 6/6/93";
#include "pathnames.h"
#include "extern.h"
-#define NIL 0
#define STANDARD 0
#define ALTERNATE 1
@@ -247,7 +246,7 @@ main(int argc, char **argv)
while (*cp != ' ' && *cp != '\t' && *cp)
cp++;
}
- *cpp = NIL;
+ *cpp = NULL;
}
cgetustr(defs, "pb", &cp);
l_prcbeg = convexp(cp);
@@ -388,9 +387,9 @@ skip:
nocomptr = expmatch (s, l_nocom, dummy);
/* start of non-comment? */
- if (nocomptr != NIL)
- if ((nocomptr <= comptr || comptr == NIL)
- && (nocomptr <= acmptr || acmptr == NIL)) {
+ if (nocomptr != NULL)
+ if ((nocomptr <= comptr || comptr == NULL)
+ && (nocomptr <= acmptr || acmptr == NULL)) {
/* continue after non-comment */
putKcp (s, nocomptr-1, false);
s = nocomptr;
@@ -398,12 +397,12 @@ skip:
}
/* start of a comment? */
- if (comptr != NIL)
- if ((comptr < strptr || strptr == NIL)
- && (comptr < acmptr || acmptr == NIL)
- && (comptr < chrptr || chrptr == NIL)
- && (comptr < blksptr || blksptr == NIL)
- && (comptr < blkeptr || blkeptr == NIL)) {
+ if (comptr != NULL)
+ if ((comptr < strptr || strptr == NULL)
+ && (comptr < acmptr || acmptr == NULL)
+ && (comptr < chrptr || chrptr == NULL)
+ && (comptr < blksptr || blksptr == NULL)
+ && (comptr < blkeptr || blkeptr == NULL)) {
putKcp (s, comptr-1, false);
s = comptr;
incomm = true;
@@ -415,11 +414,11 @@ skip:
}
/* start of a comment? */
- if (acmptr != NIL)
- if ((acmptr < strptr || strptr == NIL)
- && (acmptr < chrptr || chrptr == NIL)
- && (acmptr < blksptr || blksptr == NIL)
- && (acmptr < blkeptr || blkeptr == NIL)) {
+ if (acmptr != NULL)
+ if ((acmptr < strptr || strptr == NULL)
+ && (acmptr < chrptr || chrptr == NULL)
+ && (acmptr < blksptr || blksptr == NULL)
+ && (acmptr < blkeptr || blkeptr == NULL)) {
putKcp (s, acmptr-1, false);
s = acmptr;
incomm = true;
@@ -431,10 +430,10 @@ skip:
}
/* start of a string? */
- if (strptr != NIL)
- if ((strptr < chrptr || chrptr == NIL)
- && (strptr < blksptr || blksptr == NIL)
- && (strptr < blkeptr || blkeptr == NIL)) {
+ if (strptr != NULL)
+ if ((strptr < chrptr || chrptr == NULL)
+ && (strptr < blksptr || blksptr == NULL)
+ && (strptr < blkeptr || blkeptr == NULL)) {
putKcp(s, strptr-1, false);
s = strptr;
instr = true;
@@ -442,9 +441,9 @@ skip:
}
/* start of a character string? */
- if (chrptr != NIL)
- if ((chrptr < blksptr || blksptr == NIL)
- && (chrptr < blkeptr || blkeptr == NIL)) {
+ if (chrptr != NULL)
+ if ((chrptr < blksptr || blksptr == NULL)
+ && (chrptr < blkeptr || blkeptr == NULL)) {
putKcp(s, chrptr-1, false);
s = chrptr;
inchr = true;
@@ -452,8 +451,8 @@ skip:
}
/* end of a lexical block */
- if (blkeptr != NIL) {
- if (blkeptr < blksptr || blksptr == NIL) {
+ if (blkeptr != NULL) {
+ if (blkeptr < blksptr || blksptr == NULL) {
putKcp(s, blkeptr - 1, false);
s = blkeptr;
if (blklevel > 0 /* sanity */)
@@ -477,7 +476,7 @@ skip:
}
/* start of a lexical block */
- if (blksptr != NIL) {
+ if (blksptr != NULL) {
putKcp(s, blksptr - 1, false);
s = blksptr;
blklevel++;
@@ -488,8 +487,8 @@ skip:
} else if (incomm) {
comptr = expmatch (s, l_comend, dummy);
acmptr = expmatch (s, l_acmend, dummy);
- if (((comtype == STANDARD) && (comptr != NIL)) ||
- ((comtype == ALTERNATE) && (acmptr != NIL))) {
+ if (((comtype == STANDARD) && (comptr != NULL)) ||
+ ((comtype == ALTERNATE) && (acmptr != NULL))) {
if (comtype == STANDARD) {
putKcp(s, comptr-1, true);
s = comptr;
@@ -508,7 +507,7 @@ skip:
/* check for end of string */
} else if (instr) {
- if ((strptr = expmatch (s, l_strend, dummy)) != NIL) {
+ if ((strptr = expmatch (s, l_strend, dummy)) != NULL) {
putKcp(s, strptr-1, true);
s = strptr;
instr = false;
@@ -521,7 +520,7 @@ skip:
/* check for end of character string */
} else if (inchr) {
- if ((chrptr = expmatch (s, l_chrend, dummy)) != NIL) {
+ if ((chrptr = expmatch (s, l_chrend, dummy)) != NULL) {
putKcp(s, chrptr-1, true);
s = chrptr;
inchr = false;
@@ -691,7 +690,7 @@ isproc(char *s)
{
pname[0] = '\0';
if (!l_toplex || blklevel == 0)
- if (expmatch (s, l_prcbeg, pname) != NIL) {
+ if (expmatch (s, l_prcbeg, pname) != NULL) {
return (true);
}
return (false);