diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2003-06-18 21:08:08 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2003-06-18 21:08:08 +0000 |
commit | 35eec2cb552641a60db99e8aa2113608d7cc0f78 (patch) | |
tree | 979b9af23e6892282e1c2ec48213536677fdc34d /usr.bin/m4/main.c | |
parent | d6f2c260e4ef7a357be58b961566161e135574b5 (diff) |
- store builtin name as definition for builtin macros.
this removes the need for code->name conversion, in exchange for
systematically testing the definition type, since we can no longer
rely on the defn being NULL.
- commonnalize the builtin-detection code, so that we can use it for pushdef
as well with define, so that pushdef handles builtins correctly as well.
okay fries@, millert@.
Diffstat (limited to 'usr.bin/m4/main.c')
-rw-r--r-- | usr.bin/m4/main.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/usr.bin/m4/main.c b/usr.bin/m4/main.c index c60b9b8c66b..a07ebbfd477 100644 --- a/usr.bin/m4/main.c +++ b/usr.bin/m4/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.57 2003/06/12 14:36:43 espie Exp $ */ +/* $OpenBSD: main.c,v 1.58 2003/06/18 21:08:07 espie Exp $ */ /* $NetBSD: main.c,v 1.12 1997/02/08 23:54:49 cgd Exp $ */ /*- @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.57 2003/06/12 14:36:43 espie Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.58 2003/06/18 21:08:07 espie Exp $"; #endif #endif /* not lint */ @@ -586,7 +586,7 @@ initkwds(void) p->nxtptr = hashtab[h % HASHSIZE]; hashtab[h % HASHSIZE] = p; p->name = xstrdup(keywrds[i].knam); - p->defn = null; + p->defn = xstrdup(keywrds[i].knam); p->hv = h; p->type = keywrds[i].ktyp & TYPEMASK; if ((keywrds[i].ktyp & NOARGS) == 0) @@ -606,17 +606,6 @@ builtin_type(const char *key) return -1; } -char * -builtin_realname(int n) -{ - int i; - - for (i = 0; i != MAXKEYS; i++) - if (((keywrds[i].ktyp ^ n) & TYPEMASK) == 0) - return keywrds[i].knam; - return NULL; -} - static void record(struct position *t, int lev) { |