summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-08-16 14:18:22 +0000
committertjr <tjr@FreeBSD.org>2004-08-16 14:18:22 +0000
commit1d5fa9d950aab078562e5ec6ac4999759ae30cc3 (patch)
tree088ee3d6e5669a3d27abe1db6259f06143bfa7b1 /usr.bin
parent776807c108140db246983939942ef04900ed7d84 (diff)
downloadFreeBSD-src-1d5fa9d950aab078562e5ec6ac4999759ae30cc3.zip
FreeBSD-src-1d5fa9d950aab078562e5ec6ac4999759ae30cc3.tar.gz
Store a pointer to "null" in struct ndblock's defn member instead of a
duplicate allocated on the heap; the address defn points to is significant, and is checked against the address of "null" in certain conditionals. PR: 59883 MFC after: 1 week
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/m4/eval.c6
-rw-r--r--usr.bin/m4/extern.h2
-rw-r--r--usr.bin/m4/main.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/m4/eval.c b/usr.bin/m4/eval.c
index 6d2d0fde..060ce03 100644
--- a/usr.bin/m4/eval.c
+++ b/usr.bin/m4/eval.c
@@ -593,12 +593,12 @@ dodefine(const char *name, const char *defn)
p->type = n & TYPEMASK;
if ((n & NOARGS) == 0)
p->type |= NEEDARGS;
- p->defn = xstrdup(null);
+ p->defn = null;
return;
}
}
if (!*defn)
- p->defn = xstrdup(null);
+ p->defn = null;
else
p->defn = xstrdup(defn);
p->type = MACRTYPE;
@@ -645,7 +645,7 @@ dopushdef(const char *name, const char *defn)
CURRENT_LINE);
p = addent(name);
if (!*defn)
- p->defn = xstrdup(null);
+ p->defn = null;
else
p->defn = xstrdup(defn);
p->type = MACRTYPE;
diff --git a/usr.bin/m4/extern.h b/usr.bin/m4/extern.h
index 88cba41..e96870b 100644
--- a/usr.bin/m4/extern.h
+++ b/usr.bin/m4/extern.h
@@ -149,7 +149,7 @@ extern char ecommt[MAXCCHARS+1];/* end character for comment */
extern char *ep; /* first free char in strspace */
extern char lquote[MAXCCHARS+1];/* left quote character (`) */
extern const char *m4wraps; /* m4wrap string default. */
-extern const char *null; /* as it says.. just a null. */
+extern char null[]; /* as it says.. just a null. */
extern char rquote[MAXCCHARS+1];/* right quote character (') */
extern char scommt[MAXCCHARS+1];/* start character for comment */
extern int synccpp; /* Line synchronisation for C preprocessor */
diff --git a/usr.bin/m4/main.c b/usr.bin/m4/main.c
index 1c1ac45..847a372 100644
--- a/usr.bin/m4/main.c
+++ b/usr.bin/m4/main.c
@@ -93,7 +93,7 @@ int maxout;
FILE *active; /* active output file pointer */
int ilevel = 0; /* input file stack pointer */
int oindex = 0; /* diversion index.. */
-const char *null = ""; /* as it says.. just a null.. */
+char null[] = ""; /* as it says.. just a null.. */
const char *m4wraps = ""; /* m4wrap string default.. */
char lquote[MAXCCHARS+1] = {LQUOTE}; /* left quote character (`) */
char rquote[MAXCCHARS+1] = {RQUOTE}; /* right quote character (') */
@@ -583,7 +583,7 @@ initkwds(void)
p->nxtptr = hashtab[h % HASHSIZE];
hashtab[h % HASHSIZE] = p;
p->name = xstrdup(keywrds[i].knam);
- p->defn = xstrdup(null);
+ p->defn = null;
p->hv = h;
p->type = keywrds[i].ktyp & TYPEMASK;
if ((keywrds[i].ktyp & NOARGS) == 0)
OpenPOWER on IntegriCloud