Date: Sun, 2 Oct 2011 20:52:28 +0000 (UTC) From: Gabor Kovesdan <gabor@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r225930 - user/gabor/tre-integration/contrib/tre/lib Message-ID: <201110022052.p92KqSW6079023@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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). */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110022052.p92KqSW6079023>