From owner-svn-src-all@freebsd.org Wed Jul 13 18:51:20 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA863B98BE1; Wed, 13 Jul 2016 18:51:20 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D60618EC; Wed, 13 Jul 2016 18:51:20 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6DIpJUL002216; Wed, 13 Jul 2016 18:51:19 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6DIpJKT002214; Wed, 13 Jul 2016 18:51:19 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201607131851.u6DIpJKT002214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Wed, 13 Jul 2016 18:51:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302780 - head/contrib/libgnuregex X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 18:51:20 -0000 Author: ache Date: Wed Jul 13 18:51:19 2016 New Revision: 302780 URL: https://svnweb.freebsd.org/changeset/base/302780 Log: After removing collation for [a-z] ranges in r302512, do it here too. Instead of trying to expand whole range at regcomp() stage as we do, GNU regex allocates separate ranges [start,end] set each character is checked against, so collation is possible and turned on for ranges here. When something like that will be implemented or our obsoleted regex code will be replaced to something like TRE, and in case we decide to use collation in [a-z] ranges, all changes related to r302512 can be backed out, but now we need consistency. Modified: head/contrib/libgnuregex/regcomp.c head/contrib/libgnuregex/regexec.c Modified: head/contrib/libgnuregex/regcomp.c ============================================================================== --- head/contrib/libgnuregex/regcomp.c Wed Jul 13 18:26:05 2016 (r302779) +++ head/contrib/libgnuregex/regcomp.c Wed Jul 13 18:51:19 2016 (r302780) @@ -2664,7 +2664,11 @@ build_range_exp (bitset_t sbcset, bracke return REG_ECOLLATE; cmp_buf[0] = start_wc; cmp_buf[4] = end_wc; +#ifdef __FreeBSD__ + if (wcscmp (cmp_buf, cmp_buf + 4) > 0) +#else if (wcscoll (cmp_buf, cmp_buf + 4) > 0) +#endif return REG_ERANGE; /* Got valid collation sequence values, add them as a new entry. @@ -2706,8 +2710,13 @@ build_range_exp (bitset_t sbcset, bracke for (wc = 0; wc < SBC_MAX; ++wc) { cmp_buf[2] = wc; +#ifdef __FreeBSD__ + if (wcscmp (cmp_buf, cmp_buf + 2) <= 0 + && wcscmp (cmp_buf + 2, cmp_buf + 4) <= 0) +#else if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) +#endif bitset_set (sbcset, wc); } } Modified: head/contrib/libgnuregex/regexec.c ============================================================================== --- head/contrib/libgnuregex/regexec.c Wed Jul 13 18:26:05 2016 (r302779) +++ head/contrib/libgnuregex/regexec.c Wed Jul 13 18:51:19 2016 (r302780) @@ -3964,8 +3964,13 @@ check_node_accept_bytes (const re_dfa_t { cmp_buf[0] = cset->range_starts[i]; cmp_buf[4] = cset->range_ends[i]; +#ifdef __FreeBSD__ + if (wcscmp (cmp_buf, cmp_buf + 2) <= 0 + && wcscmp (cmp_buf + 2, cmp_buf + 4) <= 0) +#else if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) +#endif { match_len = char_len; goto check_node_accept_bytes_match;