diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-12-22 00:09:08 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-12-22 00:09:08 +0000 |
commit | 901248fef436c81dfd9c2dc40d39c4eb334427fa (patch) | |
tree | 1a5efabd2320f5a079a213070d81db4a574b4cf0 /lib/libc/regex | |
parent | 699124344140713d47b4445676f054ace3eecba2 (diff) |
Clarify code by eliminating unused #define's MUSTSEE, MUSTNOTSEE and inlining
MUSTEAT.
ok tom@
Diffstat (limited to 'lib/libc/regex')
-rw-r--r-- | lib/libc/regex/regcomp.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c index f25ed8ce148..4feb2747b83 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: regcomp.c,v 1.30 2016/12/21 15:13:50 krw Exp $ */ +/* $OpenBSD: regcomp.c,v 1.31 2016/12/22 00:09:07 krw Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 Henry Spencer. * Copyright (c) 1992, 1993, 1994 @@ -125,9 +125,6 @@ static char nuls[10]; /* place to point scanner in event of error */ #define GETNEXT() (*p->next++) #define SETERROR(e) seterr(p, (e)) #define REQUIRE(co, e) (void) ((co) || SETERROR(e)) -#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e)) -#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e)) -#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e)) #define EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd)) #define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos) #define AHEAD(pos) dofwd(p, pos, HERE()-(pos)) @@ -317,7 +314,7 @@ p_ere_exp(struct parse *p) assert(p->pend[subno] != 0); } EMIT(ORPAREN, subno); - MUSTEAT(')', REG_EPAREN); + REQUIRE(MORE() && GETNEXT() == ')', REG_EPAREN); break; case '^': EMIT(OBOL, 0); @@ -648,7 +645,7 @@ p_bracket(struct parse *p) p_b_term(p, cs); if (EAT('-')) CHadd(cs, '-'); - MUSTEAT(']', REG_EBRACK); + REQUIRE(MORE() && GETNEXT() == ']', REG_EBRACK); if (p->error != 0) { /* don't mess things up further */ freeset(p, cs); |