diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2025-10-18 19:07:08 +0200 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2025-10-18 19:07:08 +0200 |
| commit | 693ae7b71dfdd1a8146266b5794a71c0dbe5dff0 (patch) | |
| tree | 9704e2f7bd8962ea8911cd6f4e2d37227d7eff2e /lib/unigbrk/u32-grapheme-prev.c | |
| parent | b8b9b0ac61ac47dddc58717f23619f8b06640498 (diff) | |
| parent | 27dae84ed92f1ef0300263091972338d12e78348 (diff) | |
Update upstream source from tag 'upstream/1.4.1'
Update to upstream version '1.4.1'
with Debian dir 8add41ffbfe3e6636eec0ec134c5af96832cc143
Diffstat (limited to 'lib/unigbrk/u32-grapheme-prev.c')
| -rw-r--r-- | lib/unigbrk/u32-grapheme-prev.c | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/lib/unigbrk/u32-grapheme-prev.c b/lib/unigbrk/u32-grapheme-prev.c index a6b6983a..977a1977 100644 --- a/lib/unigbrk/u32-grapheme-prev.c +++ b/lib/unigbrk/u32-grapheme-prev.c @@ -1,6 +1,5 @@ /* Previous 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,37 +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_prev (const uint32_t *s, const uint32_t *start) -{ - ucs4_t next; - - if (s == start) - return NULL; - - u32_prev (&next, s, start); - for (s--; s != start; s--) - { - ucs4_t prev; - - if (u32_prev (&prev, s, start) == NULL) - { - /* Ill-formed UTF-32 encoding. */ - return start; - } - - if (uc_is_grapheme_break (prev, next)) - break; - - next = prev; - } - - return s; -} +#define FUNC u32_grapheme_prev +#define UNIT uint32_t +#define U_PREV u32_prev +#include "u-grapheme-prev.h" |
