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
This commit is contained in:
Tim J. Robbins 2004-08-16 14:18:22 +00:00
parent f914e34db6
commit f03b27517b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=133858
3 changed files with 6 additions and 6 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -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)