#define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
-#undef MAX
-#undef MIN
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#ifndef emacs
+# undef max
+# undef min
+# define max(a, b) ((a) > (b) ? (a) : (b))
+# define min(a, b) ((a) < (b) ? (a) : (b))
+#endif
/* Type of source-pattern and string chars. */
#ifdef _MSC_VER
: ((fail_stack).stack \
= REGEX_REALLOCATE_STACK ((fail_stack).stack, \
(fail_stack).size * sizeof (fail_stack_elt_t), \
- MIN (re_max_failures * TYPICAL_FAILURE_SIZE, \
+ min (re_max_failures * TYPICAL_FAILURE_SIZE, \
((fail_stack).size * sizeof (fail_stack_elt_t) \
* FAIL_STACK_GROWTH_FACTOR))), \
\
(fail_stack).stack == NULL \
? 0 \
: ((fail_stack).size \
- = (MIN (re_max_failures * TYPICAL_FAILURE_SIZE, \
+ = (min (re_max_failures * TYPICAL_FAILURE_SIZE, \
((fail_stack).size * sizeof (fail_stack_elt_t) \
* FAIL_STACK_GROWTH_FACTOR)) \
/ sizeof (fail_stack_elt_t)), \
static boolean at_endline_loc_p (re_char *p, re_char *pend,
reg_syntax_t syntax);
static re_char *skip_one_char (re_char *p);
-static int analyse_first (re_char *p, re_char *pend,
+static int analyze_first (re_char *p, re_char *pend,
char *fastmap, const int multibyte);
/* Fetch the next character in the uncompiled pattern, with no
cmin = c, cmax = c;
else
{
- cmin = MIN (cmin, c);
- cmax = MAX (cmax, c);
+ cmin = min (cmin, c);
+ cmax = max (cmax, c);
}
}
}
size_t startoffset = 0;
re_opcode_t ofj =
/* Check if the loop can match the empty string. */
- (simple || !analyse_first (laststart, b, NULL, 0))
+ (simple || !analyze_first (laststart, b, NULL, 0))
? on_failure_jump : on_failure_jump_loop;
assert (skip_one_char (laststart) <= b);
GET_BUFFER_SPACE (7); /* We might use less. */
if (many_times_ok)
{
- boolean emptyp = analyse_first (laststart, b, NULL, 0);
+ boolean emptyp = analyze_first (laststart, b, NULL, 0);
/* The non-greedy multiple match looks like
a repeat..until: we only need a conditional jump
#else /* emacs */
if (c < 128)
{
- ch = MIN (127, c1);
+ ch = min (127, c1);
SETUP_ASCII_RANGE (range_table_work, c, ch);
c = ch + 1;
if (CHAR_BYTE8_P (c1))
return false;
}
\f
-/* analyse_first.
+/* analyze_first.
If fastmap is non-NULL, go through the pattern and fill fastmap
with all the possible leading chars. If fastmap is NULL, don't
bother filling it up (obviously) and only return whether the
Return -1 if fastmap was not updated accurately. */
static int
-analyse_first (const_re_char *p, const_re_char *pend, char *fastmap,
+analyze_first (const_re_char *p, const_re_char *pend, char *fastmap,
const int multibyte)
{
int j, k;
{ /* We have to look down both arms.
We first go down the "straight" path so as to minimize
stack usage when going through alternatives. */
- int r = analyse_first (p, pend, fastmap, multibyte);
+ int r = analyze_first (p, pend, fastmap, multibyte);
if (r) return r;
p += j;
}
/* We reached the end without matching anything. */
return 1;
-} /* analyse_first */
+} /* analyze_first */
\f
/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible
memset (fastmap, 0, 1 << BYTEWIDTH); /* Assume nothing's valid. */
bufp->fastmap_accurate = 1; /* It will be when we're done. */
- analysis = analyse_first (bufp->buffer, bufp->buffer + bufp->used,
+ analysis = analyze_first (bufp->buffer, bufp->buffer + bufp->used,
fastmap, RE_MULTIBYTE_P (bufp));
bufp->can_be_null = (analysis != 0);
return 0;
{ /* No. So allocate them with malloc. We need one
extra element beyond `num_regs' for the `-1' marker
GNU code uses. */
- regs->num_regs = MAX (RE_NREGS, num_regs + 1);
+ regs->num_regs = max (RE_NREGS, num_regs + 1);
regs->start = TALLOC (regs->num_regs, regoff_t);
regs->end = TALLOC (regs->num_regs, regoff_t);
if (regs->start == NULL || regs->end == NULL)
/* Go through the first `min (num_regs, regs->num_regs)'
registers, since that is all we initialized. */
- for (reg = 1; reg < MIN (num_regs, regs->num_regs); reg++)
+ for (reg = 1; reg < min (num_regs, regs->num_regs); reg++)
{
if (REG_UNSET (regstart[reg]) || REG_UNSET (regend[reg]))
regs->start[reg] = regs->end[reg] = -1;