diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2026-03-10 13:24:07 +0100 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2026-03-10 13:24:07 +0100 |
| commit | cfd1f17f1a85d95ea12bca8dae42add7dad1ad11 (patch) | |
| tree | 8016486f8ee7157213f2d09ff2491bfa9c94638a /lib/unistr/u32-cmp.c | |
| parent | 14e4d584d0121031ec40e6c35869745f1747ff29 (diff) | |
| parent | 1403307d6e2fb4e7b5d97a35f40d1e95134561ab (diff) | |
Merge branch 'release/debian/1.4.2-1'HEADdebian/1.4.2-1master
Diffstat (limited to 'lib/unistr/u32-cmp.c')
| -rw-r--r-- | lib/unistr/u32-cmp.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/unistr/u32-cmp.c b/lib/unistr/u32-cmp.c index c953c8af..dddb4bc0 100644 --- a/lib/unistr/u32-cmp.c +++ b/lib/unistr/u32-cmp.c @@ -1,5 +1,5 @@ /* Compare pieces of UTF-32 strings. - Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This file is free software. @@ -31,18 +31,16 @@ int u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n) { - for (; n > 0;) + for (; n > 0; n--) { uint32_t uc1 = *s1++; uint32_t uc2 = *s2++; - if (uc1 == uc2) + if (uc1 != uc2) { - n--; - continue; + /* Note that uc1 and uc2 each have at most 31 bits. */ + return (int)uc1 - (int)uc2; + /* > 0 if uc1 > uc2, < 0 if uc1 < uc2. */ } - /* Note that uc1 and uc2 each have at most 31 bits. */ - return (int)uc1 - (int)uc2; - /* > 0 if uc1 > uc2, < 0 if uc1 < uc2. */ } return 0; } |
