summaryrefslogtreecommitdiff
path: root/mg_vtable.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2020-10-19 14:54:59 +0100
committerDavid Mitchell <davem@iabyn.com>2020-10-23 14:25:52 +0100
commit032a49194dbdca7f62038e1b4af134d72972ecd8 (patch)
tree162fac0720de09a915c6bfc0b30f8c1039129240 /mg_vtable.h
parenta457b73cb378d9c4e10ffbacfc9a472be9395057 (diff)
downloadperl-032a49194dbdca7f62038e1b4af134d72972ecd8.tar.gz
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.
Diffstat (limited to 'mg_vtable.h')
-rw-r--r--mg_vtable.h2
1 files changed, 1 insertions, 1 deletions
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 }
};