Date: Fri, 24 Feb 2012 13:22:57 +0000 (UTC) From: Gabor Kovesdan <gabor@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r232113 - user/gabor/tre-integration/contrib/tre/lib Message-ID: <201202241322.q1ODMvRl060708@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gabor Date: Fri Feb 24 13:22:57 2012 New Revision: 232113 URL: http://svn.freebsd.org/changeset/base/232113 Log: - Avoid calling strlen()/wcslen() if REG_STARTEND is specified Modified: user/gabor/tre-integration/contrib/tre/lib/mregexec.c user/gabor/tre-integration/contrib/tre/lib/regexec.c Modified: user/gabor/tre-integration/contrib/tre/lib/mregexec.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/mregexec.c Fri Feb 24 13:13:55 2012 (r232112) +++ user/gabor/tre-integration/contrib/tre/lib/mregexec.c Fri Feb 24 13:22:57 2012 (r232113) @@ -294,14 +294,15 @@ tre_mregnexec(const mregex_t *preg, cons CALL_WITH_OFFSET(tre_mmatch(&str[offset], slen, type, nmatch, pmatch, eflags, preg)); else - return tre_mmatch(str, len, type, nmatch, pmatch, eflags, preg); + return tre_mmatch(str, len == (unsigned)-1 ? strlen(str) : len, + type, nmatch, pmatch, eflags, preg); } int tre_mregexec(const mregex_t *preg, const char *str, size_t nmatch, regmatch_t pmatch[], int eflags) { - return tre_mregnexec(preg, str, strlen(str), nmatch, pmatch, eflags); + return tre_mregnexec(preg, str, (unsigned)-1, nmatch, pmatch, eflags); } @@ -317,14 +318,15 @@ tre_mregwnexec(const mregex_t *preg, con CALL_WITH_OFFSET(tre_mmatch(&str[offset], slen, type, nmatch, pmatch, eflags, preg)); else - return tre_mmatch(str, len, STR_WIDE, nmatch, pmatch, eflags, preg); + return tre_mmatch(str, len == (unsigned)-1 ? tre_strlen(str) : len, + STR_WIDE, nmatch, pmatch, eflags, preg); } int tre_mregwexec(const mregex_t *preg, const wchar_t *str, size_t nmatch, regmatch_t pmatch[], int eflags) { - return tre_mregwnexec(preg, str, tre_strlen(str), nmatch, pmatch, eflags); + return tre_mregwnexec(preg, str, (unsigned)-1, nmatch, pmatch, eflags); } #endif /* TRE_WCHAR */ Modified: user/gabor/tre-integration/contrib/tre/lib/regexec.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/regexec.c Fri Feb 24 13:13:55 2012 (r232112) +++ user/gabor/tre-integration/contrib/tre/lib/regexec.c Fri Feb 24 13:22:57 2012 (r232113) @@ -410,7 +410,8 @@ tre_regnexec(const regex_t *preg, const CALL_WITH_OFFSET(tre_match(preg, &str[offset], slen, type, nmatch, pmatch, eflags)); else - return tre_match(preg, str, len, type, nmatch, pmatch, eflags); + return tre_match(preg, str, len == (unsigned)-1 ? strlen(str) : len, + type, nmatch, pmatch, eflags); } int @@ -433,7 +434,8 @@ tre_regwnexec(const regex_t *preg, const CALL_WITH_OFFSET(tre_match(preg, &str[offset], slen, type, nmatch, pmatch, eflags)); else - return tre_match(preg, str, len, STR_WIDE, nmatch, pmatch, eflags); + return tre_match(preg, str, len == (unsigned)-1 ? strlen(str) : len, + STR_WIDE, nmatch, pmatch, eflags); } int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202241322.q1ODMvRl060708>