diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-05-13 21:21:49 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-06-11 10:12:19 +0200 |
commit | c7fdacb978df1723dbbd70b5517ff77db208a23e (patch) | |
tree | 4060de2a609f4cf76b76edbc5b8cc86d9c77de7b /regen/mg_vtable.pl | |
parent | 406700cc2c30076030b511780fa9f662c8bfec20 (diff) | |
download | perl-c7fdacb978df1723dbbd70b5517ff77db208a23e.tar.gz |
Refactor Perl_get_vtbl() to a small array lookup from a large switch statement.
Provide magic_vtable_max, the number of elements in PL_magic_vtables[].
Diffstat (limited to 'regen/mg_vtable.pl')
-rw-r--r-- | regen/mg_vtable.pl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/regen/mg_vtable.pl b/regen/mg_vtable.pl index d09bfdaaf5..3419070484 100644 --- a/regen/mg_vtable.pl +++ b/regen/mg_vtable.pl @@ -63,6 +63,7 @@ my $h = open_new('mg_vtable.h', '>', { my @names = map {"want_vtbl_$_"} grep {!ref $_} @sig; + push @names, 'magic_vtable_max'; local $" = ",\n "; print $h <<"EOH"; enum { /* pass one of these to get_vtbl */ @@ -91,7 +92,7 @@ print $h <<'EOH'; */ #ifdef DOINIT -EXT_MGVTBL PL_magic_vtables[] = { +EXT_MGVTBL PL_magic_vtables[magic_vtable_max] = { EOH my @vtable_names; @@ -120,7 +121,7 @@ EOH print $h <<'EOH'; }; #else -EXT_MGVTBL PL_magic_vtables[]; +EXT_MGVTBL PL_magic_vtables[magic_vtable_max]; #endif EOH |