svn commit: r224971 - user/gabor/tre-integration/contrib/tre/lib
Gabor Kovesdan
gabor at FreeBSD.org
Thu Aug 18 15:31:32 UTC 2011
Author: gabor
Date: Thu Aug 18 15:31:31 2011
New Revision: 224971
URL: http://svn.freebsd.org/changeset/base/224971
Log:
- Support REG_PEND in the fast matching functions
- Fall back to strlen() when the end pointer is invalid
Modified:
user/gabor/tre-integration/contrib/tre/lib/fastmatch.c
user/gabor/tre-integration/contrib/tre/lib/regcomp.c
Modified: user/gabor/tre-integration/contrib/tre/lib/fastmatch.c
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/fastmatch.c Thu Aug 18 15:13:08 2011 (r224970)
+++ user/gabor/tre-integration/contrib/tre/lib/fastmatch.c Thu Aug 18 15:31:31 2011 (r224971)
@@ -121,13 +121,29 @@ tre_fastncomp(fastmatch_t *preg, const c
int
tre_fixcomp(fastmatch_t *preg, const char *regex, int cflags)
{
- return tre_fixncomp(preg, regex, regex ? strlen(regex) : 0, cflags);
+ if (cflags & REG_PEND)
+ {
+ len = (preg->re_endp >= regex)
+ ? preg->re_endp - regex
+ : 0;
+ return tre_fixncomp(preg, regex, len ? strlen(regex) : 0, cflags);
+ }
+ else
+ return tre_fixncomp(preg, regex, regex ? strlen(regex) : 0, cflags);
}
int
tre_fastcomp(fastmatch_t *preg, const char *regex, int cflags)
{
- return tre_fastncomp(preg, regex, regex ? strlen(regex) : 0, cflags);
+ if (cflags & REG_PEND)
+ {
+ len = (preg->re_endp >= regex)
+ ? preg->re_endp - regex
+ : 0;
+ return tre_fastncomp(preg, regex, len ? strlen(regex) : 0, cflags);
+ }
+ else
+ return tre_fastncomp(preg, regex, regex ? strlen(regex) : 0, cflags);
}
int
Modified: user/gabor/tre-integration/contrib/tre/lib/regcomp.c
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/regcomp.c Thu Aug 18 15:13:08 2011 (r224970)
+++ user/gabor/tre-integration/contrib/tre/lib/regcomp.c Thu Aug 18 15:31:31 2011 (r224971)
@@ -118,7 +118,7 @@ tre_regcomp(regex_t *preg, const char *r
len = (preg->re_endp >= regex)
? preg->re_endp - regex
: 0;
- return tre_regncomp(preg, regex, len, cflags);
+ return tre_regncomp(preg, regex, len ? strlen(regex) : 0, cflags);
}
else
return tre_regncomp(preg, regex, regex ? strlen(regex) : 0, cflags);
More information about the svn-src-user
mailing list