Change uiv_2buf() from a static to public API function

This commit is contained in:
Richard Leach 2025-02-04 22:06:47 +00:00
parent ca9b8c78b2
commit afdc2649e9
4 changed files with 29 additions and 18 deletions

View File

@ -3654,6 +3654,11 @@ EXop |bool |try_amagic_bin |int method \
|int flags
EXop |bool |try_amagic_un |int method \
|int flags
ARTp |char * |uiv_2buf |NN char * const buf \
|const IV iv \
|UV uv \
|const int is_uv \
|NN char ** const peob
Adp |SSize_t|unpackstring |NN const char *pat \
|NN const char *patend \
|NN const char *s \
@ -5896,11 +5901,6 @@ ST |STRLEN |sv_pos_u2b_midway \
|const STRLEN uend
i |void |sv_unglob |NN SV * const sv \
|U32 flags
RTi |char * |uiv_2buf |NN char * const buf \
|const IV iv \
|UV uv \
|const int is_uv \
|NN char ** const peob
S |void |utf8_mg_len_cache_update \
|NN SV * const sv \
|NN MAGIC ** const mgp \

View File

@ -851,6 +851,7 @@
# define to_uni_lower(a,b,c) Perl_to_uni_lower(aTHX_ a,b,c)
# define to_uni_title(a,b,c) Perl_to_uni_title(aTHX_ a,b,c)
# define to_uni_upper(a,b,c) Perl_to_uni_upper(aTHX_ a,b,c)
# define uiv_2buf Perl_uiv_2buf
# define unpackstring(a,b,c,d,e) Perl_unpackstring(aTHX_ a,b,c,d,e)
# define unshare_hek(a) Perl_unshare_hek(aTHX_ a)
# define unsharepvn(a,b,c) Perl_unsharepvn(aTHX_ a,b,c)
@ -2185,7 +2186,6 @@
# define sv_pos_u2b_forwards S_sv_pos_u2b_forwards
# define sv_pos_u2b_midway S_sv_pos_u2b_midway
# define sv_unglob(a,b) S_sv_unglob(aTHX_ a,b)
# define uiv_2buf S_uiv_2buf
# define utf8_mg_len_cache_update(a,b,c) S_utf8_mg_len_cache_update(aTHX_ a,b,c)
# define utf8_mg_pos_cache_update(a,b,c,d,e) S_utf8_mg_pos_cache_update(aTHX_ a,b,c,d,e)
# define visit(a,b,c) S_visit(aTHX_ a,b,c)

14
proto.h generated
View File

@ -5313,6 +5313,12 @@ PERL_CALLCONV bool
Perl_try_amagic_un(pTHX_ int method, int flags);
#define PERL_ARGS_ASSERT_TRY_AMAGIC_UN
PERL_CALLCONV char *
Perl_uiv_2buf(char * const buf, const IV iv, UV uv, const int is_uv, char ** const peob)
__attribute__warn_unused_result__;
#define PERL_ARGS_ASSERT_UIV_2BUF \
assert(buf); assert(peob)
PERL_CALLCONV SSize_t
Perl_unpackstring(pTHX_ const char *pat, const char *patend, const char *s, const char *strend, U32 flags);
#define PERL_ARGS_ASSERT_UNPACKSTRING \
@ -9091,13 +9097,7 @@ S_sv_unglob(pTHX_ SV * const sv, U32 flags);
# define PERL_ARGS_ASSERT_SV_UNGLOB \
assert(sv)
PERL_STATIC_INLINE char *
S_uiv_2buf(char * const buf, const IV iv, UV uv, const int is_uv, char ** const peob)
__attribute__warn_unused_result__;
# define PERL_ARGS_ASSERT_UIV_2BUF \
assert(buf); assert(peob)
# endif /* !defined(PERL_NO_INLINE_FUNCTIONS) */
# endif
# if defined(USE_ITHREADS)
STATIC SV *
S_sv_dup_common(pTHX_ const SV * const ssv, CLONE_PARAMS * const param)

21
sv.c
View File

@ -2794,15 +2794,26 @@ static const union {
'9', '8', '9', '9'
}};
/* uiv_2buf(): private routine for use by sv_2pv_flags(): print an IV or
* UV as a string towards the end of buf, and return pointers to start and
* end of it.
/* uiv_2buf(): originally a private routine for use by sv_2pv_flags(),
* now in use by do_print() and part of the public API. It prints an
* IV or UV as a string towards the end of buf, and return pointers
* to the start and end of it.
*
* We assume that buf is at least TYPE_CHARS(UV) long.
*/
PERL_STATIC_INLINE char *
S_uiv_2buf(char *const buf, const IV iv, UV uv, const int is_uv, char **const peob)
/*
=for apidoc uiv_2buf
This function converts an IV or UV to its string representation.
It is used internally by sv_2pv_flags() and do_print().
=cut
*/
char *
Perl_uiv_2buf(char *const buf, const IV iv, UV uv, const int is_uv, char **const peob)
{
char *ptr = buf + TYPE_CHARS(UV);
char * const ebuf = ptr;