Author: imp
Date: Sun Jun 2 16:28:20 2019
New Revision: 348512
URL: https://svnweb.freebsd.org/changeset/base/348512
Log:
Reapply r301289 by pfg:
|MFV r300961: one-true-awk: replace 0 with NULL for pointers
|Also remove a redundant semicolon.
|Also had to rebase on upstream pull.
Modified:
head/contrib/one-true-awk/b.c
head/contrib/one-true-awk/lex.c
head/contrib/one-true-awk/maketab.c
head/contrib/one-true-awk/parse.c
head/contrib/one-true-awk/run.c
head/contrib/one-true-awk/tran.c
Modified: head/contrib/one-true-awk/b.c
==
--- head/contrib/one-true-awk/b.c Sun Jun 2 16:25:07 2019
(r348511)
+++ head/contrib/one-true-awk/b.c Sun Jun 2 16:28:20 2019
(r348512)
@@ -91,11 +91,11 @@ fa *makedfa(const char *s, int anchor) /* returns dfa
fa *pfa;
static int now = 1;
- if (setvec == 0) { /* first time through any RE */
+ if (setvec == NULL) { /* first time through any RE */
maxsetvec = MAXLIN;
setvec = (int *) malloc(maxsetvec * sizeof(int));
tmpset = (int *) malloc(maxsetvec * sizeof(int));
- if (setvec == 0 || tmpset == 0)
+ if (setvec == NULL || tmpset == NULL)
overflo("out of space initializing makedfa");
}
@@ -317,11 +317,11 @@ char *cclenter(const char *argp) /* add a character cl
int j;
uschar *p = (uschar *) argp;
uschar *op, *bp;
- static uschar *buf = 0;
+ static uschar *buf = NULL;
static int bufsz = 100;
op = p;
- if (buf == 0 && (buf = (uschar *) malloc(bufsz)) == NULL)
+ if (buf == NULL && (buf = (uschar *) malloc(bufsz)) == NULL)
FATAL("out of space for character class [%.10s...] 1", p);
bp = buf;
for (i = 0; (c = *p++) != 0; ) {
@@ -380,7 +380,7 @@ void cfoll(fa *f, Node *v) /* enter follow set of each
maxsetvec *= 4;
setvec = (int *) realloc(setvec, maxsetvec *
sizeof(int));
tmpset = (int *) realloc(tmpset, maxsetvec *
sizeof(int));
- if (setvec == 0 || tmpset == 0)
+ if (setvec == NULL || tmpset == NULL)
overflo("out of space in cfoll()");
}
for (i = 0; i <= f->accept; i++)
@@ -421,7 +421,7 @@ int first(Node *p) /* collects initially active leaves
maxsetvec *= 4;
setvec = (int *) realloc(setvec, maxsetvec *
sizeof(int));
tmpset = (int *) realloc(tmpset, maxsetvec *
sizeof(int));
- if (setvec == 0 || tmpset == 0)
+ if (setvec == NULL || tmpset == NULL)
overflo("out of space in first()");
}
if (type(p) == EMPTYRE) {
@@ -923,7 +923,7 @@ int relex(void) /* lexical analyzer for reparse
*/
{
int c, n;
int cflag;
- static uschar *buf = 0;
+ static uschar *buf = NULL;
static int bufsz = 100;
uschar *bp;
struct charclass *cc;
@@ -953,7 +953,7 @@ rescan:
rlxval = c;
return CHAR;
case '[':
- if (buf == 0 && (buf = (uschar *) malloc(bufsz)) == NULL)
+ if (buf == NULL && (buf = (uschar *) malloc(bufsz)) == NULL)
FATAL("out of space in reg expr %.10s..", lastre);
bp = buf;
if (*prestr == '^') {
@@ -1129,7 +1129,7 @@ int cgoto(fa *f, int s, int c)
maxsetvec *= 4;
setvec = (int *) realloc(setvec, maxsetvec * sizeof(int));
tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(int));
- if (setvec == 0 || tmpset == 0)
+ if (setvec == NULL || tmpset == NULL)
overflo("out of space in cgoto()");
}
for (i = 0; i <= f->accept; i++)
@@ -1151,7 +1151,7 @@ int cgoto(fa *f, int s, int c)
maxsetvec *= 4;
setvec = (int *)
realloc(setvec, maxsetvec * sizeof(int));
tmpset = (int *)
realloc(tmpset, maxsetvec * sizeof(int));
- if (setvec == 0 || tmpset == 0)
+ if (setvec == NULL || tmpset ==
NULL)
overflo("cgoto
overflow");
}
if (setvec[q[j]] == 0) {
Modified: head/contrib/one-true-awk/lex.c
==
--- head/contrib/one-true-awk/lex.c Sun