mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
OK, folks, here is the pgindent output.
This commit is contained in:
@ -77,7 +77,7 @@ struct match
|
||||
pg_wchar *beginp; /* start of string -- virtual NUL precedes */
|
||||
pg_wchar *endp; /* end of string -- virtual NUL here */
|
||||
pg_wchar *coldp; /* can be no match starting before here */
|
||||
pg_wchar **lastpos; /* [nplus+1] */
|
||||
pg_wchar **lastpos; /* [nplus+1] */
|
||||
STATEVARS;
|
||||
states st; /* current states */
|
||||
states fresh; /* states for a fresh start */
|
||||
@ -93,19 +93,19 @@ extern "C"
|
||||
|
||||
/* === engine.c === */
|
||||
static int
|
||||
matcher(struct re_guts * g, pg_wchar *string, size_t nmatch,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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);
|
||||
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);
|
||||
@ -118,20 +118,20 @@ extern "C"
|
||||
#define CODEMAX (BOL+5) /* highest code used */
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
# define NONCHAR(c) ((c) > 16777216) /* 16777216 == 2^24 == 3 bytes */
|
||||
# define NNONCHAR (CODEMAX-16777216)
|
||||
#define NONCHAR(c) ((c) > 16777216) /* 16777216 == 2^24 == 3 bytes */
|
||||
#define NNONCHAR (CODEMAX-16777216)
|
||||
#else
|
||||
# define NONCHAR(c) ((c) > CHAR_MAX)
|
||||
# define NNONCHAR (CODEMAX-CHAR_MAX)
|
||||
#define NONCHAR(c) ((c) > CHAR_MAX)
|
||||
#define NNONCHAR (CODEMAX-CHAR_MAX)
|
||||
#endif
|
||||
|
||||
#ifdef REDEBUG
|
||||
static void
|
||||
print(struct match * m, pg_wchar *caption, states st, int ch, FILE *d);
|
||||
print(struct match * m, pg_wchar * caption, states st, int ch, FILE *d);
|
||||
#endif
|
||||
#ifdef REDEBUG
|
||||
static void
|
||||
at(struct match * m, pg_wchar *title, pg_wchar *start, pg_wchar *stop,
|
||||
at(struct match * m, pg_wchar * title, pg_wchar * start, pg_wchar * stop,
|
||||
sopno startst, sopno stopst);
|
||||
#endif
|
||||
#ifdef REDEBUG
|
||||
@ -163,20 +163,20 @@ extern "C"
|
||||
static int /* 0 success, REG_NOMATCH failure */
|
||||
matcher(g, string, nmatch, pmatch, eflags)
|
||||
struct re_guts *g;
|
||||
pg_wchar *string;
|
||||
pg_wchar *string;
|
||||
size_t nmatch;
|
||||
regmatch_t *pmatch;
|
||||
regmatch_t *pmatch;
|
||||
int eflags;
|
||||
{
|
||||
pg_wchar *endp;
|
||||
pg_wchar *endp;
|
||||
int i;
|
||||
struct match mv;
|
||||
struct match *m = &mv;
|
||||
pg_wchar *dp;
|
||||
pg_wchar *dp;
|
||||
const sopno gf = g->firststate + 1; /* +1 for OEND */
|
||||
const sopno gl = g->laststate;
|
||||
pg_wchar *start;
|
||||
pg_wchar *stop;
|
||||
pg_wchar *start;
|
||||
pg_wchar *stop;
|
||||
|
||||
/* simplify the situation where possible */
|
||||
if (g->cflags & REG_NOSUB)
|
||||
@ -274,7 +274,7 @@ int eflags;
|
||||
{
|
||||
if (g->nplus > 0 && m->lastpos == NULL)
|
||||
m->lastpos = (pg_wchar **) malloc((g->nplus + 1) *
|
||||
sizeof(pg_wchar *));
|
||||
sizeof(pg_wchar *));
|
||||
if (g->nplus > 0 && m->lastpos == NULL)
|
||||
{
|
||||
free(m->pmatch);
|
||||
@ -354,24 +354,24 @@ int eflags;
|
||||
static pg_wchar * /* == stop (success) always */
|
||||
dissect(m, start, stop, startst, stopst)
|
||||
struct match *m;
|
||||
pg_wchar *start;
|
||||
pg_wchar *stop;
|
||||
pg_wchar *start;
|
||||
pg_wchar *stop;
|
||||
sopno startst;
|
||||
sopno stopst;
|
||||
{
|
||||
int i;
|
||||
sopno ss; /* start sop of current subRE */
|
||||
sopno es; /* end sop of current subRE */
|
||||
pg_wchar *sp; /* start of string matched by it */
|
||||
pg_wchar *stp; /* string matched by it cannot pass here */
|
||||
pg_wchar *rest; /* start of rest of string */
|
||||
pg_wchar *tail; /* string unmatched by rest of RE */
|
||||
pg_wchar *sp; /* start of string matched by it */
|
||||
pg_wchar *stp; /* string matched by it cannot pass here */
|
||||
pg_wchar *rest; /* start of rest of string */
|
||||
pg_wchar *tail; /* string unmatched by rest of RE */
|
||||
sopno ssub; /* start sop of subsubRE */
|
||||
sopno esub; /* end sop of subsubRE */
|
||||
pg_wchar *ssp; /* start of string matched by subsubRE */
|
||||
pg_wchar *sep; /* end of string matched by subsubRE */
|
||||
pg_wchar *oldssp; /* previous ssp */
|
||||
pg_wchar *dp;
|
||||
pg_wchar *ssp; /* start of string matched by subsubRE */
|
||||
pg_wchar *sep; /* end of string matched by subsubRE */
|
||||
pg_wchar *oldssp; /* previous ssp */
|
||||
pg_wchar *dp;
|
||||
|
||||
AT("diss", start, stop, startst, stopst);
|
||||
sp = start;
|
||||
@ -551,22 +551,22 @@ sopno stopst;
|
||||
== static char *backref(struct match *m, char *start, \
|
||||
== char *stop, sopno startst, sopno stopst, sopno lev);
|
||||
*/
|
||||
static pg_wchar * /* == stop (success) or NULL (failure) */
|
||||
static pg_wchar * /* == stop (success) or NULL (failure) */
|
||||
backref(m, start, stop, startst, stopst, lev)
|
||||
struct match *m;
|
||||
pg_wchar *start;
|
||||
pg_wchar *stop;
|
||||
pg_wchar *start;
|
||||
pg_wchar *stop;
|
||||
sopno startst;
|
||||
sopno stopst;
|
||||
sopno lev; /* PLUS nesting level */
|
||||
{
|
||||
int i;
|
||||
sopno ss; /* start sop of current subRE */
|
||||
pg_wchar *sp; /* start of string matched by it */
|
||||
pg_wchar *sp; /* start of string matched by it */
|
||||
sopno ssub; /* start sop of subsubRE */
|
||||
sopno esub; /* end sop of subsubRE */
|
||||
pg_wchar *ssp; /* start of string matched by subsubRE */
|
||||
pg_wchar *dp;
|
||||
pg_wchar *ssp; /* start of string matched by subsubRE */
|
||||
pg_wchar *dp;
|
||||
size_t len;
|
||||
int hard;
|
||||
sop s;
|
||||
@ -685,7 +685,7 @@ sopno lev; /* PLUS nesting level */
|
||||
case OQUEST_: /* to null or not */
|
||||
dp = backref(m, sp, stop, ss + 1, stopst, lev);
|
||||
if (dp != NULL)
|
||||
return dp; /* not */
|
||||
return dp; /* not */
|
||||
return backref(m, sp, stop, ss + OPND(s) + 1, stopst, lev);
|
||||
break;
|
||||
case OPLUS_:
|
||||
@ -716,7 +716,7 @@ sopno lev; /* PLUS nesting level */
|
||||
return dp;
|
||||
/* that one missed, try next one */
|
||||
if (OP(m->g->strip[esub]) == O_CH)
|
||||
return NULL; /* there is none */
|
||||
return NULL;/* there is none */
|
||||
esub++;
|
||||
assert(OP(m->g->strip[esub]) == OOR2);
|
||||
ssub = esub + 1;
|
||||
@ -765,23 +765,23 @@ sopno lev; /* PLUS nesting level */
|
||||
== 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)
|
||||
struct match *m;
|
||||
pg_wchar *start;
|
||||
pg_wchar *stop;
|
||||
pg_wchar *start;
|
||||
pg_wchar *stop;
|
||||
sopno startst;
|
||||
sopno stopst;
|
||||
{
|
||||
states st = m->st;
|
||||
states fresh = m->fresh;
|
||||
states tmp = m->tmp;
|
||||
pg_wchar *p = start;
|
||||
pg_wchar *p = start;
|
||||
int c = (start == m->beginp) ? OUT : *(start - 1);
|
||||
int lastc; /* previous c */
|
||||
int flagch;
|
||||
int i;
|
||||
pg_wchar *coldp; /* last p after which no match was
|
||||
pg_wchar *coldp; /* last p after which no match was
|
||||
* underway */
|
||||
|
||||
CLEAR(st);
|
||||
@ -860,23 +860,23 @@ sopno stopst;
|
||||
== 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)
|
||||
struct match *m;
|
||||
pg_wchar *start;
|
||||
pg_wchar *stop;
|
||||
pg_wchar *start;
|
||||
pg_wchar *stop;
|
||||
sopno startst;
|
||||
sopno stopst;
|
||||
{
|
||||
states st = m->st;
|
||||
states empty = m->empty;
|
||||
states tmp = m->tmp;
|
||||
pg_wchar *p = start;
|
||||
pg_wchar *p = start;
|
||||
int c = (start == m->beginp) ? OUT : *(start - 1);
|
||||
int lastc; /* previous c */
|
||||
int flagch;
|
||||
int i;
|
||||
pg_wchar *matchp; /* last p at which a match ended */
|
||||
pg_wchar *matchp; /* last p at which a match ended */
|
||||
|
||||
AT("slow", start, stop, startst, stopst);
|
||||
CLEAR(st);
|
||||
@ -1089,7 +1089,7 @@ states aft; /* states already known reachable after */
|
||||
static void
|
||||
print(m, caption, st, ch, d)
|
||||
struct match *m;
|
||||
pg_wchar *caption;
|
||||
pg_wchar *caption;
|
||||
states st;
|
||||
int ch;
|
||||
FILE *d;
|
||||
@ -1123,9 +1123,9 @@ FILE *d;
|
||||
static void
|
||||
at(m, title, start, stop, startst, stopst)
|
||||
struct match *m;
|
||||
pg_wchar *title;
|
||||
pg_wchar *start;
|
||||
pg_wchar *stop;
|
||||
pg_wchar *title;
|
||||
pg_wchar *start;
|
||||
pg_wchar *stop;
|
||||
sopno startst;
|
||||
sopno stopst;
|
||||
{
|
||||
@ -1152,16 +1152,17 @@ sopno stopst;
|
||||
*/
|
||||
|
||||
|
||||
static int pg_isprint(int c)
|
||||
static int
|
||||
pg_isprint(int c)
|
||||
{
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && isprint(c));
|
||||
return (c >= 0 && c <= UCHAR_MAX && isprint(c));
|
||||
#else
|
||||
return(isprint(c));
|
||||
return (isprint(c));
|
||||
#endif
|
||||
}
|
||||
|
||||
static pg_wchar * /* -> representation */
|
||||
static pg_wchar * /* -> representation */
|
||||
pchar(ch)
|
||||
int ch;
|
||||
{
|
||||
|
@ -40,7 +40,7 @@
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)regcomp.c 8.5 (Berkeley) 3/20/94";
|
||||
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
@ -120,10 +120,10 @@ extern "C"
|
||||
static void stripsnug(struct parse * p, struct re_guts * g);
|
||||
static void findmust(struct parse * p, struct re_guts * g);
|
||||
static sopno pluscount(struct parse * p, struct re_guts * g);
|
||||
static int pg_isdigit(int c);
|
||||
static int pg_isalpha(int c);
|
||||
static int pg_isupper(int c);
|
||||
static int pg_islower(int c);
|
||||
static int pg_isdigit(int c);
|
||||
static int pg_isalpha(int c);
|
||||
static int pg_isupper(int c);
|
||||
static int pg_islower(int c);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@ -131,7 +131,7 @@ extern "C"
|
||||
#endif
|
||||
/* ========= end header generated by ./mkh ========= */
|
||||
|
||||
static pg_wchar nuls[10]; /* place to point scanner in event of
|
||||
static pg_wchar nuls[10]; /* place to point scanner in event of
|
||||
* error */
|
||||
|
||||
/*
|
||||
@ -194,8 +194,10 @@ int cflags;
|
||||
struct parse *p = &pa;
|
||||
int i;
|
||||
size_t len;
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
pg_wchar *wcp;
|
||||
pg_wchar *wcp;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef REDEBUG
|
||||
@ -211,7 +213,7 @@ int cflags;
|
||||
if (cflags & REG_PEND)
|
||||
{
|
||||
#ifdef MULTIBYTE
|
||||
wcp = preg->patsave;
|
||||
wcp = preg->patsave;
|
||||
if (preg->re_endp < wcp)
|
||||
return REG_INVARG;
|
||||
len = preg->re_endp - wcp;
|
||||
@ -221,18 +223,18 @@ int cflags;
|
||||
len = preg->re_endp - pattern;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
#ifdef MULTIBYTE
|
||||
wcp = (pg_wchar *)malloc((strlen(pattern)+1) * sizeof(pg_wchar));
|
||||
if (wcp == NULL) {
|
||||
return REG_ESPACE;
|
||||
}
|
||||
preg->patsave = wcp;
|
||||
(void)pg_mb2wchar((unsigned char *)pattern,wcp);
|
||||
len = pg_wchar_strlen(wcp);
|
||||
wcp = (pg_wchar *) malloc((strlen(pattern) + 1) * sizeof(pg_wchar));
|
||||
if (wcp == NULL)
|
||||
return REG_ESPACE;
|
||||
preg->patsave = wcp;
|
||||
(void) pg_mb2wchar((unsigned char *) pattern, wcp);
|
||||
len = pg_wchar_strlen(wcp);
|
||||
#else
|
||||
|
||||
len = strlen((char *) pattern);
|
||||
len = strlen((char *) pattern);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -256,7 +258,8 @@ int cflags;
|
||||
#ifdef MULTIBYTE
|
||||
p->next = wcp;
|
||||
#else
|
||||
p->next = (pg_wchar *)pattern; /* convenience; we do not modify it */
|
||||
p->next = (pg_wchar *) pattern; /* convenience; we do not modify
|
||||
* it */
|
||||
#endif
|
||||
p->end = p->next + len;
|
||||
p->error = 0;
|
||||
@ -755,14 +758,16 @@ struct parse *p;
|
||||
{
|
||||
cset *cs = allocset(p);
|
||||
int invert = 0;
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
pg_wchar sp1[] = {'[', ':', '<', ':', ']', ']'};
|
||||
pg_wchar sp2[] = {'[', ':', '>', ':', ']', ']'};
|
||||
pg_wchar sp1[] = {'[', ':', '<', ':', ']', ']'};
|
||||
pg_wchar sp2[] = {'[', ':', '>', ':', ']', ']'};
|
||||
|
||||
#endif
|
||||
|
||||
/* Dept of Truly Sickening Special-Case Kludges */
|
||||
#ifdef MULTIBYTE
|
||||
if (p->next + 5 < p->end && pg_wchar_strncmp(p->next, sp1, 6) == 0)
|
||||
if (p->next + 5 < p->end && pg_wchar_strncmp(p->next, sp1, 6) == 0)
|
||||
#else
|
||||
if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0)
|
||||
#endif
|
||||
@ -772,7 +777,7 @@ struct parse *p;
|
||||
return;
|
||||
}
|
||||
#ifdef MULTIBYTE
|
||||
if (p->next + 5 < p->end && pg_wchar_strncmp(p->next, sp2, 6) == 0)
|
||||
if (p->next + 5 < p->end && pg_wchar_strncmp(p->next, sp2, 6) == 0)
|
||||
#else
|
||||
if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0)
|
||||
#endif
|
||||
@ -847,8 +852,8 @@ p_b_term(p, cs)
|
||||
struct parse *p;
|
||||
cset *cs;
|
||||
{
|
||||
pg_wchar c;
|
||||
pg_wchar start,
|
||||
pg_wchar c;
|
||||
pg_wchar start,
|
||||
finish;
|
||||
int i;
|
||||
|
||||
@ -904,9 +909,8 @@ cset *cs;
|
||||
/* xxx what about signed chars here... */
|
||||
REQUIRE(start <= finish, REG_ERANGE);
|
||||
#ifdef MULTIBYTE
|
||||
if (CHlc(start) != CHlc(finish)) {
|
||||
SETERROR(REG_ERANGE);
|
||||
}
|
||||
if (CHlc(start) != CHlc(finish))
|
||||
SETERROR(REG_ERANGE);
|
||||
#endif
|
||||
for (i = start; i <= finish; i++)
|
||||
CHadd(cs, i);
|
||||
@ -974,11 +978,11 @@ cset *cs;
|
||||
- p_b_symbol - parse a character or [..]ed multicharacter collating symbol
|
||||
== static char p_b_symbol(struct parse *p);
|
||||
*/
|
||||
static pg_wchar /* value of symbol */
|
||||
static pg_wchar /* value of symbol */
|
||||
p_b_symbol(p)
|
||||
struct parse *p;
|
||||
{
|
||||
pg_wchar value;
|
||||
pg_wchar value;
|
||||
|
||||
REQUIRE(MORE(), REG_EBRACK);
|
||||
if (!EATTWO('[', '.'))
|
||||
@ -999,7 +1003,7 @@ p_b_coll_elem(p, endc)
|
||||
struct parse *p;
|
||||
int endc; /* name ended by endc,']' */
|
||||
{
|
||||
pg_wchar *sp = p->next;
|
||||
pg_wchar *sp = p->next;
|
||||
struct cname *cp;
|
||||
int len;
|
||||
|
||||
@ -1019,7 +1023,7 @@ int endc; /* name ended by endc,']' */
|
||||
#endif
|
||||
return cp->code; /* known name */
|
||||
if (len == 1)
|
||||
return *sp; /* single character */
|
||||
return *sp; /* single character */
|
||||
SETERROR(REG_ECOLLATE); /* neither */
|
||||
return 0;
|
||||
}
|
||||
@ -1053,9 +1057,9 @@ bothcases(p, ch)
|
||||
struct parse *p;
|
||||
int ch;
|
||||
{
|
||||
pg_wchar *oldnext = p->next;
|
||||
pg_wchar *oldend = p->end;
|
||||
pg_wchar bracket[3];
|
||||
pg_wchar *oldnext = p->next;
|
||||
pg_wchar *oldend = p->end;
|
||||
pg_wchar bracket[3];
|
||||
|
||||
assert(othercase(ch) != ch);/* p_bracket() would recurse */
|
||||
p->next = bracket;
|
||||
@ -1104,9 +1108,9 @@ static void
|
||||
nonnewline(p)
|
||||
struct parse *p;
|
||||
{
|
||||
pg_wchar *oldnext = p->next;
|
||||
pg_wchar *oldend = p->end;
|
||||
pg_wchar bracket[4];
|
||||
pg_wchar *oldnext = p->next;
|
||||
pg_wchar *oldend = p->end;
|
||||
pg_wchar bracket[4];
|
||||
|
||||
p->next = bracket;
|
||||
p->end = bracket + 3;
|
||||
@ -1733,7 +1737,7 @@ struct re_guts *g;
|
||||
sop *newstart = 0;
|
||||
sopno newlen;
|
||||
sop s;
|
||||
pg_wchar *cp;
|
||||
pg_wchar *cp;
|
||||
sopno i;
|
||||
|
||||
/* avoid making error situations worse */
|
||||
@ -1789,7 +1793,7 @@ struct re_guts *g;
|
||||
|
||||
/* turn it into a character string */
|
||||
#ifdef MULTIBYTE
|
||||
g->must = (pg_wchar *)malloc((size_t) (g->mlen + 1)*sizeof(pg_wchar));
|
||||
g->must = (pg_wchar *) malloc((size_t) (g->mlen + 1) * sizeof(pg_wchar));
|
||||
#else
|
||||
g->must = malloc((size_t) g->mlen + 1);
|
||||
#endif
|
||||
@ -1852,38 +1856,42 @@ struct re_guts *g;
|
||||
/*
|
||||
* some ctype functions with none-ascii-char guard
|
||||
*/
|
||||
static int pg_isdigit(int c)
|
||||
static int
|
||||
pg_isdigit(int c)
|
||||
{
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && isdigit(c));
|
||||
return (c >= 0 && c <= UCHAR_MAX && isdigit(c));
|
||||
#else
|
||||
return(isdigit(c));
|
||||
return (isdigit(c));
|
||||
#endif
|
||||
}
|
||||
|
||||
static int pg_isalpha(int c)
|
||||
static int
|
||||
pg_isalpha(int c)
|
||||
{
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && isalpha(c));
|
||||
return (c >= 0 && c <= UCHAR_MAX && isalpha(c));
|
||||
#else
|
||||
return(isalpha(c));
|
||||
return (isalpha(c));
|
||||
#endif
|
||||
}
|
||||
|
||||
static int pg_isupper(int c)
|
||||
static int
|
||||
pg_isupper(int c)
|
||||
{
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && isupper(c));
|
||||
return (c >= 0 && c <= UCHAR_MAX && isupper(c));
|
||||
#else
|
||||
return(isupper(c));
|
||||
return (isupper(c));
|
||||
#endif
|
||||
}
|
||||
|
||||
static int pg_islower(int c)
|
||||
static int
|
||||
pg_islower(int c)
|
||||
{
|
||||
#ifdef MULTIBYTE
|
||||
return(c >= 0 && c <= UCHAR_MAX && islower(c));
|
||||
return (c >= 0 && c <= UCHAR_MAX && islower(c));
|
||||
#else
|
||||
return(islower(c));
|
||||
return (islower(c));
|
||||
#endif
|
||||
}
|
||||
|
@ -40,7 +40,7 @@
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
|
||||
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
|
@ -40,7 +40,7 @@
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94";
|
||||
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
/*
|
||||
* the outer shell of regexec()
|
||||
@ -159,14 +159,15 @@ pg95_regexec(preg, string, nmatch, pmatch, eflags)
|
||||
const regex_t *preg;
|
||||
const char *string;
|
||||
size_t nmatch;
|
||||
regmatch_t *pmatch;
|
||||
regmatch_t *pmatch;
|
||||
int eflags;
|
||||
{
|
||||
struct re_guts *g = preg->re_g;
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
pg_wchar *str;
|
||||
int sts;
|
||||
pg_wchar *str;
|
||||
int sts;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef REDEBUG
|
||||
@ -183,19 +184,18 @@ int eflags;
|
||||
eflags = GOODFLAGS(eflags);
|
||||
|
||||
#ifdef MULTIBYTE
|
||||
str = (pg_wchar *)malloc((strlen(string)+1) * sizeof(pg_wchar));
|
||||
if (!str) {
|
||||
return(REG_ESPACE);
|
||||
}
|
||||
(void)pg_mb2wchar((unsigned char *)string,str);
|
||||
str = (pg_wchar *) malloc((strlen(string) + 1) * sizeof(pg_wchar));
|
||||
if (!str)
|
||||
return (REG_ESPACE);
|
||||
(void) pg_mb2wchar((unsigned char *) string, str);
|
||||
if (g->nstates <= CHAR_BIT * sizeof(states1) && !(eflags & REG_LARGE))
|
||||
sts = smatcher(g, str, nmatch, pmatch, eflags);
|
||||
sts = smatcher(g, str, nmatch, pmatch, eflags);
|
||||
else
|
||||
sts = lmatcher(g, str, nmatch, pmatch, eflags);
|
||||
free((char *)str);
|
||||
return(sts);
|
||||
sts = lmatcher(g, str, nmatch, pmatch, eflags);
|
||||
free((char *) str);
|
||||
return (sts);
|
||||
|
||||
# else
|
||||
#else
|
||||
|
||||
if (g->nstates <= CHAR_BIT * sizeof(states1) && !(eflags & REG_LARGE))
|
||||
return smatcher(g, (pg_wchar *) string, nmatch, pmatch, eflags);
|
||||
|
@ -40,7 +40,7 @@
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)regfree.c 8.3 (Berkeley) 3/20/94";
|
||||
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
@ -69,9 +69,8 @@ regex_t *preg;
|
||||
preg->re_magic = 0; /* mark it invalid */
|
||||
g->magic = 0; /* mark it invalid */
|
||||
#ifdef MULTIBYTE
|
||||
if (preg->patsave != NULL) {
|
||||
free((char *)preg->patsave);
|
||||
}
|
||||
if (preg->patsave != NULL)
|
||||
free((char *) preg->patsave);
|
||||
#endif
|
||||
if (g->strip != NULL)
|
||||
free((char *) g->strip);
|
||||
|
Reference in New Issue
Block a user