diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2025-10-18 19:07:35 +0200 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2025-10-18 19:07:35 +0200 |
| commit | fa23d938c040bc8af305a31fa874df55b2a02576 (patch) | |
| tree | 9704e2f7bd8962ea8911cd6f4e2d37227d7eff2e /lib/unigbrk/u16-grapheme-next.c | |
| parent | df9dbf9b0915e432a4a2c4182f60af36374eaaab (diff) | |
| parent | 693ae7b71dfdd1a8146266b5794a71c0dbe5dff0 (diff) | |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'lib/unigbrk/u16-grapheme-next.c')
| -rw-r--r-- | lib/unigbrk/u16-grapheme-next.c | 35 |
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..5e7a783d 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-2025 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" |
