This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add isFOO_utf8_safe() macros
authorKarl Williamson <khw@cpan.org>
Thu, 15 Dec 2016 23:30:27 +0000 (16:30 -0700)
committerKarl Williamson <khw@cpan.org>
Fri, 23 Dec 2016 23:48:34 +0000 (16:48 -0700)
commitda8c1a98236a9f56df850c47705cb3046d6636aa
tree678fc6d876d96346a0beb5b19b9b9249c17df9ea
parent9dfb44ee59033dc1f1f858d46a05a3f3c8ce85d9
Add isFOO_utf8_safe() macros

The original API does not check that we aren't reading beyond the end of
a buffer, apparently assuming that we could keep malformed UTF-8 out by
use of gatekeepers, but that is currently impossible.  This commit adds
"safe" macros for determining if a UTF-8 sequence represents
an alphabetic, a digit, etc.  Each new macro has an extra parameter
pointing to the end of the sequence, so that looking beyond the input
string can be avoided.

The macros aren't currently completely safe, as they don't test that
there is at least a single valid byte in the input, except by an
assertion in DEBUGGING builds.  This is because typically they are
called in code that makes that assumption, and frequently tests the
current byte for one thing or another.
embed.fnc
embed.h
ext/XS-APItest/APItest.xs
ext/XS-APItest/t/handy.t
handy.h
pod/perldelta.pod
proto.h
utf8.c
utf8.h