summaryrefslogtreecommitdiff
path: root/lib/unigbrk/u16-grapheme-next.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2026-03-10 13:24:07 +0100
committerJörg Frings-Fürst <debian@jff.email>2026-03-10 13:24:07 +0100
commitcfd1f17f1a85d95ea12bca8dae42add7dad1ad11 (patch)
tree8016486f8ee7157213f2d09ff2491bfa9c94638a /lib/unigbrk/u16-grapheme-next.c
parent14e4d584d0121031ec40e6c35869745f1747ff29 (diff)
parent1403307d6e2fb4e7b5d97a35f40d1e95134561ab (diff)
Merge branch 'release/debian/1.4.2-1'HEADdebian/1.4.2-1master
Diffstat (limited to 'lib/unigbrk/u16-grapheme-next.c')
-rw-r--r--lib/unigbrk/u16-grapheme-next.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/lib/unigbrk/u16-grapheme-next.c b/lib/unigbrk/u16-grapheme-next.c
index 1df56740..6397301f 100644
--- a/lib/unigbrk/u16-grapheme-next.c
+++ b/lib/unigbrk/u16-grapheme-next.c
@@ -1,6 +1,5 @@
/* Next grapheme cluster function.
- Copyright (C) 2010-2024 Free Software Foundation, Inc.
- Written by Ben Pfaff <blp@cs.stanford.edu>, 2010.
+ Copyright (C) 2010-2026 Free Software Foundation, Inc.
This file is free software.
It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
@@ -23,32 +22,20 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Written by Bruno Haible <bruno@clisp.org>, 2025. */
+
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
#include "unigbrk.h"
+#include "unictype.h"
#include "unistr.h"
-const uint16_t *
-u16_grapheme_next (const uint16_t *s, const uint16_t *end)
-{
- ucs4_t prev;
- int mblen;
-
- if (s == end)
- return NULL;
-
- for (s += u16_mbtouc (&prev, s, end - s); s != end; s += mblen)
- {
- ucs4_t next;
-
- mblen = u16_mbtouc (&next, s, end - s);
- if (uc_is_grapheme_break (prev, next))
- break;
-
- prev = next;
- }
-
- return s;
-}
+#define FUNC u16_grapheme_next
+#define UNIT uint16_t
+#define U_MBTOUC u16_mbtouc
+#include "u-grapheme-next.h"