* lib/mcel.h (mcel_eq): Prefer the more-precise “Are C1 and C2 equal?” to the longer “Return true if C1 and C2 are equal”. Logically speaking, the longer form does not specify what value is returned when C1 and C2 are not equal. --- ChangeLog | 6 ++++++ lib/mcel.h | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 0fcff01f9a..df5133de44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2025-11-27 Paul Eggert <[email protected]> + mcel: update mcel_eq comments + * lib/mcel.h (mcel_eq): Prefer the more-precise “Are C1 and C2 + equal?” to the longer “Return true if C1 and C2 are equal”. + Logically speaking, the longer form does not specify what value is + returned when C1 and C2 are not equal. + mcel: prefer mcel_eq to mcel_cmp if either works * lib/mbscasestr.c (mb_equal, knuth_morris_pratt_multibyte, mbscasestr): * lib/mbscspn.c (mbscspn): diff --git a/lib/mcel.h b/lib/mcel.h index 0256b4e38e..37d0382935 100644 --- a/lib/mcel.h +++ b/lib/mcel.h @@ -73,9 +73,9 @@ mcel_ch (CH, LEN) and mcel_err (ERR) construct mcel_t values. - mcel_cmp (G1, G2) compares two mcel_t values lexicographically by - character or by encoding byte value, with encoding bytes sorting - after characters. + mcel_cmp (G1, G2) and mcel_eq (G1, G2) compare two mcel_t values + lexicographically by character or by encoding byte value, + with encoding bytes sorting after characters. Calls like c32isalpha (G.ch) test G; they return false for encoding errors since calls like c32isalpha (0) return false. Calls like @@ -185,7 +185,7 @@ mcel_cmp (mcel_t c1, mcel_t c2) return ((c1.err - c2.err) * (1 << MCEL_ERR_SHIFT)) + (ch1 - ch2); } -/* Return true if C1 and C2 are equal. */ +/* Are C1 and C2 equal? */ MCEL_INLINE bool mcel_eq (mcel_t c1, mcel_t c2) { -- 2.51.0
