Date: Thu, 15 Sep 2011 15:18:58 +0000 (UTC) From: Gabor Kovesdan <gabor@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r225590 - in user/gabor/tre-integration: contrib/tre/lib include Message-ID: <201109151518.p8FFIwsN078927@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gabor Date: Thu Sep 15 15:18:57 2011 New Revision: 225590 URL: http://svn.freebsd.org/changeset/base/225590 Log: - Simplify REG_PEND code and add support for the same in wchar-compliant regcomp() variants Modified: user/gabor/tre-integration/contrib/tre/lib/regcomp.c user/gabor/tre-integration/include/regex.h Modified: user/gabor/tre-integration/contrib/tre/lib/regcomp.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/regcomp.c Thu Sep 15 15:12:18 2011 (r225589) +++ user/gabor/tre-integration/contrib/tre/lib/regcomp.c Thu Sep 15 15:18:57 2011 (r225590) @@ -112,16 +112,8 @@ tre_regncomp(regex_t *preg, const char * int tre_regcomp(regex_t *preg, const char *regex, int cflags) { - size_t len; - - if (cflags & REG_PEND) - { - if (preg->re_endp >= regex) - len = preg->re_endp - regex; - else - len = regex ? strlen(regex) : 0; - return tre_regncomp(preg, regex, len, cflags); - } + if ((cflags & REG_PEND) && (preg->re_endp >= regex)) + return tre_regncomp(preg, regex, preg->re_endp - regex, cflags); else return tre_regncomp(preg, regex, regex ? strlen(regex) : 0, cflags); } @@ -137,6 +129,9 @@ tre_regwncomp(regex_t *preg, const wchar int tre_regwcomp(regex_t *preg, const wchar_t *regex, int cflags) { + if ((cflags & REG_PEND) && (preg->re_wendp >= regex)) + return tre_compile(preg, regex, preg->re_wendp - regex, cflags); + else return tre_compile(preg, regex, regex ? wcslen(regex) : 0, cflags); } #endif /* TRE_WCHAR */ Modified: user/gabor/tre-integration/include/regex.h ============================================================================== --- user/gabor/tre-integration/include/regex.h Thu Sep 15 15:12:18 2011 (r225589) +++ user/gabor/tre-integration/include/regex.h Thu Sep 15 15:18:57 2011 (r225590) @@ -69,6 +69,9 @@ typedef struct { void *shortcut; /* For internal use only. */ void *heur; /* For internal use only. */ const char *re_endp; +#ifdef TRE_WCHAR + const wchar_t *re_wendp; +#endif } regex_t; typedef struct {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109151518.p8FFIwsN078927>