mirror of
https://github.com/postgres/postgres.git
synced 2025-08-15 14:02:29 +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:
@@ -37,59 +37,19 @@
|
||||
* @(#)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 <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "regex/regex.h"
|
||||
#include "regex/utils.h"
|
||||
#include "regex/regex2.h"
|
||||
|
||||
/* ========= begin header generated by ./mkh ========= */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
static char *regatoi(const regex_t *preg, char *localbuf);
|
||||
|
||||
/* === 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
|
||||
{
|
||||
int code;
|
||||
@@ -152,16 +112,12 @@ static struct rerr
|
||||
};
|
||||
|
||||
/*
|
||||
- regerror - the interface to error numbers
|
||||
= extern size_t regerror(int, const regex_t *, char *, size_t);
|
||||
* regerror - the interface to error numbers
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
size_t
|
||||
pg95_regerror(errcode, preg, errbuf, errbuf_size)
|
||||
int errcode;
|
||||
const regex_t *preg;
|
||||
char *errbuf;
|
||||
size_t errbuf_size;
|
||||
pg95_regerror(int errcode, const regex_t *preg,
|
||||
char *errbuf, size_t errbuf_size)
|
||||
{
|
||||
struct rerr *r;
|
||||
size_t len;
|
||||
@@ -206,13 +162,10 @@ size_t errbuf_size;
|
||||
}
|
||||
|
||||
/*
|
||||
- regatoi - internal routine to implement REG_ATOI
|
||||
== static char *regatoi(const regex_t *preg, char *localbuf);
|
||||
* regatoi - internal routine to implement REG_ATOI
|
||||
*/
|
||||
static char *
|
||||
regatoi(preg, localbuf)
|
||||
const regex_t *preg;
|
||||
char *localbuf;
|
||||
regatoi(const regex_t *preg, char *localbuf)
|
||||
{
|
||||
struct rerr *r;
|
||||
|
||||
|
Reference in New Issue
Block a user