changeset 18674:5077a0eddc94

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.
author Paul Eggert <eggert@cs.ucla.edu>
date Sun, 15 Jan 2017 21:23:34 -0800
parents 8321b350b6d7
children 52ac6507348c
files ChangeLog NEWS lib/localeinfo.c lib/localeinfo.h
diffstat 4 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jan 15 17:18:10 2017 -0800
+++ b/ChangeLog	Sun Jan 15 21:23:34 2017 -0800
@@ -1,5 +1,11 @@
 2017-01-15  Paul Eggert  <eggert@cs.ucla.edu>
 
+	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.
--- a/NEWS	Sun Jan 15 17:18:10 2017 -0800
+++ b/NEWS	Sun Jan 15 21:23:34 2017 -0800
@@ -42,6 +42,9 @@
 
 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).
 
--- a/lib/localeinfo.c	Sun Jan 15 17:18:10 2017 -0800
+++ b/lib/localeinfo.c	Sun Jan 15 21:23:34 2017 -0800
@@ -90,10 +90,10 @@
 
 /* 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;
--- a/lib/localeinfo.h	Sun Jan 15 17:18:10 2017 -0800
+++ b/lib/localeinfo.h	Sun Jan 15 21:23:34 2017 -0800
@@ -51,4 +51,4 @@
    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]);