Skip to content

Commit 7b5fa99

Browse files
committed
Make uv_to_utf8(_flags)? into macros
These were inline functions, but macros require fewer resources; I intented them to be macros all along, but until 93f23f0, that was harder.
1 parent 21a21f1 commit 7b5fa99

File tree

5 files changed

+15
-27
lines changed

5 files changed

+15
-27
lines changed

embed.fnc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3834,9 +3834,9 @@ Cp |U8 * |uvoffuni_to_utf8_flags_msgs \
38343834
|const UV flags \
38353835
|NULLOK HV **msgs
38363836

3837-
Adip |U8 * |uv_to_utf8 |NN U8 *d \
3837+
Admp |U8 * |uv_to_utf8 |NN U8 *d \
38383838
|UV uv
3839-
Adip |U8 * |uv_to_utf8_flags \
3839+
Admp |U8 * |uv_to_utf8_flags \
38403840
|NN U8 *d \
38413841
|UV uv \
38423842
|UV flags

embed.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,8 +823,6 @@
823823
# define Perl_utf8n_to_uvchr utf8n_to_uvchr
824824
# define Perl_utf8n_to_uvchr_error utf8n_to_uvchr_error
825825
# define utf8n_to_uvchr_msgs Perl_utf8n_to_uvchr_msgs
826-
# define uv_to_utf8(a,b) Perl_uv_to_utf8(aTHX_ a,b)
827-
# define uv_to_utf8_flags(a,b,c) Perl_uv_to_utf8_flags(aTHX_ a,b,c)
828826
# define uvoffuni_to_utf8_flags_msgs(a,b,c,d) Perl_uvoffuni_to_utf8_flags_msgs(aTHX_ a,b,c,d)
829827
# define valid_identifier_pve(a,b,c) Perl_valid_identifier_pve(aTHX_ a,b,c)
830828
# define valid_identifier_pvn(a,b,c) Perl_valid_identifier_pvn(aTHX_ a,b,c)
@@ -2258,11 +2256,15 @@
22582256
# define PerlIO_write(a,b,c) Perl_PerlIO_write(aTHX_ a,b,c)
22592257
# endif /* defined(USE_PERLIO) */
22602258
# if defined(USE_THREADS)
2259+
# define Perl_uv_to_utf8(mTHX,a,b) uv_to_utf8(a,b)
2260+
# define Perl_uv_to_utf8_flags(mTHX,a,b,c) uv_to_utf8_flags(a,b,c)
22612261
# define Perl_uv_to_utf8_msgs(mTHX,a,b,c,d) uv_to_utf8_msgs(a,b,c,d)
22622262
# define Perl_uvoffuni_to_utf8_flags(mTHX,a,b,c) uvoffuni_to_utf8_flags(a,b,c)
22632263
# define thread_locale_init() Perl_thread_locale_init(aTHX)
22642264
# define thread_locale_term() Perl_thread_locale_term(aTHX)
22652265
# else
2266+
# define Perl_uv_to_utf8 uv_to_utf8
2267+
# define Perl_uv_to_utf8_flags uv_to_utf8_flags
22662268
# define Perl_uv_to_utf8_msgs uv_to_utf8_msgs
22672269
# define Perl_uvoffuni_to_utf8_flags uvoffuni_to_utf8_flags
22682270
# endif

inline.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3272,18 +3272,6 @@ Perl_utf8_to_uvchr_buf(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen)
32723272
return 0;
32733273
}
32743274

3275-
PERL_STATIC_INLINE U8 *
3276-
Perl_uv_to_utf8(pTHX_ U8 *d, UV uv)
3277-
{
3278-
return uv_to_utf8_msgs(d, uv, 0, 0);
3279-
}
3280-
3281-
PERL_STATIC_INLINE U8 *
3282-
Perl_uv_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags)
3283-
{
3284-
return uv_to_utf8_msgs(d, uv, flags, 0);
3285-
}
3286-
32873275
/* ------------------------------- perl.h ----------------------------- */
32883276

32893277
/*

proto.h

Lines changed: 6 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

utf8.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ For details, see the description for L<perlapi/uv_to_utf8_flags>.
164164
#define uvchr_to_utf8_flags uv_to_utf8_flags
165165
#define uvchr_to_utf8_flags_msgs uv_to_utf8_msgs
166166

167-
#define uv_to_utf8_msgs(d, uv, flags, msgs) \
167+
#define uv_to_utf8(d, uv) uv_to_utf8_flags(d, uv, 0)
168+
#define uv_to_utf8_flags(d, uv, flags) uv_to_utf8_msgs(d, uv, flags, 0)
169+
#define uv_to_utf8_msgs(d, uv, flags, msgs) \
168170
uvoffuni_to_utf8_flags_msgs(d, NATIVE_TO_UNI(uv), flags, msgs)
169171

170172
/* This is needed to cast the parameters for all those calls that had them

0 commit comments

Comments
 (0)