diff options
author | Karl Williamson <khw@cpan.org> | 2016-08-28 10:54:13 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-08-31 20:32:37 -0600 |
commit | 4dab108fb5e7e21a547733bb00ddb5d8bffd936d (patch) | |
tree | 0ae23367c9dceeac1908f31a0542a5464f4ee566 /proto.h | |
parent | 89d986df51f55257b8cc3f6e4f54eba60f607e48 (diff) | |
download | perl-4dab108fb5e7e21a547733bb00ddb5d8bffd936d.tar.gz |
Add is_utf8_valid_partial_char()
This new function can test some purported UTF-8 to see if it is
well-formed as far as it goes. That is there aren't enough bytes for
the character they start, but what is there is legal so far. This can
be useful in a fixed width buffer, where the final character is split in
the middle, and we want to test without waiting for the next read that
the entire buffer is valid.
Diffstat (limited to 'proto.h')
-rw-r--r-- | proto.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1625,6 +1625,11 @@ PERL_CALLCONV bool Perl_is_utf8_upper(pTHX_ const U8 *p) #define PERL_ARGS_ASSERT_IS_UTF8_UPPER \ assert(p) +PERL_STATIC_INLINE bool S_is_utf8_valid_partial_char(const U8 * const s, const U8 * const e) + __attribute__pure__; +#define PERL_ARGS_ASSERT_IS_UTF8_VALID_PARTIAL_CHAR \ + assert(s); assert(e) + PERL_CALLCONV bool Perl_is_utf8_xdigit(pTHX_ const U8 *p) __attribute__deprecated__ __attribute__warn_unused_result__; |