1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

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.
This commit is contained in:
Tom Lane
2001-02-13 00:02:36 +00:00
parent f4e4c7291e
commit f7a839bc2b
8 changed files with 226 additions and 603 deletions

View File

@ -94,6 +94,6 @@ static struct cclass
""
},
{
NULL, 0, ""
NULL, NULL, ""
}
};

View File

@ -102,10 +102,12 @@ typedef struct
#define REG_LARGE 01000 /* force large representation */
#define REG_BACKR 02000 /* force use of backref code */
int pg95_regcomp(regex_t *, const char *, int);
size_t pg95_regerror(int, const regex_t *, char *, size_t);
int pg95_regexec(const regex_t *,
const char *, size_t, regmatch_t[], int);
void pg95_regfree(regex_t *);
extern int pg95_regcomp(regex_t *preg, const char *pattern, int cflags);
extern size_t pg95_regerror(int errcode, const regex_t *preg,
char *errbuf, size_t errbuf_size);
extern int pg95_regexec(const regex_t *preg, const char *string,
size_t nmatch,
regmatch_t *pmatch, int eflags);
extern void pg95_regfree(regex_t *preg);
#endif /* !_REGEX_H_ */

View File

@ -39,22 +39,6 @@
#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
*/
@ -82,8 +66,8 @@
typedef unsigned long sop; /* strip operator */
typedef long sopno;
#define OPRMASK 0xf8000000
#define OPDMASK 0x07ffffff
#define OPRMASK ((sop) 0xf8000000)
#define OPDMASK ((sop) 0x07ffffff)
#define OPSHIFT ((unsigned)27)
#define OP(n) ((n)&OPRMASK)
#define OPND(n) ((n)&OPDMASK)