Skip to content

Commit 24a3ecc

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 c8d224f commit 24a3ecc

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
@@ -775,7 +775,7 @@ Adp |int |bytes_cmp_utf8 |NN const U8 *b \
775775
Adp |U8 * |bytes_from_utf8|NN const U8 *s \
776776
|NN STRLEN *lenp \
777777
|NN bool *is_utf8p
778-
Adip |U8 * |bytes_to_utf8 |NN const U8 *s \
778+
Admp |U8 * |bytes_to_utf8 |NN const U8 *s \
779779
|NN STRLEN *lenp
780780
Adp |U8 * |bytes_to_utf8_free_me \
781781
|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
@@ -2271,6 +2270,7 @@
22712270
# define PerlIO_write(a,b,c) Perl_PerlIO_write(aTHX_ a,b,c)
22722271
# endif /* defined(USE_PERLIO) */
22732272
# if defined(USE_THREADS)
2273+
# define Perl_bytes_to_utf8(mTHX,a,b) bytes_to_utf8(a,b)
22742274
# define Perl_do_open(mTHX,a,b,c,d,e,f,g) do_open(a,b,c,d,e,f,g)
22752275
# define Perl_gv_AVadd(mTHX,a) gv_AVadd(a)
22762276
# define Perl_gv_HVadd(mTHX,a) gv_HVadd(a)
@@ -2338,6 +2338,7 @@
23382338
# define Perl_gv_SVadd(mTHX,a) gv_SVadd(a)
23392339
# endif
23402340
# else /* if !defined(USE_THREADS) */
2341+
# define Perl_bytes_to_utf8 bytes_to_utf8
23412342
# define Perl_do_open do_open
23422343
# define Perl_gv_AVadd gv_AVadd
23432344
# define Perl_gv_HVadd gv_HVadd

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)