bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] localeinfo: case_folded_counterparts and WEOF


From: Paul Eggert
Subject: [PATCH] localeinfo: case_folded_counterparts and WEOF
Date: Sun, 15 Jan 2017 21:25:27 -0800

* NEWS: Document this.
* lib/localeinfo.c (case_folded_counterparts):
First arg is now wint_t, not wchar_t.  This generalizes the
function to also work on WEOF, where it returns 0.
---
 ChangeLog        | 6 ++++++
 NEWS             | 3 +++
 lib/localeinfo.c | 4 ++--
 lib/localeinfo.h | 2 +-
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e0b836b..31770bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2017-01-15  Paul Eggert  <address@hidden>
 
+       localeinfo: case_folded_counterparts and WEOF
+       * NEWS: Document this.
+       * lib/localeinfo.c (case_folded_counterparts):
+       First arg is now wint_t, not wchar_t.  This generalizes the
+       function to also work on WEOF, where it returns 0.
+
        dfa: port to gcc -fsanitize=undefined
        * lib/dfa.c (copy): Don’t pass NULL with size 0 to memcpy,
        as this runs afoul of gcc -fsanitize=undefined.
diff --git a/NEWS b/NEWS
index 3db6085..791bcaf 100644
--- a/NEWS
+++ b/NEWS
@@ -42,6 +42,9 @@ User visible incompatible changes
 
 Date        Modules         Changes
 
+2017-01-15  localeinfo      Change case_folded_counterparts's first arg's type
+                            from wchar_t to wint_t, so it now accepts WEOF.
+
 2016-12-17  getlogin        The link requirements of these modules are changed
             getlogin_r      from empty to $(LIB_GETLOGIN).
 
diff --git a/lib/localeinfo.c b/lib/localeinfo.c
index 36dabf4..ece679e 100644
--- a/lib/localeinfo.c
+++ b/lib/localeinfo.c
@@ -90,10 +90,10 @@ verify (1 + 1 + sizeof lonesome_lower / sizeof 
*lonesome_lower
 
 /* Find the characters equal to C after case-folding, other than C
    itself, and store them into FOLDED.  Return the number of characters
-   stored.  */
+   stored; this is zero if C is WEOF.  */
 
 int
-case_folded_counterparts (wchar_t c, wchar_t folded[CASE_FOLDED_BUFSIZE])
+case_folded_counterparts (wint_t c, wchar_t folded[CASE_FOLDED_BUFSIZE])
 {
   int i;
   int n = 0;
diff --git a/lib/localeinfo.h b/lib/localeinfo.h
index 3b4f0d2..a6773f5 100644
--- a/lib/localeinfo.h
+++ b/lib/localeinfo.h
@@ -51,4 +51,4 @@ extern void init_localeinfo (struct localeinfo *);
    itself.  This is a generous upper bound.  */
 enum { CASE_FOLDED_BUFSIZE = 32 };
 
-extern int case_folded_counterparts (wchar_t, wchar_t[CASE_FOLDED_BUFSIZE]);
+extern int case_folded_counterparts (wint_t, wchar_t[CASE_FOLDED_BUFSIZE]);
-- 
2.9.3




reply via email to

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