Skip to content

Commit d815115

Browse files
committed
Make Perl_bytes_to_utf8 into a macro
This was an inline function that just called another function; a macro uses fewer resources
1 parent 7b5fa99 commit d815115

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

embed.fnc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ Adp |int |bytes_cmp_utf8 |NN const U8 *b \
770770
Adp |U8 * |bytes_from_utf8|NN const U8 *s \
771771
|NN STRLEN *lenp \
772772
|NN bool *is_utf8p
773-
Adip |U8 * |bytes_to_utf8 |NN const U8 *s \
773+
Admp |U8 * |bytes_to_utf8 |NN const U8 *s \
774774
|NN STRLEN *lenp
775775
Adp |U8 * |bytes_to_utf8_free_me \
776776
|NN const U8 *s \

embed.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@
157157
# define block_start(a) Perl_block_start(aTHX_ a)
158158
# define bytes_cmp_utf8(a,b,c,d) Perl_bytes_cmp_utf8(aTHX_ a,b,c,d)
159159
# define bytes_from_utf8(a,b,c) Perl_bytes_from_utf8(aTHX_ a,b,c)
160-
# define bytes_to_utf8(a,b) Perl_bytes_to_utf8(aTHX_ a,b)
161160
# define bytes_to_utf8_free_me(a,b,c) Perl_bytes_to_utf8_free_me(aTHX_ a,b,c)
162161
# define bytes_to_utf8_temp_pv(a,b) Perl_bytes_to_utf8_temp_pv(aTHX_ a,b)
163162
# define Perl_c9strict_utf8_to_uv c9strict_utf8_to_uv
@@ -2256,13 +2255,15 @@
22562255
# define PerlIO_write(a,b,c) Perl_PerlIO_write(aTHX_ a,b,c)
22572256
# endif /* defined(USE_PERLIO) */
22582257
# if defined(USE_THREADS)
2258+
# define Perl_bytes_to_utf8(mTHX,a,b) bytes_to_utf8(a,b)
22592259
# define Perl_uv_to_utf8(mTHX,a,b) uv_to_utf8(a,b)
22602260
# 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_bytes_to_utf8 bytes_to_utf8
22662267
# define Perl_uv_to_utf8 uv_to_utf8
22672268
# define Perl_uv_to_utf8_flags uv_to_utf8_flags
22682269
# define Perl_uv_to_utf8_msgs uv_to_utf8_msgs

inline.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,12 +1244,6 @@ Perl_append_utf8_from_native_byte(const U8 byte, U8** dest)
12441244
}
12451245
}
12461246

1247-
PERL_STATIC_INLINE U8 *
1248-
Perl_bytes_to_utf8(pTHX_ const U8 *s, STRLEN *lenp)
1249-
{
1250-
return bytes_to_utf8_free_me(s, lenp, NULL);
1251-
}
1252-
12531247
PERL_STATIC_INLINE U8 *
12541248
Perl_bytes_to_utf8_temp_pv(pTHX_ const U8 *s, STRLEN *lenp)
12551249
{

proto.h

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

utf8.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,8 @@ point's representation.
13531353

13541354
#define is_utf8_char_buf(buf, buf_end) isUTF8_CHAR(buf, buf_end)
13551355

1356+
#define bytes_to_utf8(s, lenp) bytes_to_utf8_free_me(s, lenp, NULL)
1357+
13561358
typedef enum {
13571359
PL_utf8_to_bytes_overwrite = 0,
13581360
PL_utf8_to_bytes_new_memory,

0 commit comments

Comments
 (0)