From 032a49194dbdca7f62038e1b4af134d72972ecd8 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Mon, 19 Oct 2020 14:54:59 +0100 Subject: add Perl_magic_freeutf8() magic vtable method S_mg_free_struct() has a workaround to free mg->mg_ptr in PERL_MAGIC_utf8 even if mg_len is zero. Move this logic into a new magic vtable free method instead, so that S_mg_free_struct() (which gets called for every type of magic) doesn't have the overhead of checking every time for mg->mg_type == PERL_MAGIC_utf8. --- mg_vtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mg_vtable.h') diff --git a/mg_vtable.h b/mg_vtable.h index 809ab0e236..8815d697ca 100644 --- a/mg_vtable.h +++ b/mg_vtable.h @@ -190,7 +190,7 @@ EXT_MGVTBL PL_magic_vtables[magic_vtable_max] = { { Perl_magic_getsubstr, Perl_magic_setsubstr, 0, 0, 0, 0, 0, 0 }, { Perl_magic_get, Perl_magic_set, 0, 0, 0, 0, 0, 0 }, { Perl_magic_gettaint, Perl_magic_settaint, 0, 0, 0, 0, 0, 0 }, - { 0, Perl_magic_setutf8, 0, 0, 0, 0, 0, 0 }, + { 0, Perl_magic_setutf8, 0, 0, Perl_magic_freeutf8, 0, 0, 0 }, { Perl_magic_getuvar, Perl_magic_setuvar, 0, 0, 0, 0, 0, 0 }, { Perl_magic_getvec, Perl_magic_setvec, 0, 0, 0, 0, 0, 0 } }; -- cgit v1.2.1