]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
mcel: update mcel_eq comments
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 28 Nov 2025 06:46:26 +0000 (22:46 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 28 Nov 2025 06:46:43 +0000 (22:46 -0800)
* 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
lib/mcel.h

index 0fcff01f9afa34d339fc93c5315dff0382837130..df5133de44e40784848e990525723dbf18cbfb86 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2025-11-27  Paul Eggert  <eggert@cs.ucla.edu>
 
+       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):
index 0256b4e38e482af49b39e735af216ec0dcd6c9ae..37d0382935e7576aa95a4dca207acd2129e82ca7 100644 (file)
@@ -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)
 {