+2025-05-18 Bruno Haible <bruno@clisp.org>
+
+ unigbrk/u*-grapheme-breaks: Tiny optimization.
+ * lib/unigbrk/u-grapheme-breaks.h (FUNC): Exploit the fact that n > 0.
+
2025-05-17 Bruno Haible <bruno@clisp.org>
cosh: Add more tests.
/* Grapheme cluster break function.
Copyright (C) 2010-2025 Free Software Foundation, Inc.
- Written by Ben Pfaff <blp@cs.stanford.edu>, 2010.
This file is free software.
It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Written by Ben Pfaff, Daiki Ueno, Bruno Haible. */
+
/* This file implements section 3 "Grapheme Cluster Boundaries"
of Unicode Standard Annex #29 <https://www.unicode.org/reports/tr29/>. */
/* Don't break inside multibyte characters. */
memset (p, 0, n);
- while (s < s_end)
+ do
{
+ /* Invariant: Here s < s_end. */
ucs4_t uc;
int count = U_MBTOUC (&uc, s, s_end - s);
int prop = uc_graphemeclusterbreak_property (uc);
s += count;
p += count;
}
+ while (s < s_end);
}
}