diff options
Diffstat (limited to 'lib/unigbrk/u32-grapheme-next.c')
-rw-r--r-- | lib/unigbrk/u32-grapheme-next.c | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/lib/unigbrk/u32-grapheme-next.c b/lib/unigbrk/u32-grapheme-next.c index 198857d9..1c9adfa6 100644 --- a/lib/unigbrk/u32-grapheme-next.c +++ b/lib/unigbrk/u32-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 uint32_t * -u32_grapheme_next (const uint32_t *s, const uint32_t *end) -{ - ucs4_t prev; - - if (s == end) - return NULL; - - u32_mbtouc (&prev, s, end - s); - for (s++; s != end; s++) - { - ucs4_t next; - - u32_mbtouc (&next, s, end - s); - if (uc_is_grapheme_break (prev, next)) - break; - - prev = next; - } - - return s; -} +#define FUNC u32_grapheme_next +#define UNIT uint32_t +#define U_MBTOUC u32_mbtouc +#include "u-grapheme-next.h" |