Functional equivalence with pre-patched package.
This commit is contained in:
parent
9fa0ec14fd
commit
2bb2860efe
@ -1,5 +1,5 @@
|
|||||||
--- grep-2.5.1/src/search.c.egf-speedup 2004-11-04 14:34:20.883140606 +0000
|
--- grep-2.5.1/src/search.c.egf-speedup 2004-11-05 12:50:25.934736684 +0000
|
||||||
+++ grep-2.5.1/src/search.c 2004-11-04 14:53:29.991266613 +0000
|
+++ grep-2.5.1/src/search.c 2004-11-05 13:52:33.819394140 +0000
|
||||||
@@ -70,9 +70,6 @@
|
@@ -70,9 +70,6 @@
|
||||||
call the regexp matcher at all. */
|
call the regexp matcher at all. */
|
||||||
static int kwset_exact_matches;
|
static int kwset_exact_matches;
|
||||||
@ -79,7 +79,7 @@
|
|||||||
#endif /* MBS_SUPPORT */
|
#endif /* MBS_SUPPORT */
|
||||||
|
|
||||||
buflim = buf + size;
|
buflim = buf + size;
|
||||||
@@ -373,18 +319,42 @@
|
@@ -373,18 +319,48 @@
|
||||||
if (kwset)
|
if (kwset)
|
||||||
{
|
{
|
||||||
/* Find a possible match using the KWset matcher. */
|
/* Find a possible match using the KWset matcher. */
|
||||||
@ -96,14 +96,20 @@
|
|||||||
+ while (bytes_left)
|
+ while (bytes_left)
|
||||||
+ {
|
+ {
|
||||||
+ size_t len = mbrlen (beg, bytes_left, &mbs);
|
+ size_t len = mbrlen (beg, bytes_left, &mbs);
|
||||||
+ if (len == (size_t) -1 || len == (size_t) -2 || len == 0)
|
+ if (len == (size_t) -1 || len == 0)
|
||||||
+ {
|
+ {
|
||||||
+ /* Incomplete character. */
|
+ /* Incomplete character: treat as single-byte. */
|
||||||
+ memset (&mbs, '\0', sizeof (mbstate_t));
|
+ memset (&mbs, '\0', sizeof (mbstate_t));
|
||||||
+ beg += bytes_left;
|
+ beg++;
|
||||||
+ break;
|
+ bytes_left--;
|
||||||
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ if (len == (size_t) -2)
|
||||||
|
+ /* Offset points inside multibyte character:
|
||||||
|
+ * no good. */
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
+ beg += len;
|
+ beg += len;
|
||||||
+ bytes_left -= len;
|
+ bytes_left -= len;
|
||||||
+ }
|
+ }
|
||||||
@ -124,7 +130,7 @@
|
|||||||
while (beg > buf && beg[-1] != eol)
|
while (beg > buf && beg[-1] != eol)
|
||||||
--beg;
|
--beg;
|
||||||
if (kwsm.index < kwset_exact_matches)
|
if (kwsm.index < kwset_exact_matches)
|
||||||
@@ -395,13 +365,41 @@
|
@@ -395,13 +371,47 @@
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* No good fixed strings; start with DFA. */
|
/* No good fixed strings; start with DFA. */
|
||||||
@ -142,14 +148,20 @@
|
|||||||
+ while (bytes_left)
|
+ while (bytes_left)
|
||||||
+ {
|
+ {
|
||||||
+ size_t len = mbrlen (beg, bytes_left, &mbs);
|
+ size_t len = mbrlen (beg, bytes_left, &mbs);
|
||||||
+ if (len == (size_t) -1 || len == (size_t) -2 || len == 0)
|
+ if (len == (size_t) -1 || len == 0)
|
||||||
+ {
|
+ {
|
||||||
+ /* Incomplete character. */
|
+ /* Incomplete character: treat as single-byte. */
|
||||||
+ memset (&mbs, '\0', sizeof (mbstate_t));
|
+ memset (&mbs, '\0', sizeof (mbstate_t));
|
||||||
+ beg += bytes_left;
|
+ beg++;
|
||||||
+ break;
|
+ bytes_left--;
|
||||||
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ if (len == (size_t) -2)
|
||||||
|
+ /* Offset points inside multibyte character:
|
||||||
|
+ * no good. */
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
+ beg += len;
|
+ beg += len;
|
||||||
+ bytes_left -= len;
|
+ bytes_left -= len;
|
||||||
+ }
|
+ }
|
||||||
@ -166,7 +178,7 @@
|
|||||||
while (beg > buf && beg[-1] != eol)
|
while (beg > buf && beg[-1] != eol)
|
||||||
--beg;
|
--beg;
|
||||||
}
|
}
|
||||||
@@ -469,15 +467,6 @@
|
@@ -469,15 +479,6 @@
|
||||||
} /* for (beg = end ..) */
|
} /* for (beg = end ..) */
|
||||||
|
|
||||||
failure:
|
failure:
|
||||||
@ -182,7 +194,7 @@
|
|||||||
return (size_t) -1;
|
return (size_t) -1;
|
||||||
|
|
||||||
success_in_beg_and_end:
|
success_in_beg_and_end:
|
||||||
@@ -486,15 +475,6 @@
|
@@ -486,15 +487,6 @@
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
success_in_start_and_len:
|
success_in_start_and_len:
|
||||||
@ -198,7 +210,7 @@
|
|||||||
*match_size = len;
|
*match_size = len;
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
@@ -531,17 +511,8 @@
|
@@ -531,17 +523,8 @@
|
||||||
struct kwsmatch kwsmatch;
|
struct kwsmatch kwsmatch;
|
||||||
size_t ret_val;
|
size_t ret_val;
|
||||||
#ifdef MBS_SUPPORT
|
#ifdef MBS_SUPPORT
|
||||||
@ -218,7 +230,7 @@
|
|||||||
#endif /* MBS_SUPPORT */
|
#endif /* MBS_SUPPORT */
|
||||||
|
|
||||||
for (beg = buf; beg <= buf + size; ++beg)
|
for (beg = buf; beg <= buf + size; ++beg)
|
||||||
@@ -550,8 +521,28 @@
|
@@ -550,8 +533,33 @@
|
||||||
if (offset == (size_t) -1)
|
if (offset == (size_t) -1)
|
||||||
goto failure;
|
goto failure;
|
||||||
#ifdef MBS_SUPPORT
|
#ifdef MBS_SUPPORT
|
||||||
@ -230,14 +242,19 @@
|
|||||||
+ while (bytes_left)
|
+ while (bytes_left)
|
||||||
+ {
|
+ {
|
||||||
+ size_t len = mbrlen (beg, bytes_left, &mbs);
|
+ size_t len = mbrlen (beg, bytes_left, &mbs);
|
||||||
+ if (len == (size_t) -1 || len == (size_t) -2 || len == 0)
|
+ if (len == (size_t) -1 || len == 0)
|
||||||
+ {
|
+ {
|
||||||
+ /* Incomplete character. */
|
+ /* Incomplete character: treat as single-byte. */
|
||||||
+ memset (&mbs, '\0', sizeof (mbstate_t));
|
+ memset (&mbs, '\0', sizeof (mbstate_t));
|
||||||
+ beg += bytes_left;
|
+ beg++;
|
||||||
+ break;
|
+ bytes_left--;
|
||||||
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ if (len == (size_t) -2)
|
||||||
|
+ /* Offset points inside multibyte character: no good. */
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
+ beg += len;
|
+ beg += len;
|
||||||
+ bytes_left -= len;
|
+ bytes_left -= len;
|
||||||
+ }
|
+ }
|
||||||
@ -249,7 +266,7 @@
|
|||||||
#endif /* MBS_SUPPORT */
|
#endif /* MBS_SUPPORT */
|
||||||
beg += offset;
|
beg += offset;
|
||||||
len = kwsmatch.size[0];
|
len = kwsmatch.size[0];
|
||||||
@@ -587,6 +578,31 @@
|
@@ -587,6 +595,36 @@
|
||||||
if (offset == -1) {
|
if (offset == -1) {
|
||||||
break; /* Try a different anchor. */
|
break; /* Try a different anchor. */
|
||||||
}
|
}
|
||||||
@ -260,15 +277,20 @@
|
|||||||
+ while (bytes_left)
|
+ while (bytes_left)
|
||||||
+ {
|
+ {
|
||||||
+ size_t len = mbrlen (beg, bytes_left, &mbs);
|
+ size_t len = mbrlen (beg, bytes_left, &mbs);
|
||||||
+ if (len == (size_t) -1 || len == (size_t) -2 ||
|
+ if (len == (size_t) -1 || len == 0)
|
||||||
+ len == 0)
|
|
||||||
+ {
|
+ {
|
||||||
+ /* Incomplete character. */
|
+ /* Incomplete character: treat as single-byte. */
|
||||||
+ memset (&mbs, '\0', sizeof (mbstate_t));
|
+ memset (&mbs, '\0', sizeof (mbstate_t));
|
||||||
+ beg += bytes_left;
|
+ beg++;
|
||||||
+ break;
|
+ bytes_left--;
|
||||||
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ if (len == (size_t) -2)
|
||||||
|
+ /* Offset points inside multibyte character:
|
||||||
|
+ * no good. */
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
+ beg += len;
|
+ beg += len;
|
||||||
+ bytes_left -= len;
|
+ bytes_left -= len;
|
||||||
+ }
|
+ }
|
||||||
@ -281,7 +303,7 @@
|
|||||||
beg += offset;
|
beg += offset;
|
||||||
len = kwsmatch.size[0];
|
len = kwsmatch.size[0];
|
||||||
}
|
}
|
||||||
@@ -597,20 +613,30 @@
|
@@ -597,20 +635,30 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
failure:
|
failure:
|
||||||
@ -321,7 +343,7 @@
|
|||||||
while (buf < beg && beg[-1] != eol)
|
while (buf < beg && beg[-1] != eol)
|
||||||
--beg;
|
--beg;
|
||||||
len = end - beg;
|
len = end - beg;
|
||||||
@@ -618,15 +644,6 @@
|
@@ -618,15 +666,6 @@
|
||||||
|
|
||||||
success_in_beg_and_len:
|
success_in_beg_and_len:
|
||||||
*match_size = len;
|
*match_size = len;
|
||||||
|
Loading…
Reference in New Issue
Block a user