From c81472e0e9feb6233e29b4c0cd85707537abb74e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 15 Jan 2017 21:23:34 -0800 Subject: [PATCH] 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. --- 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 e0b836bcff..31770bf7be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2017-01-15 Paul Eggert + 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 3db6085055..791bcafed6 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 36dabf4955..ece679e3bf 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 3b4f0d2247..a6773f52d8 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.39.5