svn commit: r225302 - in user/gabor/tre-integration:
contrib/tre/lib include
Gabor Kovesdan
gabor at FreeBSD.org
Wed Aug 31 23:25:07 UTC 2011
Author: gabor
Date: Wed Aug 31 23:25:06 2011
New Revision: 225302
URL: http://svn.freebsd.org/changeset/base/225302
Log:
- Actually leave pmatch untouched if REG_NOSUB is passed to regcomp()
Modified:
user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c
user/gabor/tre-integration/include/fastmatch.h
Modified: user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Wed Aug 31 23:20:00 2011 (r225301)
+++ user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Wed Aug 31 23:25:06 2011 (r225302)
@@ -384,6 +384,7 @@ static int fastcmp(const void *, const v
fg->icase = (cflags & REG_ICASE); \
fg->word = (cflags & REG_WORD); \
fg->newline = (cflags & REG_NEWLINE); \
+ fg->nosub = (cflags & REG_NOSUB); \
\
if (n == 0) \
{ \
@@ -602,8 +603,11 @@ tre_match_fast(const fastmatch_t *fg, co
if (fg->matchall)
{
- pmatch[0].rm_so = 0;
- pmatch[0].rm_eo = len;
+ if (!fg->nosub)
+ {
+ pmatch[0].rm_so = 0;
+ pmatch[0].rm_eo = len;
+ }
return REG_OK;
}
@@ -651,8 +655,11 @@ tre_match_fast(const fastmatch_t *fg, co
{
if (fg->word && !IS_ON_WORD_BOUNDARY)
return ret;
- pmatch[0].rm_so = j;
- pmatch[0].rm_eo = j + (type == STR_WIDE ? fg->wlen : fg->len);
+ if (!fg->nosub)
+ {
+ pmatch[0].rm_so = j;
+ pmatch[0].rm_eo = j + (type == STR_WIDE ? fg->wlen : fg->len);
+ }
return REG_OK;
}
}
@@ -672,8 +679,11 @@ tre_match_fast(const fastmatch_t *fg, co
CHECK_BOL_ANCHOR;
if (fg->eol)
CHECK_EOL_ANCHOR;
- pmatch[0].rm_so = j;
- pmatch[0].rm_eo = j + ((type == STR_WIDE) ? fg->wlen : fg->len);
+ if (!fg->nosub)
+ {
+ pmatch[0].rm_so = j;
+ pmatch[0].rm_eo = j + ((type == STR_WIDE) ? fg->wlen : fg->len);
+ }
return REG_OK;
}
else if (mismatch > 0)
Modified: user/gabor/tre-integration/include/fastmatch.h
==============================================================================
--- user/gabor/tre-integration/include/fastmatch.h Wed Aug 31 23:20:00 2011 (r225301)
+++ user/gabor/tre-integration/include/fastmatch.h Wed Aug 31 23:25:06 2011 (r225302)
@@ -27,6 +27,7 @@ typedef struct {
bool word;
bool icase;
bool newline;
+ bool nosub;
bool matchall;
} fastmatch_t;
More information about the svn-src-user
mailing list