Date: Thu, 16 Feb 2012 14:54:20 +0000 (UTC) From: Gabor Kovesdan <gabor@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r231824 - in user/gabor/tre-integration: contrib/tre/lib include Message-ID: <201202161454.q1GEsKTN021528@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gabor Date: Thu Feb 16 14:54:20 2012 New Revision: 231824 URL: http://svn.freebsd.org/changeset/base/231824 Log: - Take wmsearch_t instead of mregex_t because the fields of the latter belong to higher level code - In mregex_t, it is necessary to store the number of fragments that will be used for multiple pattern heuristic matching Modified: user/gabor/tre-integration/contrib/tre/lib/tre-mfastmatch.c user/gabor/tre-integration/include/mregex.h Modified: user/gabor/tre-integration/contrib/tre/lib/tre-mfastmatch.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-mfastmatch.c Thu Feb 16 14:44:52 2012 (r231823) +++ user/gabor/tre-integration/contrib/tre/lib/tre-mfastmatch.c Thu Feb 16 14:54:20 2012 (r231824) @@ -167,11 +167,10 @@ */ int -tre_wmcomp(mregex_t *preg, size_t nr, const char *regex[], +tre_wmcomp(wmsearch_t *wm, size_t nr, const tre_char_t *regex[], size_t n[], int cflags) { wmentry_t *entry = NULL; - wmsearch_t *wm = NULL; int err; #ifdef TRE_WCHAR char **bregex; @@ -179,7 +178,6 @@ tre_wmcomp(mregex_t *preg, size_t nr, co #endif ALLOC(wm, sizeof(wmsearch_t)); - preg->n = nr; #ifdef TRE_WCHAR PROC_WM_WIDE(regex, n); @@ -216,7 +214,6 @@ tre_wmcomp(mregex_t *preg, size_t nr, co SAVE_PATTERNS; #endif - preg->searchdata = &wm; return REG_OK; fail: #ifdef TRE_WCHAR @@ -295,13 +292,12 @@ fail: int tre_wmexec(const void *str, size_t len, tre_str_type_t type, size_t nmatch, regmatch_t pmatch[], int eflags, - const mregex_t *preg, regmatch_t *match) + const wmsearch_t *wm, regmatch_t *match) { - wmsearch_t *wm = preg->wm; wmentry_t *s_entry, *p_entry; tre_char_t *wide_str = str; char *byte_str = str; - size_t pos = preg->m; + size_t pos = (type == STR_WIDE) ? wm->wm : wm->m; size_t shift; int ret; int err = REG_NOMATCH; @@ -327,9 +323,8 @@ finish: } void -wmfree(mregex_t *preg) +tre_wmfree(wmsearch_t *wm) { - wmsearch_t wm = preg->wm; if (wm->hash) hashtable_free(wm->hash); Modified: user/gabor/tre-integration/include/mregex.h ============================================================================== --- user/gabor/tre-integration/include/mregex.h Thu Feb 16 14:44:52 2012 (r231823) +++ user/gabor/tre-integration/include/mregex.h Thu Feb 16 14:54:20 2012 (r231824) @@ -8,6 +8,7 @@ typedef struct { size_t k; /* Number of patterns */ regex_t *patterns; /* regex_t structure for each pattern */ + size_t mfrag; /* Number of fragments */ void *searchdata; } mregex_t;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202161454.q1GEsKTN021528>