From owner-svn-src-user@FreeBSD.ORG Sun Oct 2 20:52:28 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9A5A1065672; Sun, 2 Oct 2011 20:52:28 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B956E8FC14; Sun, 2 Oct 2011 20:52:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p92KqStG079025; Sun, 2 Oct 2011 20:52:28 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p92KqSW6079023; Sun, 2 Oct 2011 20:52:28 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201110022052.p92KqSW6079023@svn.freebsd.org> From: Gabor Kovesdan Date: Sun, 2 Oct 2011 20:52:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225930 - user/gabor/tre-integration/contrib/tre/lib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Oct 2011 20:52:28 -0000 Author: gabor Date: Sun Oct 2 20:52:28 2011 New Revision: 225930 URL: http://svn.freebsd.org/changeset/base/225930 Log: - Collating elements and equivalence classes are not necessarily fixed-length, so fall back to the full NFA on embedded brackets Modified: user/gabor/tre-integration/contrib/tre/lib/tre-heuristic.c Modified: user/gabor/tre-integration/contrib/tre/lib/tre-heuristic.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-heuristic.c Sun Oct 2 19:24:13 2011 (r225929) +++ user/gabor/tre-integration/contrib/tre/lib/tre-heuristic.c Sun Oct 2 20:52:28 2011 (r225930) @@ -39,13 +39,6 @@ #include "tre-internal.h" #include "xmalloc.h" -#ifdef TRE_WCHAR -#define tre_strnstr(big, s1, little, s2) \ - memmem(big, s1 * sizeof(tre_char_t), little, s2 * sizeof(tre_char_t)) -#else -#define tre_strnstr(big, s1, little, s2) strnstr(big, little, s1) -#endif - /* * A full regex implementation requires a finite state automaton * and using an automaton is always about a trade-off. A DFA is @@ -84,38 +77,21 @@ #define PARSE_BRACKETS \ { \ - tre_char_t *tmp; \ - \ i++; \ if (regex[i] == TRE_CHAR('^')) \ i++; \ if (regex[i] == TRE_CHAR(']')) \ i++; \ \ - do \ - { \ - tmp = tre_strnstr(®ex[i], len - i, TRE_CHAR("[.].]"), 5); \ - if (tmp) \ - { \ - i += (tmp - regex); \ - regex = tmp; \ - } \ - } while (tmp != NULL); \ - \ - do \ + for (; i < len; i++) \ { \ - tmp = tre_strnstr(®ex[i], len - i, TRE_CHAR("[=]=]"), 5); \ - if (tmp) \ - { \ - i += (tmp - regex); \ - regex = tmp; \ - } \ - } while (tmp != NULL); \ - \ - for (; (i != TRE_CHAR(']')) && (i < len); i++); \ + if (regex[i] == TRE_CHAR('[')) \ + return REG_BADPAT; \ + if (regex[i] == TRE_CHAR(']')) \ + break; \ + } \ } - /* * Finishes a segment (fixed-length text fragment). */