/* True if `size1' is non-NULL and PTR is pointing anywhere inside
`string1' or just past its end. This works if PTR is NULL, which is
a good thing. */
-#define FIRST_STRING_P(ptr) \
+#define FIRST_STRING_P(ptr) \
(size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
/* (Re)Allocate N items of type T using malloc, or fail. */
#define DEBUG_PRINT2(x1, x2) printf(x1, x2)
#define DEBUG_PRINT3(x1, x2, x3) printf(x1, x2, x3)
#define DEBUG_PRINT4(x1, x2, x3, x4) printf(x1, x2, x3, x4)
-#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
+#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
print_partial_compiled_pattern(s, e)
#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
print_double_string (w, s1, sz1, s2, sz2)
((int) (fail_stack).size > re_max_failures * MAX_FAILURE_ITEMS \
? 0 \
: ((fail_stack).stack = (fail_stack_elt_t *) \
- REGEX_REALLOCATE_STACK ((fail_stack).stack, \
- (fail_stack).size * sizeof (fail_stack_elt_t), \
- ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \
+ REGEX_REALLOCATE_STACK ((fail_stack).stack, \
+ (fail_stack).size * sizeof (fail_stack_elt_t), \
+ ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \
\
(fail_stack).stack == NULL \
? 0 \
- : ((fail_stack).size <<= 1, \
- 1)))
+ : ((fail_stack).size <<= 1, \
+ 1)))
/* Push pointer POINTER on FAIL_STACK.
Return 1 if was able to do so and 0 if ran out of memory allocating
/* We actually push this many items. */
#define NUM_FAILURE_ITEMS \
- ((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS \
+ ((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS \
+ NUM_NONREG_ITEMS)
/* How many items can still be added to the stack without overflowing it. */
`pend', `string1', `size1', `string2', and `size2'. */
#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, \
- regstart, regend, reg_info) \
+ regstart, regend, reg_info) \
do { \
int this_reg; \
const unsigned char *string_temp; \
#define PATFETCH_RAW(c) \
do {if (p == pend) return REG_EEND; \
assert (p < pend); \
- c = charptr_emchar (p); \
+ c = charptr_emchar (p); \
INC_CHARPTR (p); \
} while (0)
#endif
/* Get the next unsigned number in the uncompiled pattern. */
-#define GET_UNSIGNED_NUMBER(num) \
+#define GET_UNSIGNED_NUMBER(num) \
{ if (p != pend) \
{ \
- PATFETCH (c); \
- while (ISDIGIT (c)) \
- { \
- if (num < 0) \
- num = 0; \
- num = num * 10 + c - '0'; \
- if (p == pend) \
- break; \
- PATFETCH (c); \
- } \
- } \
+ PATFETCH (c); \
+ while (ISDIGIT (c)) \
+ { \
+ if (num < 0) \
+ num = 0; \
+ num = num * 10 + c - '0'; \
+ if (p == pend) \
+ break; \
+ PATFETCH (c); \
+ } \
+ } \
}
#define CHAR_CLASS_MAX_LENGTH 9 /* Namely, `multibyte'. */
`used' is set to the length of the compiled pattern;
`fastmap_accurate' is zero;
`re_ngroups' is the number of groups/subexpressions (including shy
- groups) in PATTERN;
+ groups) in PATTERN;
`re_nsub' is the number of non-shy groups in PATTERN;
`not_bol' and `not_eol' are zero;
character class. */
else if (syntax & RE_CHAR_CLASSES &&
- c == '[' && *p == ':') {
+ c == '[' && *p == ':') {
/* Leave room for the null. */
char str[CHAR_CLASS_MAX_LENGTH + 1];
/* Convert external to internal as soon
as possible. */
reg = bufp->external_to_internal_register[reg];
-
+
/* Can't back reference to a
subexpression if inside it. */
if (group_in_compile_stack(
/* Call before fetching a character with *d. This switches over to
string2 if necessary. */
#define REGEX_PREFETCH() \
- while (d == dend) \
+ while (d == dend) \
{ \
/* End of string2 => fail. */ \
- if (dend == end_match_2) \
- goto fail; \
- /* End of string1 => advance to string2. */ \
+ if (dend == end_match_2) \
+ goto fail; \
+ /* End of string1 => advance to string2. */ \
d = string2; \
dend = end_match_2; \
}
/* Test if CH is a word-constituent character. (XEmacs change) */
#define WORDCHAR_P_UNSAFE(ch) \
(SYNTAX_UNSAFE (XCHAR_TABLE (regex_emacs_buffer->mirror_syntax_table), \
- ch) == Sword)
+ ch) == Sword)
/* Free everything we malloc. */
#ifdef MATCH_MAY_ALLOCATE
if (regs && !bufp->no_sub) {
/* Have the register data arrays been
allocated? */
- if (bufp->regs_allocated == REGS_UNALLOCATED) {
- /* No. So allocate them with malloc.
+ if (bufp->regs_allocated == REGS_UNALLOCATED) {
+ /* No. So allocate them with malloc.
We need one extra element beyond
`num_regs' for the `-1' marker GNU
code uses. */
return -2;
}
bufp->regs_allocated = REGS_REALLOCATE;
- } else if (bufp->regs_allocated == REGS_REALLOCATE) {
- /* Yes. If we need more elements than were already
+ } else if (bufp->regs_allocated == REGS_REALLOCATE) {
+ /* Yes. If we need more elements than were already
allocated, reallocate them. If we need fewer, just
leave it alone. */
if (regs->num_regs < num_nonshy_regs + 1) {
if (!FAIL_STACK_EMPTY()) {
/* A restart point is known. Restore to that state. */
DEBUG_PRINT1("\nFAIL:\n");
- POP_FAILURE_POINT(d, p, lowest_active_reg,
- highest_active_reg, regstart, regend,
+ POP_FAILURE_POINT(d, p, lowest_active_reg,
+ highest_active_reg, regstart, regend,
reg_info);
/* If this failure point is a dummy, try the next one. */
return -1; /* Failure to match. */
} /* re_match_2 */
+
\f
/* Subroutine definitions for re_match_2. */
case set_number_at:
p1 += 4;
+ break;
default:
/* All other opcodes mean we cannot match the empty string. */
msg_size = strlen(msg) + 1; /* Includes the null. */
if (errbuf_size != 0) {
- strncpy(errbuf, msg, errbuf_size - 1);
- errbuf[errbuf_size-1]='\0';
+ strncpy(errbuf, msg, errbuf_size - 1);
+ errbuf[errbuf_size-1]='\0';
}
return msg_size;