summaryrefslogtreecommitdiff
path: root/regen
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-05-13 21:21:49 +0100
committerNicholas Clark <nick@ccl4.org>2011-06-11 10:12:19 +0200
commitc7fdacb978df1723dbbd70b5517ff77db208a23e (patch)
tree4060de2a609f4cf76b76edbc5b8cc86d9c77de7b /regen
parent406700cc2c30076030b511780fa9f662c8bfec20 (diff)
downloadperl-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')
-rw-r--r--regen/mg_vtable.pl5
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