From 5495102afe3b4589647ff274c9692632113ce6f4 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Mon, 25 Feb 2013 20:26:44 -0700 Subject: [PATCH] Deprecate valid_utf8_to_uvuni() Now that all the tables are stored in native format, there is very little reason to use this function; and those who do need this kind of functionality should be using the bottom level routine, so as to make it clear they are doing nonstandard stuff. According to grep.cpan.me, there are no uses of this function in CPAN. --- embed.fnc | 2 +- proto.h | 1 + utf8.c | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/embed.fnc b/embed.fnc index 6960b13..a0bf3bf 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1542,7 +1542,7 @@ ApMd |U8* |bytes_from_utf8|NN const U8 *s|NN STRLEN *len|NULLOK bool *is_utf8 ApMd |U8* |bytes_to_utf8 |NN const U8 *s|NN STRLEN *len ApdD |UV |utf8_to_uvchr |NN const U8 *s|NULLOK STRLEN *retlen ApdD |UV |utf8_to_uvuni |NN const U8 *s|NULLOK STRLEN *retlen -ApM |UV |valid_utf8_to_uvuni |NN const U8 *s|NULLOK STRLEN *retlen +ApMD |UV |valid_utf8_to_uvuni |NN const U8 *s|NULLOK STRLEN *retlen Apd |UV |utf8_to_uvchr_buf |NN const U8 *s|NN const U8 *send|NULLOK STRLEN *retlen Apd |UV |utf8_to_uvuni_buf |NN const U8 *s|NN const U8 *send|NULLOK STRLEN *retlen pM |bool |check_utf8_print |NN const U8 *s|const STRLEN len diff --git a/proto.h b/proto.h index 458b073..9a170b8 100644 --- a/proto.h +++ b/proto.h @@ -4792,6 +4792,7 @@ PERL_CALLCONV UV Perl_valid_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen) assert(s) PERL_CALLCONV UV Perl_valid_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen) + __attribute__deprecated__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_VALID_UTF8_TO_UVUNI \ assert(s) diff --git a/utf8.c b/utf8.c index 4ab8c7c..4cc12d6 100644 --- a/utf8.c +++ b/utf8.c @@ -1026,7 +1026,8 @@ Perl_utf8_to_uvuni_buf(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen) ckWARN_d(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY); } -/* Like L(), but should only be called when it is known that +/* DEPRECATED! + * Like L(), but should only be called when it is known that * there are no malformations in the input UTF-8 string C. Surrogates, * non-character code points, and non-Unicode code points are allowed */ @@ -1068,7 +1069,7 @@ Perl_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen) { PERL_ARGS_ASSERT_UTF8_TO_UVUNI; - return valid_utf8_to_uvuni(s, retlen); + return NATIVE_TO_UNI(valid_utf8_to_uvchr(s, retlen)); } /* -- 2.7.4