Commit f7a839bc authored by Tom Lane's avatar Tom Lane

Clean up portability problems in regexp package: change all routine

definitions from K&R to ANSI C style, and fix broken assumption that
int and long are the same datatype.  This repairs problems observed
on Alpha with regexps having between 32 and 63 states.
parent f4e4c729
...@@ -80,37 +80,26 @@ struct match ...@@ -80,37 +80,26 @@ struct match
pg_wchar *endp; /* end of string -- virtual NUL here */ pg_wchar *endp; /* end of string -- virtual NUL here */
pg_wchar *coldp; /* can be no match starting before here */ pg_wchar *coldp; /* can be no match starting before here */
pg_wchar **lastpos; /* [nplus+1] */ pg_wchar **lastpos; /* [nplus+1] */
STATEVARS; STATEVARS;
states st; /* current states */ states st; /* current states */
states fresh; /* states for a fresh start */ states fresh; /* states for a fresh start */
states tmp; /* temporary */ states tmp; /* temporary */
states empty; /* empty set of states */ states empty; /* empty set of states */
}; };
/* ========= begin header generated by ./mkh ========= */ static int matcher(struct re_guts *g, pg_wchar *string, size_t nmatch,
#ifdef __cplusplus regmatch_t *pmatch, int eflags);
extern "C" static pg_wchar *dissect(struct match *m, pg_wchar *start, pg_wchar *stop,
{ sopno startst, sopno stopst);
#endif static pg_wchar *backref(struct match *m, pg_wchar *start, pg_wchar *stop,
sopno startst, sopno stopst, sopno lev);
static pg_wchar *fast(struct match *m, pg_wchar *start, pg_wchar *stop,
sopno startst, sopno stopst);
static pg_wchar *slow(struct match *m, pg_wchar *start, pg_wchar *stop,
sopno startst, sopno stopst);
static states step(struct re_guts *g, sopno start,
sopno stop, states bef, int ch, states aft);
/* === engine.c === */
static int
matcher(struct re_guts * g, pg_wchar * string, size_t nmatch,
regmatch_t *pmatch, int eflags);
static pg_wchar *
dissect(struct match * m, pg_wchar * start, pg_wchar * stop,
sopno startst, sopno stopst);
static pg_wchar *
backref(struct match * m, pg_wchar * start, pg_wchar * stop,
sopno startst, sopno stopst, sopno lev);
static pg_wchar *
fast(struct match * m, pg_wchar * start, pg_wchar * stop,
sopno startst, sopno stopst);
static pg_wchar *
slow(struct match * m, pg_wchar * start, pg_wchar * stop, sopno startst, sopno stopst);
static states
step(struct re_guts * g, sopno start,
sopno stop, states bef, int ch, states aft);
#define BOL (OUT+1) #define BOL (OUT+1)
#define EOL (BOL+1) #define EOL (BOL+1)
#define BOLEOL (BOL+2) #define BOLEOL (BOL+2)
...@@ -128,24 +117,13 @@ extern "C" ...@@ -128,24 +117,13 @@ extern "C"
#endif #endif
#ifdef REDEBUG #ifdef REDEBUG
static void static void print(struct match *m, pg_wchar *caption, states st, int ch,
print(struct match * m, pg_wchar * caption, states st, int ch, FILE *d); FILE *d);
#endif static void at(struct match *m, pg_wchar *title, pg_wchar *start,
#ifdef REDEBUG pg_wchar *stop, sopno startst, sopno stopst);
static void static pg_wchar *pchar(int ch);
at(struct match * m, pg_wchar * title, pg_wchar * start, pg_wchar * stop, static int pg_isprint(int c);
sopno startst, sopno stopst);
#endif
#ifdef REDEBUG
static pg_wchar *
p_char(int ch);
#endif
#ifdef __cplusplus
}
#endif #endif
/* ========= end header generated by ./mkh ========= */
#ifdef REDEBUG #ifdef REDEBUG
#define SP(t, s, c) print(m, t, s, c, stdout) #define SP(t, s, c) print(m, t, s, c, stdout)
...@@ -158,17 +136,11 @@ extern "C" ...@@ -158,17 +136,11 @@ extern "C"
#endif #endif
/* /*
- matcher - the actual matching engine * matcher - the actual matching engine
== static int matcher(struct re_guts *g, pg_wchar *string, \
== size_t nmatch, regmatch_t *pmatch, int eflags);
*/ */
static int /* 0 success, REG_NOMATCH failure */ static int /* 0 success, REG_NOMATCH failure */
matcher(g, string, nmatch, pmatch, eflags) matcher(struct re_guts *g, pg_wchar *string, size_t nmatch,
struct re_guts *g; regmatch_t *pmatch, int eflags)
pg_wchar *string;
size_t nmatch;
regmatch_t *pmatch;
int eflags;
{ {
pg_wchar *endp; pg_wchar *endp;
int i; int i;
...@@ -206,10 +178,11 @@ int eflags; ...@@ -206,10 +178,11 @@ int eflags;
for (dp = start; dp < stop; dp++) for (dp = start; dp < stop; dp++)
if (*dp == g->must[0] && stop - dp >= g->mlen && if (*dp == g->must[0] && stop - dp >= g->mlen &&
#ifdef MULTIBYTE #ifdef MULTIBYTE
memcmp(dp, g->must, (size_t) (g->mlen * sizeof(pg_wchar))) == 0) memcmp(dp, g->must, (size_t) (g->mlen * sizeof(pg_wchar))) == 0
#else #else
memcmp(dp, g->must, (size_t) g->mlen) == 0) memcmp(dp, g->must, (size_t) g->mlen) == 0
#endif #endif
)
break; break;
if (dp == stop) /* we didn't find g->must */ if (dp == stop) /* we didn't find g->must */
return REG_NOMATCH; return REG_NOMATCH;
...@@ -349,17 +322,11 @@ int eflags; ...@@ -349,17 +322,11 @@ int eflags;
} }
/* /*
- dissect - figure out what matched what, no back references * dissect - figure out what matched what, no back references
== static char *dissect(struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/ */
static pg_wchar * /* == stop (success) always */ static pg_wchar * /* == stop (success) always */
dissect(m, start, stop, startst, stopst) dissect(struct match *m, pg_wchar *start, pg_wchar *stop,
struct match *m; sopno startst, sopno stopst)
pg_wchar *start;
pg_wchar *stop;
sopno startst;
sopno stopst;
{ {
int i; int i;
sopno ss; /* start sop of current subRE */ sopno ss; /* start sop of current subRE */
...@@ -549,18 +516,13 @@ sopno stopst; ...@@ -549,18 +516,13 @@ sopno stopst;
} }
/* /*
- backref - figure out what matched what, figuring in back references * backref - figure out what matched what, figuring in back references
== static char *backref(struct match *m, char *start, \ *
== char *stop, sopno startst, sopno stopst, sopno lev); * lev is PLUS nesting level
*/ */
static pg_wchar * /* == stop (success) or NULL (failure) */ static pg_wchar * /* == stop (success) or NULL (failure) */
backref(m, start, stop, startst, stopst, lev) backref(struct match *m, pg_wchar *start, pg_wchar *stop,
struct match *m; sopno startst, sopno stopst, sopno lev)
pg_wchar *start;
pg_wchar *stop;
sopno startst;
sopno stopst;
sopno lev; /* PLUS nesting level */
{ {
int i; int i;
sopno ss; /* start sop of current subRE */ sopno ss; /* start sop of current subRE */
...@@ -763,17 +725,11 @@ sopno lev; /* PLUS nesting level */ ...@@ -763,17 +725,11 @@ sopno lev; /* PLUS nesting level */
} }
/* /*
- fast - step through the string at top speed * fast - step through the string at top speed
== static char *fast(struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/ */
static pg_wchar * /* where tentative match ended, or NULL */ static pg_wchar * /* where tentative match ended, or NULL */
fast(m, start, stop, startst, stopst) fast(struct match *m, pg_wchar *start, pg_wchar *stop,
struct match *m; sopno startst, sopno stopst)
pg_wchar *start;
pg_wchar *stop;
sopno startst;
sopno stopst;
{ {
states st = m->st; states st = m->st;
states fresh = m->fresh; states fresh = m->fresh;
...@@ -858,17 +814,11 @@ sopno stopst; ...@@ -858,17 +814,11 @@ sopno stopst;
} }
/* /*
- slow - step through the string more deliberately * slow - step through the string more deliberately
== static char *slow(struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/ */
static pg_wchar * /* where it ended */ static pg_wchar * /* where it ended */
slow(m, start, stop, startst, stopst) slow(struct match *m, pg_wchar *start, pg_wchar *stop,
struct match *m; sopno startst, sopno stopst)
pg_wchar *start;
pg_wchar *stop;
sopno startst;
sopno stopst;
{ {
states st = m->st; states st = m->st;
states empty = m->empty; states empty = m->empty;
...@@ -948,27 +898,15 @@ sopno stopst; ...@@ -948,27 +898,15 @@ sopno stopst;
/* /*
- step - map set of states reachable before char to set reachable after * step - map set of states reachable before char to set reachable after
== static states step(struct re_guts *g, sopno start, sopno stop, \
== states bef, int ch, states aft);
== #define BOL (OUT+1)
== #define EOL (BOL+1)
== #define BOLEOL (BOL+2)
== #define NOTHING (BOL+3)
== #define BOW (BOL+4)
== #define EOW (BOL+5)
== #define CODEMAX (BOL+5) // highest code used
== #define NONCHAR(c) ((c) > CHAR_MAX)
== #define NNONCHAR (CODEMAX-CHAR_MAX)
*/ */
static states static states
step(g, start, stop, bef, ch, aft) step(struct re_guts *g,
struct re_guts *g; sopno start, /* start state within strip */
sopno start; /* start state within strip */ sopno stop, /* state after stop state within strip */
sopno stop; /* state after stop state within strip */ states bef, /* states reachable before */
states bef; /* states reachable before */ int ch, /* character or NONCHAR code */
int ch; /* character or NONCHAR code */ states aft) /* states already known reachable after */
states aft; /* states already known reachable after */
{ {
cset *cs; cset *cs;
sop s; sop s;
...@@ -1082,19 +1020,11 @@ states aft; /* states already known reachable after */ ...@@ -1082,19 +1020,11 @@ states aft; /* states already known reachable after */
#ifdef REDEBUG #ifdef REDEBUG
/* /*
- print - print a set of states * print - print a set of states
== #ifdef REDEBUG
== static void print(struct match *m, char *caption, states st, \
== int ch, FILE *d);
== #endif
*/ */
static void static void
print(m, caption, st, ch, d) print(struct match *m, pg_wchar *caption, states st,
struct match *m; int ch, FILE *d)
pg_wchar *caption;
states st;
int ch;
FILE *d;
{ {
struct re_guts *g = m->g; struct re_guts *g = m->g;
int i; int i;
...@@ -1116,20 +1046,11 @@ FILE *d; ...@@ -1116,20 +1046,11 @@ FILE *d;
} }
/* /*
- at - print current situation * at - print current situation
== #ifdef REDEBUG
== static void at(struct match *m, pg_wchar *title, pg_wchar *start, pg_wchar *stop, \
== sopno startst, sopno stopst);
== #endif
*/ */
static void static void
at(m, title, start, stop, startst, stopst) at(struct match *m, pg_wchar *title, pg_wchar *start, pg_wchar *stop,
struct match *m; sopno startst, sopno stopst)
pg_wchar *title;
pg_wchar *start;
pg_wchar *stop;
sopno startst;
sopno stopst;
{ {
if (!(m->eflags & REG_TRACE)) if (!(m->eflags & REG_TRACE))
return; return;
...@@ -1140,19 +1061,26 @@ sopno stopst; ...@@ -1140,19 +1061,26 @@ sopno stopst;
} }
#ifndef PCHARDONE #ifndef PCHARDONE
#define PCHARDONE /* never again */ #define PCHARDONE /* only do this once */
/* /*
- pchar - make a character printable * pchar - make a character printable
== #ifdef REDEBUG
== static char *pchar(int ch);
== #endif
* *
* Is this identical to regchar() over in debug.c? Well, yes. But a * Is this identical to regchar() over in debug.c? Well, yes. But a
* duplicate here avoids having a debugging-capable regexec.o tied to * duplicate here avoids having a debugging-capable regexec.o tied to
* a matching debug.o, and this is convenient. It all disappears in * a matching debug.o, and this is convenient. It all disappears in
* the non-debug compilation anyway, so it doesn't matter much. * the non-debug compilation anyway, so it doesn't matter much.
*/ */
static pg_wchar * /* -> representation */
pchar(int ch)
{
static pg_wchar pbuf[10];
if (pg_isprint(ch) || ch == ' ')
sprintf(pbuf, "%c", ch);
else
sprintf(pbuf, "\\%o", ch);
return pbuf;
}
static int static int
pg_isprint(int c) pg_isprint(int c)
...@@ -1164,19 +1092,6 @@ pg_isprint(int c) ...@@ -1164,19 +1092,6 @@ pg_isprint(int c)
#endif #endif
} }
static pg_wchar * /* -> representation */
pchar(ch)
int ch;
{
static pg_wchar pbuf[10];
if (pg_isprint(ch) || ch == ' ')
sprintf(pbuf, "%c", ch);
else
sprintf(pbuf, "\\%o", ch);
return pbuf;
}
#endif #endif
#endif #endif
......
This diff is collapsed.
...@@ -37,59 +37,19 @@ ...@@ -37,59 +37,19 @@
* @(#)regerror.c 8.4 (Berkeley) 3/20/94 * @(#)regerror.c 8.4 (Berkeley) 3/20/94
*/ */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
#endif /* LIBC_SCCS and not lint */
#include "postgres.h" #include "postgres.h"
#include <sys/types.h> #include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h> #include <ctype.h>
#include <limits.h> #include <limits.h>
#include <stdlib.h>
#include <assert.h> #include <assert.h>
#include "regex/regex.h" #include "regex/regex.h"
#include "regex/utils.h" #include "regex/utils.h"
#include "regex/regex2.h" #include "regex/regex2.h"
/* ========= begin header generated by ./mkh ========= */ static char *regatoi(const regex_t *preg, char *localbuf);
#ifdef __cplusplus
extern "C"
{
#endif
/* === regerror.c === */
static char *regatoi(const regex_t *preg, char *localbuf);
#ifdef __cplusplus
}
#endif
/* ========= end header generated by ./mkh ========= */
/*
= #define REG_NOMATCH 1
= #define REG_BADPAT 2
= #define REG_ECOLLATE 3
= #define REG_ECTYPE 4
= #define REG_EESCAPE 5
= #define REG_ESUBREG 6
= #define REG_EBRACK 7
= #define REG_EPAREN 8
= #define REG_EBRACE 9
= #define REG_BADBR 10
= #define REG_ERANGE 11
= #define REG_ESPACE 12
= #define REG_BADRPT 13
= #define REG_EMPTY 14
= #define REG_ASSERT 15
= #define REG_INVARG 16
= #define REG_ATOI 255 // convert name to number (!)
= #define REG_ITOA 0400 // convert number to name (!)
*/
static struct rerr static struct rerr
{ {
int code; int code;
...@@ -152,16 +112,12 @@ static struct rerr ...@@ -152,16 +112,12 @@ static struct rerr
}; };
/* /*
- regerror - the interface to error numbers * regerror - the interface to error numbers
= extern size_t regerror(int, const regex_t *, char *, size_t);
*/ */
/* ARGSUSED */ /* ARGSUSED */
size_t size_t
pg95_regerror(errcode, preg, errbuf, errbuf_size) pg95_regerror(int errcode, const regex_t *preg,
int errcode; char *errbuf, size_t errbuf_size)
const regex_t *preg;
char *errbuf;
size_t errbuf_size;
{ {
struct rerr *r; struct rerr *r;
size_t len; size_t len;
...@@ -206,13 +162,10 @@ size_t errbuf_size; ...@@ -206,13 +162,10 @@ size_t errbuf_size;
} }
/* /*
- regatoi - internal routine to implement REG_ATOI * regatoi - internal routine to implement REG_ATOI
== static char *regatoi(const regex_t *preg, char *localbuf);
*/ */
static char * static char *
regatoi(preg, localbuf) regatoi(const regex_t *preg, char *localbuf)
const regex_t *preg;
char *localbuf;
{ {
struct rerr *r; struct rerr *r;
......
...@@ -37,11 +37,6 @@ ...@@ -37,11 +37,6 @@
* @(#)regexec.c 8.3 (Berkeley) 3/20/94 * @(#)regexec.c 8.3 (Berkeley) 3/20/94
*/ */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94";
#endif /* LIBC_SCCS and not lint */
#include "postgres.h" #include "postgres.h"
/* /*
...@@ -52,9 +47,6 @@ static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94"; ...@@ -52,9 +47,6 @@ static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94";
* representations for state sets. * representations for state sets.
*/ */
#include <sys/types.h> #include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h> #include <limits.h>
#include <ctype.h> #include <ctype.h>
#include <assert.h> #include <assert.h>
...@@ -69,24 +61,24 @@ static int nope = 0; /* for use in asserts; shuts lint up */ ...@@ -69,24 +61,24 @@ static int nope = 0; /* for use in asserts; shuts lint up */
#define states long #define states long
#define states1 states /* for later use in regexec() decision */ #define states1 states /* for later use in regexec() decision */
#define CLEAR(v) ((v) = 0) #define CLEAR(v) ((v) = 0)
#define SET0(v, n) ((v) &= ~(1 << (n))) #define SET0(v, n) ((v) &= ~(1L << (n)))
#define SET1(v, n) ((v) |= 1 << (n)) #define SET1(v, n) ((v) |= (1L << (n)))
#define ISSET(v, n) ((v) & (1 << (n))) #define ISSET(v, n) ((v) & (1L << (n)))
#define ASSIGN(d, s) ((d) = (s)) #define ASSIGN(d, s) ((d) = (s))
#define EQ(a, b) ((a) == (b)) #define EQ(a, b) ((a) == (b))
#define STATEVARS int dummy /* dummy version */ #define STATEVARS int dummy /* dummy version */
#define STATESETUP(m, n) /* nothing */ #define STATESETUP(m, n) /* nothing */
#define STATETEARDOWN(m) /* nothing */ #define STATETEARDOWN(m) /* nothing */
#define SETUP(v) ((v) = 0) #define SETUP(v) ((v) = 0)
#define onestate int #define onestate long
#define INIT(o, n) ((o) = (unsigned)1 << (n)) #define INIT(o, n) ((o) = (1L << (n)))
#define INC(o) ((o) <<= 1) #define INC(o) ((o) <<= 1)
#define ISSTATEIN(v, o) ((v) & (o)) #define ISSTATEIN(v, o) ((v) & (o))
/* some abbreviations; note that some of these know variable names! */ /* some abbreviations; note that some of these know variable names! */
/* do "if I'm here, I can also be there" etc without branches */ /* do "if I'm here, I can also be there" etc without branches */
#define FWD(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) << (n)) #define FWD(dst, src, n) ((dst) |= ((src) & (here)) << (n))
#define BACK(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) >> (n)) #define BACK(dst, src, n) ((dst) |= ((src) & (here)) >> (n))
#define ISSETBACK(v, n) ((v) & ((unsigned)here >> (n))) #define ISSETBACK(v, n) ((v) & (here >> (n)))
/* function names */ /* function names */
#define SNAMES /* engine.c looks after details */ #define SNAMES /* engine.c looks after details */
...@@ -129,7 +121,7 @@ static int nope = 0; /* for use in asserts; shuts lint up */ ...@@ -129,7 +121,7 @@ static int nope = 0; /* for use in asserts; shuts lint up */
#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates]) #define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
#define onestate int #define onestate int
#define INIT(o, n) ((o) = (n)) #define INIT(o, n) ((o) = (n))
#define INC(o) ((o)++) #define INC(o) ((o)++)
#define ISSTATEIN(v, o) ((v)[o]) #define ISSTATEIN(v, o) ((v)[o])
/* some abbreviations; note that some of these know variable names! */ /* some abbreviations; note that some of these know variable names! */
/* do "if I'm here, I can also be there" etc without branches */ /* do "if I'm here, I can also be there" etc without branches */
...@@ -142,27 +134,14 @@ static int nope = 0; /* for use in asserts; shuts lint up */ ...@@ -142,27 +134,14 @@ static int nope = 0; /* for use in asserts; shuts lint up */
#include "engine.c" #include "engine.c"
/* /*
- regexec - interface for matching * regexec - interface for matching
= extern int regexec(const regex_t *, const char *, size_t, \
= regmatch_t [], int);
= #define REG_NOTBOL 00001
= #define REG_NOTEOL 00002
= #define REG_STARTEND 00004
= #define REG_TRACE 00400 // tracing of execution
= #define REG_LARGE 01000 // force large representation
= #define REG_BACKR 02000 // force use of backref code
* *
* We put this here so we can exploit knowledge of the state representation * We put this here so we can exploit knowledge of the state representation
* when choosing which matcher to call. Also, by this point the matchers * when choosing which matcher to call.
* have been prototyped.
*/ */
int /* 0 success, REG_NOMATCH failure */ int /* 0 success, REG_NOMATCH failure */
pg95_regexec(preg, string, nmatch, pmatch, eflags) pg95_regexec(const regex_t *preg, const char *string, size_t nmatch,
const regex_t *preg; regmatch_t *pmatch, int eflags)
const char *string;
size_t nmatch;
regmatch_t *pmatch;
int eflags;
{ {
struct re_guts *g = preg->re_g; struct re_guts *g = preg->re_g;
......
...@@ -37,28 +37,19 @@ ...@@ -37,28 +37,19 @@
* @(#)regfree.c 8.3 (Berkeley) 3/20/94 * @(#)regfree.c 8.3 (Berkeley) 3/20/94
*/ */
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)regfree.c 8.3 (Berkeley) 3/20/94";
#endif /* LIBC_SCCS and not lint */
#include "postgres.h" #include "postgres.h"
#include <sys/types.h> #include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include "regex/regex.h" #include "regex/regex.h"
#include "regex/utils.h" #include "regex/utils.h"
#include "regex/regex2.h" #include "regex/regex2.h"
/* /*
- regfree - free everything * regfree - free everything
= extern void regfree(regex_t *);
*/ */
void void
pg95_regfree(preg) pg95_regfree(regex_t *preg)
regex_t *preg;
{ {
struct re_guts *g; struct re_guts *g;
......
...@@ -94,6 +94,6 @@ static struct cclass ...@@ -94,6 +94,6 @@ static struct cclass
"" ""
}, },
{ {
NULL, 0, "" NULL, NULL, ""
} }
}; };
...@@ -102,10 +102,12 @@ typedef struct ...@@ -102,10 +102,12 @@ typedef struct
#define REG_LARGE 01000 /* force large representation */ #define REG_LARGE 01000 /* force large representation */
#define REG_BACKR 02000 /* force use of backref code */ #define REG_BACKR 02000 /* force use of backref code */
int pg95_regcomp(regex_t *, const char *, int); extern int pg95_regcomp(regex_t *preg, const char *pattern, int cflags);
size_t pg95_regerror(int, const regex_t *, char *, size_t); extern size_t pg95_regerror(int errcode, const regex_t *preg,
int pg95_regexec(const regex_t *, char *errbuf, size_t errbuf_size);
const char *, size_t, regmatch_t[], int); extern int pg95_regexec(const regex_t *preg, const char *string,
void pg95_regfree(regex_t *); size_t nmatch,
regmatch_t *pmatch, int eflags);
extern void pg95_regfree(regex_t *preg);
#endif /* !_REGEX_H_ */ #endif /* !_REGEX_H_ */
...@@ -39,22 +39,6 @@ ...@@ -39,22 +39,6 @@
#include <limits.h> #include <limits.h>
/*
* First, the stuff that ends up in the outside-world include file
*/
/*
typedef off_t regoff_t;
typedef struct {
int re_magic;
size_t re_nsub; // number of parenthesized subexpressions
const char *re_endp; // end pointer for REG_PEND
struct re_guts *re_g; // none of your business :-)
} regex_t;
typedef struct {
regoff_t rm_so; // start of match
regoff_t rm_eo; // end of match
} regmatch_t;
*/
/* /*
* internals of regex_t * internals of regex_t
*/ */
...@@ -82,8 +66,8 @@ ...@@ -82,8 +66,8 @@
typedef unsigned long sop; /* strip operator */ typedef unsigned long sop; /* strip operator */
typedef long sopno; typedef long sopno;
#define OPRMASK 0xf8000000 #define OPRMASK ((sop) 0xf8000000)
#define OPDMASK 0x07ffffff #define OPDMASK ((sop) 0x07ffffff)
#define OPSHIFT ((unsigned)27) #define OPSHIFT ((unsigned)27)
#define OP(n) ((n)&OPRMASK) #define OP(n) ((n)&OPRMASK)
#define OPND(n) ((n)&OPDMASK) #define OPND(n) ((n)&OPDMASK)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment