View | Details | Raw Unified | Return to bug 252403
Collapse All | Expand All

(-)lib/libc/regex/regcomp.c (-12 / +14 lines)
Lines 175-188 static char nuls[10]; /* place to point scanner in event of error */ Link Here
175
 * macros for use with parse structure
175
 * macros for use with parse structure
176
 * BEWARE:  these know that the parse structure is named `p' !!!
176
 * BEWARE:  these know that the parse structure is named `p' !!!
177
 */
177
 */
178
#define	PEEK()	(*p->next)
178
#define	PEEK()	(*p->next)
179
#define	PEEK2()	(*(p->next+1))
179
#define	PEEK2()	(*(p->next+1))
180
#define	MORE()	(p->next < p->end)
180
#define	MORE()	(p->end - p->next > 0)
181
#define	MORE2()	(p->next+1 < p->end)
181
#define	MORE2()	(p->end - p->next > 1)
182
#define	SEE(c)	(MORE() && PEEK() == (c))
182
#define	SEE(c)	(MORE() && PEEK() == (c))
183
#define	SEETWO(a, b)	(MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b))
183
#define	SEETWO(a, b)	(MORE2() && PEEK() == (a) && PEEK2() == (b))
184
#define	SEESPEC(a)	(p->bre ? SEETWO('\\', a) : SEE(a))
184
#define	SEESPEC(a)	(p->bre ? SEETWO('\\', a) : SEE(a))
185
#define	EAT(c)	((SEE(c)) ? (NEXT(), 1) : 0)
185
#define	EAT(c)	((SEE(c)) ? (NEXT(), 1) : 0)
186
#define	EATTWO(a, b)	((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
186
#define	EATTWO(a, b)	((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
187
#define	EATSPEC(a)	(p->bre ? EATTWO('\\', a) : EAT(a))
187
#define	EATSPEC(a)	(p->bre ? EATTWO('\\', a) : EAT(a))
188
#define	NEXT()	(p->next++)
188
#define	NEXT()	(p->next++)
Lines 1011-1029 p_bracket(struct parse *p) Link Here
1011
{
1011
{
1012
	cset *cs;
1012
	cset *cs;
1013
	wint_t ch;
1013
	wint_t ch;
1014
1014
1015
	/* Dept of Truly Sickening Special-Case Kludges */
1015
	/* Dept of Truly Sickening Special-Case Kludges */
1016
	if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) {
1016
	if (p->end - p->next > 5) {
1017
		EMIT(OBOW, 0);
1017
		if (strncmp(p->next, "[:<:]]", 6) == 0) {
1018
		NEXTn(6);
1018
			EMIT(OBOW, 0);
1019
		return;
1019
			NEXTn(6);
1020
	}
1020
			return;
1021
	if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) {
1021
		}
1022
		EMIT(OEOW, 0);
1022
		if (strncmp(p->next, "[:>:]]", 6) == 0) {
1023
		NEXTn(6);
1023
			EMIT(OEOW, 0);
1024
		return;
1024
			NEXTn(6);
1025
			return;
1026
		}
1025
	}
1027
	}
1026
1028
1027
	if ((cs = allocset(p)) == NULL)
1029
	if ((cs = allocset(p)) == NULL)
1028
		return;
1030
		return;
1029
1031

Return to bug 252403