gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-796


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-796-ge55b87a
Date: Sun, 24 Jan 2016 04:04:15 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, gawk-4.1-stable has been updated
       via  e55b87aacc156799e1063f4bff810fa4730b3962 (commit)
      from  2949f4b38cc7ecc14dfca32cbb719e43e95aa940 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=e55b87aacc156799e1063f4bff810fa4730b3962

commit e55b87aacc156799e1063f4bff810fa4730b3962
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Jan 24 06:03:36 2016 +0200

    Parse [x] as x in single-byte locales even if x is an encoding error.

diff --git a/ChangeLog b/ChangeLog
index 005a51c..1b8fbeb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-01-24         Arnold D. Robbins     <address@hidden>
+
+       Regex: treat [x] as x if x is a unibyte encoding error.
+       This change removes an ifdef GAWK.
+
+       * lib/regcomp.c (parse_byte) [ !_LIBC && RE_ENABLE_I18N]: New function.
+       (build_range_exp) [ !_LIBC && RE_ENABLE_I18N]: Use it.
+       From Paul Eggert  <address@hidden>.
+
 2016-01-22         Arnold D. Robbins     <address@hidden>
 
        * regexec.c (prune_impossible_nodes): Remove all attributes, on
diff --git a/regcomp.c b/regcomp.c
index 4ddbade..4541037 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2694,6 +2694,19 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, 
re_dfa_t *dfa,
 #define BRACKET_NAME_BUF_SIZE 32
 
 #ifndef _LIBC
+
+# ifdef RE_ENABLE_I18N
+/* Convert the byte B to the corresponding wide character.  In a
+   unibyte locale, treat B as itself if it is an encoding error.
+   In a multibyte locale, return WEOF if B is an encoding error.  */
+static wint_t
+parse_byte (unsigned char b, re_charset_t *mbcset)
+{
+  wint_t wc = __btowc (b);
+  return wc == WEOF && !mbcset ? b : wc;
+}
+#endif
+
   /* Local function for parse_bracket_exp only used in case of NOT _LIBC.
      Build the range expression which starts from START_ELEM, and ends
      at END_ELEM.  The result are written to MBCSET and SBCSET.
@@ -2739,22 +2752,10 @@ build_range_exp (reg_syntax_t syntax, bitset_t sbcset,
     end_ch = ((end_elem->type == SB_CHAR) ? end_elem->opr.ch
              : ((end_elem->type == COLL_SYM) ? end_elem->opr.name[0]
                 : 0));
-#ifdef GAWK
-    /*
-     * Fedora Core 2, maybe others, have broken `btowc' that returns -1
-     * for any value > 127. Sigh. Note that `start_ch' and `end_ch' are
-     * unsigned, so we don't have sign extension problems.
-     */
     start_wc = ((start_elem->type == SB_CHAR || start_elem->type == COLL_SYM)
-               ? start_ch : start_elem->opr.wch);
+               ? parse_byte (start_ch, mbcset) : start_elem->opr.wch);
     end_wc = ((end_elem->type == SB_CHAR || end_elem->type == COLL_SYM)
-             ? end_ch : end_elem->opr.wch);
-#else
-    start_wc = ((start_elem->type == SB_CHAR || start_elem->type == COLL_SYM)
-               ? __btowc (start_ch) : start_elem->opr.wch);
-    end_wc = ((end_elem->type == SB_CHAR || end_elem->type == COLL_SYM)
-             ? __btowc (end_ch) : end_elem->opr.wch);
-#endif
+             ? parse_byte (end_ch, mbcset) : end_elem->opr.wch);
     if (start_wc == WEOF || end_wc == WEOF)
       return REG_ECOLLATE;
     else if (BE ((syntax & RE_NO_EMPTY_RANGES) && start_wc > end_wc, 0))

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog |    9 +++++++++
 regcomp.c |   29 +++++++++++++++--------------
 2 files changed, 24 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]