From: millert Date: Sat, 12 Apr 1997 18:22:22 +0000 (+0000) Subject: long -> int to fix 64bit issues. This breaks 16bit machines but since we don't have... X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b37692f881dae1acc9690dd3df389cbd7edd0705;p=openbsd long -> int to fix 64bit issues. This breaks 16bit machines but since we don't have any 16bit ports...) The alternative is to use int32_t's but then this code will break when/if int > 32bits which is not so unlikely. Fixes NetBSD PR #3450 from Ross Harvey (but in a different way) --- diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c index b9791be3687..969d530f6df 100644 --- a/lib/libc/regex/engine.c +++ b/lib/libc/regex/engine.c @@ -36,7 +36,7 @@ */ #if defined(SNAMES) && defined(LIBC_SCCS) && !defined(lint) -static char enginercsid[] = "$OpenBSD: engine.c,v 1.2 1996/08/19 08:31:06 tholo Exp $"; +static char enginercsid[] = "$OpenBSD: engine.c,v 1.3 1997/04/12 18:22:22 millert Exp $"; #endif /* SNAMES and LIBC_SCCS and not lint */ /* @@ -1051,7 +1051,7 @@ sopno stopst; printf("%s %s-", title, pchar(*start)); printf("%s ", pchar(*stop)); - printf("%ld-%ld\n", (long)startst, (long)stopst); + printf("%d-%d\n", startst, stopst); } #ifndef PCHARDONE diff --git a/lib/libc/regex/regex2.h b/lib/libc/regex/regex2.h index 986c98aff65..6e720e24088 100644 --- a/lib/libc/regex/regex2.h +++ b/lib/libc/regex/regex2.h @@ -1,4 +1,4 @@ -/* $OpenBSD: regex2.h,v 1.2 1996/08/19 08:31:14 tholo Exp $ */ +/* $OpenBSD: regex2.h,v 1.3 1997/04/12 18:22:24 millert Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 Henry Spencer. @@ -75,8 +75,8 @@ * In state representations, an operator's bit is on to signify a state * immediately *preceding* "execution" of that operator. */ -typedef unsigned long sop; /* strip operator */ -typedef long sopno; +typedef unsigned sop; /* strip operator */ +typedef int sopno; #define OPRMASK 0xf8000000 #define OPDMASK 0x07ffffff #define OPSHIFT ((unsigned)27) diff --git a/lib/libc/regex/regexec.c b/lib/libc/regex/regexec.c index da4545f67b0..f9ca2508e35 100644 --- a/lib/libc/regex/regexec.c +++ b/lib/libc/regex/regexec.c @@ -36,7 +36,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: regexec.c,v 1.4 1996/09/15 09:31:27 tholo Exp $"; +static char rcsid[] = "$OpenBSD: regexec.c,v 1.5 1997/04/12 18:22:25 millert Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -58,27 +58,27 @@ static char rcsid[] = "$OpenBSD: regexec.c,v 1.4 1996/09/15 09:31:27 tholo Exp $ #include "regex2.h" /* macros for manipulating states, small version */ -#define states long +#define states int #define states1 states /* for later use in regexec() decision */ #define CLEAR(v) ((v) = 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 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 ASSIGN(d, s) ((d) = (s)) #define EQ(a, b) ((a) == (b)) -#define STATEVARS long dummy /* dummy version */ +#define STATEVARS int dummy /* dummy version */ #define STATESETUP(m, n) /* nothing */ #define STATETEARDOWN(m) /* nothing */ #define SETUP(v) ((v) = 0) -#define onestate long -#define INIT(o, n) ((o) = (unsigned long)1 << (n)) -#define INC(o) ((o) = (unsigned long)(o) << 1) +#define onestate int +#define INIT(o, n) ((o) = (unsigned)1 << (n)) +#define INC(o) ((o) = (unsigned)(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 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) +#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) /* function names */ #define SNAMES /* engine.c looks after details */ @@ -113,13 +113,13 @@ static char rcsid[] = "$OpenBSD: regexec.c,v 1.4 1996/09/15 09:31:27 tholo 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 long vn; char *space +#define STATEVARS int 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 long +#define onestate int #define INIT(o, n) ((o) = (n)) #define INC(o) ((o)++) #define ISSTATEIN(v, o) ((v)[o])