From 211c07b6fd2b061f5b0ddc7c98567caedf71af3c Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sun, 20 Jul 2025 11:05:48 -0600 Subject: [PATCH] Convert Perl_uvoffuni_to_utf8_flags to a macro The function is hereby removed in favor of calling the plain uvoffuni_to_utf8_flags macro that already exists --- embed.fnc | 2 +- embed.h | 2 ++ proto.h | 6 ++---- utf8.c | 24 ------------------------ utf8.h | 15 +++++++++++++++ 5 files changed, 20 insertions(+), 29 deletions(-) diff --git a/embed.fnc b/embed.fnc index a82ef1820f..91c7cdf71d 100644 --- a/embed.fnc +++ b/embed.fnc @@ -3856,7 +3856,7 @@ Admp |U8 * |uvchr_to_utf8_flags_msgs \ |UV uv \ |UV flags \ |NULLOK HV **msgs -CMdp |U8 * |uvoffuni_to_utf8_flags \ +Cdmp |U8 * |uvoffuni_to_utf8_flags \ |NN U8 *d \ |UV uv \ |UV flags diff --git a/embed.h b/embed.h index 42386005b3..ae046a6173 100644 --- a/embed.h +++ b/embed.h @@ -2372,6 +2372,7 @@ # define Perl_uvchr_to_utf8(mTHX,a,b) uvchr_to_utf8(a,b) # define Perl_uvchr_to_utf8_flags(mTHX,a,b,c) uvchr_to_utf8_flags(a,b,c) # define Perl_uvchr_to_utf8_flags_msgs(mTHX,a,b,c,d) uvchr_to_utf8_flags_msgs(a,b,c,d) +# define Perl_uvoffuni_to_utf8_flags(mTHX,a,b,c) uvoffuni_to_utf8_flags(a,b,c) # define Perl_whichsig(mTHX,a) whichsig(a) # define thread_locale_init() Perl_thread_locale_init(aTHX) # define thread_locale_term() Perl_thread_locale_term(aTHX) @@ -2472,6 +2473,7 @@ # define Perl_uvchr_to_utf8 uvchr_to_utf8 # define Perl_uvchr_to_utf8_flags uvchr_to_utf8_flags # define Perl_uvchr_to_utf8_flags_msgs uvchr_to_utf8_flags_msgs +# define Perl_uvoffuni_to_utf8_flags uvoffuni_to_utf8_flags # define Perl_whichsig whichsig # if defined(PERL_DONT_CREATE_GVSV) # define Perl_gv_SVadd gv_SVadd diff --git a/proto.h b/proto.h index f64a9ff647..7e425c13cc 100644 --- a/proto.h +++ b/proto.h @@ -5487,10 +5487,8 @@ Perl_uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags); */ /* PERL_CALLCONV U8 * Perl_uvchr_to_utf8_flags_msgs(pTHX_ U8 *d, UV uv, UV flags, HV **msgs); */ -PERL_CALLCONV U8 * -Perl_uvoffuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags); -#define PERL_ARGS_ASSERT_UVOFFUNI_TO_UTF8_FLAGS \ - assert(d) +/* PERL_CALLCONV U8 * +Perl_uvoffuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags); */ PERL_CALLCONV U8 * Perl_uvoffuni_to_utf8_flags_msgs(pTHX_ U8 *d, UV input_uv, const UV flags, HV **msgs); diff --git a/utf8.c b/utf8.c index 0b222c7f38..f7f1f1a199 100644 --- a/utf8.c +++ b/utf8.c @@ -105,30 +105,6 @@ S_new_msg_hv(pTHX_ const char * const message, /* The message text */ return msg_hv; } -/* -=for apidoc uvoffuni_to_utf8_flags - -THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES. -Instead, B or -L>. - -This function is like them, but the input is a strict Unicode -(as opposed to native) code point. Only in very rare circumstances should code -not be using the native code point. - -For details, see the description for L. - -=cut -*/ - -U8 * -Perl_uvoffuni_to_utf8_flags(pTHX_ U8 *d, UV uv, const UV flags) -{ - PERL_ARGS_ASSERT_UVOFFUNI_TO_UTF8_FLAGS; - - return uvoffuni_to_utf8_flags_msgs(d, uv, flags, NULL); -} - /* All these formats take a single UV code point argument */ const char surrogate_cp_format[] = "UTF-16 surrogate U+%04" UVXf; const char nonchar_cp_format[] = "Unicode non-character U+%04" UVXf diff --git a/utf8.h b/utf8.h index a9bb14bf54..f37fa33159 100644 --- a/utf8.h +++ b/utf8.h @@ -139,6 +139,21 @@ typedef enum { #define is_ascii_string(s, len) is_utf8_invariant_string(s, len) #define is_invariant_string(s, len) is_utf8_invariant_string(s, len) +/* +=for apidoc uvoffuni_to_utf8_flags + +THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES. +Instead, B or +L>. + +This function is like them, but the input is a strict Unicode +(as opposed to native) code point. Only in very rare circumstances should code +not be using the native code point. + +For details, see the description for L. + +=cut +*/ #define uvoffuni_to_utf8_flags(d,uv,flags) \ uvoffuni_to_utf8_flags_msgs(d, uv, flags, 0)