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:
parent
f914e34db6
commit
f03b27517b
@ -593,12 +593,12 @@ dodefine(const char *name, const char *defn)
|
|||||||
p->type = n & TYPEMASK;
|
p->type = n & TYPEMASK;
|
||||||
if ((n & NOARGS) == 0)
|
if ((n & NOARGS) == 0)
|
||||||
p->type |= NEEDARGS;
|
p->type |= NEEDARGS;
|
||||||
p->defn = xstrdup(null);
|
p->defn = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!*defn)
|
if (!*defn)
|
||||||
p->defn = xstrdup(null);
|
p->defn = null;
|
||||||
else
|
else
|
||||||
p->defn = xstrdup(defn);
|
p->defn = xstrdup(defn);
|
||||||
p->type = MACRTYPE;
|
p->type = MACRTYPE;
|
||||||
@ -645,7 +645,7 @@ dopushdef(const char *name, const char *defn)
|
|||||||
CURRENT_LINE);
|
CURRENT_LINE);
|
||||||
p = addent(name);
|
p = addent(name);
|
||||||
if (!*defn)
|
if (!*defn)
|
||||||
p->defn = xstrdup(null);
|
p->defn = null;
|
||||||
else
|
else
|
||||||
p->defn = xstrdup(defn);
|
p->defn = xstrdup(defn);
|
||||||
p->type = MACRTYPE;
|
p->type = MACRTYPE;
|
||||||
|
@ -149,7 +149,7 @@ extern char ecommt[MAXCCHARS+1];/* end character for comment */
|
|||||||
extern char *ep; /* first free char in strspace */
|
extern char *ep; /* first free char in strspace */
|
||||||
extern char lquote[MAXCCHARS+1];/* left quote character (`) */
|
extern char lquote[MAXCCHARS+1];/* left quote character (`) */
|
||||||
extern const char *m4wraps; /* m4wrap string default. */
|
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 rquote[MAXCCHARS+1];/* right quote character (') */
|
||||||
extern char scommt[MAXCCHARS+1];/* start character for comment */
|
extern char scommt[MAXCCHARS+1];/* start character for comment */
|
||||||
extern int synccpp; /* Line synchronisation for C preprocessor */
|
extern int synccpp; /* Line synchronisation for C preprocessor */
|
||||||
|
@ -93,7 +93,7 @@ int maxout;
|
|||||||
FILE *active; /* active output file pointer */
|
FILE *active; /* active output file pointer */
|
||||||
int ilevel = 0; /* input file stack pointer */
|
int ilevel = 0; /* input file stack pointer */
|
||||||
int oindex = 0; /* diversion index.. */
|
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.. */
|
const char *m4wraps = ""; /* m4wrap string default.. */
|
||||||
char lquote[MAXCCHARS+1] = {LQUOTE}; /* left quote character (`) */
|
char lquote[MAXCCHARS+1] = {LQUOTE}; /* left quote character (`) */
|
||||||
char rquote[MAXCCHARS+1] = {RQUOTE}; /* right quote character (') */
|
char rquote[MAXCCHARS+1] = {RQUOTE}; /* right quote character (') */
|
||||||
@ -583,7 +583,7 @@ initkwds(void)
|
|||||||
p->nxtptr = hashtab[h % HASHSIZE];
|
p->nxtptr = hashtab[h % HASHSIZE];
|
||||||
hashtab[h % HASHSIZE] = p;
|
hashtab[h % HASHSIZE] = p;
|
||||||
p->name = xstrdup(keywrds[i].knam);
|
p->name = xstrdup(keywrds[i].knam);
|
||||||
p->defn = xstrdup(null);
|
p->defn = null;
|
||||||
p->hv = h;
|
p->hv = h;
|
||||||
p->type = keywrds[i].ktyp & TYPEMASK;
|
p->type = keywrds[i].ktyp & TYPEMASK;
|
||||||
if ((keywrds[i].ktyp & NOARGS) == 0)
|
if ((keywrds[i].ktyp & NOARGS) == 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user