diff options
author | 1997-04-28 20:44:55 +0000 | |
---|---|---|
committer | 1997-04-28 20:44:55 +0000 | |
commit | 442a6afd2aa35676c3e5e1eb30f8d6b41db981ab (patch) | |
tree | ea2d2cb3c05319abe61a7d935cd240301677dbdf /lib/libc/regex/regexec.c | |
parent | Deal with $TERM not being set (like in single user mode). (diff) | |
download | wireguard-openbsd-442a6afd2aa35676c3e5e1eb30f8d6b41db981ab.tar.xz wireguard-openbsd-442a6afd2aa35676c3e5e1eb30f8d6b41db981ab.zip |
- cast usages of *printf() to void since we don't check return val
- move an assert to be *before* a strcpy() where it can do some good.
- integrate NetBSD fixes for 64-bit machines (NetBSD PR #3450, Ross Harvey)
- add lite2 tags
Diffstat (limited to 'lib/libc/regex/regexec.c')
-rw-r--r-- | lib/libc/regex/regexec.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/lib/libc/regex/regexec.c b/lib/libc/regex/regexec.c index f9ca2508e35..2175e7c64b3 100644 --- a/lib/libc/regex/regexec.c +++ b/lib/libc/regex/regexec.c @@ -33,10 +33,16 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * @(#)regexec.c 8.3 (Berkeley) 3/20/94 */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: regexec.c,v 1.5 1997/04/12 18:22:25 millert Exp $"; +#if 0 +static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94"; +#else +static char rcsid[] = "$OpenBSD: regexec.c,v 1.6 1997/04/28 20:45:01 millert Exp $"; +#endif #endif /* LIBC_SCCS and not lint */ /* @@ -57,28 +63,30 @@ static char rcsid[] = "$OpenBSD: regexec.c,v 1.5 1997/04/12 18:22:25 millert Exp #include "utils.h" #include "regex2.h" +static int nope = 0; /* for use in asserts; shuts lint up */ + /* macros for manipulating states, small version */ -#define states int +#define states long #define states1 states /* for later use in regexec() decision */ #define CLEAR(v) ((v) = 0) -#define SET0(v, n) ((v) &= ~((unsigned)1 << (n))) -#define SET1(v, n) ((v) |= (unsigned)1 << (n)) -#define ISSET(v, n) (((v) & ((unsigned)1 << (n))) != 0) +#define SET0(v, n) ((v) &= ~((unsigned long)1 << (n))) +#define SET1(v, n) ((v) |= (unsigned long)1 << (n)) +#define ISSET(v, n) (((v) & ((unsigned long)1 << (n))) != 0) #define ASSIGN(d, s) ((d) = (s)) #define EQ(a, b) ((a) == (b)) -#define STATEVARS int dummy /* dummy version */ +#define STATEVARS long dummy /* dummy version */ #define STATESETUP(m, n) /* nothing */ #define STATETEARDOWN(m) /* nothing */ #define SETUP(v) ((v) = 0) -#define onestate int -#define INIT(o, n) ((o) = (unsigned)1 << (n)) -#define INC(o) ((o) = (unsigned)(o) << 1) +#define onestate long +#define INIT(o, n) ((o) = (unsigned long)1 << (n)) +#define INC(o) ((o) <<= 1) #define ISSTATEIN(v, o) (((v) & (o)) != 0) /* some abbreviations; note that some of these know variable names! */ /* do "if I'm here, I can also be there" etc without branches */ -#define FWD(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) << (n)) -#define BACK(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) >> (n)) -#define ISSETBACK(v, n) (((v) & ((unsigned)here >> (n))) != 0) +#define FWD(dst, src, n) ((dst) |= ((unsigned long)(src)&(here)) << (n)) +#define BACK(dst, src, n) ((dst) |= ((unsigned long)(src)&(here)) >> (n)) +#define ISSETBACK(v, n) (((v) & ((unsigned long)here >> (n))) != 0) /* function names */ #define SNAMES /* engine.c looks after details */ @@ -113,13 +121,13 @@ static char rcsid[] = "$OpenBSD: regexec.c,v 1.5 1997/04/12 18:22:25 millert Exp #define ISSET(v, n) ((v)[n]) #define ASSIGN(d, s) memcpy(d, s, m->g->nstates) #define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0) -#define STATEVARS int vn; char *space +#define STATEVARS long vn; char *space #define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \ if ((m)->space == NULL) return(REG_ESPACE); \ (m)->vn = 0; } #define STATETEARDOWN(m) { free((m)->space); } #define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates]) -#define onestate int +#define onestate long #define INIT(o, n) ((o) = (n)) #define INC(o) ((o)++) #define ISSTATEIN(v, o) ((v)[o]) |