projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
.
[gnulib.git]
/
regex.c
diff --git
a/regex.c
b/regex.c
index
a6c186c
..
ed4cfc9
100644
(file)
--- a/
regex.c
+++ b/
regex.c
@@
-2,7
+2,7
@@
0.12. (Implements POSIX draft P10003.2/D11.2, except for
internationalization features.)
0.12. (Implements POSIX draft P10003.2/D11.2, except for
internationalization features.)
- Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1994, 1995, 1996, 1997
, 1998
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-2907,14
+2907,14
@@
regex_compile (pattern, size, syntax, bufp)
|| *pending_exact >= (1 << BYTEWIDTH) - (p - p1)
/* If followed by a repetition operator. */
|| *pending_exact >= (1 << BYTEWIDTH) - (p - p1)
/* If followed by a repetition operator. */
- ||
*p == '*' || *p == '^'
+ ||
(p != pend && (*p == '*' || *p == '^'))
|| ((syntax & RE_BK_PLUS_QM)
|| ((syntax & RE_BK_PLUS_QM)
- ? *p == '\\' && (p[1] == '+' || p[1] == '?')
- : (*p == '+' || *p == '?'))
+ ?
p + 1 < pend &&
*p == '\\' && (p[1] == '+' || p[1] == '?')
+ :
p != pend &&
(*p == '+' || *p == '?'))
|| ((syntax & RE_INTERVALS)
&& ((syntax & RE_NO_BK_BRACES)
|| ((syntax & RE_INTERVALS)
&& ((syntax & RE_NO_BK_BRACES)
- ? *p == '{'
- :
(p[0] == '\\' && p[1] == '{')
)))
+ ?
p != pend &&
*p == '{'
+ :
p + 1 < pend && p[0] == '\\' && p[1] == '{'
)))
{
/* Start building a new exactn. */
{
/* Start building a new exactn. */
@@
-3710,13
+3710,13
@@
re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
range = total_size - startpos;
/* If the search isn't to be a backwards one, don't waste time in a
range = total_size - startpos;
/* If the search isn't to be a backwards one, don't waste time in a
- search for a pattern
that must be anchored
. */
+ search for a pattern
anchored at beginning of buffer
. */
if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0)
{
if (startpos > 0)
return -1;
else
if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0)
{
if (startpos > 0)
return -1;
else
- range =
1
;
+ range =
0
;
}
#ifdef emacs
}
#ifdef emacs
@@
-3724,8
+3724,8
@@
re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
don't keep searching past point. */
if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot && range > 0)
{
don't keep searching past point. */
if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot && range > 0)
{
- range = PT - startpos;
- if (range <
=
0)
+ range = PT
_BYTE - BEGV_BYTE
- startpos;
+ if (range < 0)
return -1;
}
#endif /* emacs */
return -1;
}
#endif /* emacs */
@@
-3786,8
+3786,8
@@
re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
/* Written out as an if-else to avoid testing `translate'
inside the loop. */
/* Written out as an if-else to avoid testing `translate'
inside the loop. */
-
if (RE_TRANSLATE_P (translate))
-{
+ if (RE_TRANSLATE_P (translate))
+
{
if (multibyte)
while (range > lim)
{
if (multibyte)
while (range > lim)
{