From: Nicholas Clark Date: Sat, 14 May 2011 08:16:30 +0000 (+0100) Subject: PL_vtbl_{bm,fm} can be aliases to PL_vtbl_regexp, instead of copies. X-Git-Tag: accepted/trunk/20130322.191538~3811 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2e9fc6f32369f6de4f37da887e1e7c4a48dd506;p=platform%2Fupstream%2Fperl.git PL_vtbl_{bm,fm} can be aliases to PL_vtbl_regexp, instead of copies. They became copies in 488344d27a84a21a, which merged Perl_magic_setbm() and Perl_magic_setfm() into Perl_magic_setregexp(). --- diff --git a/mg_vtable.h b/mg_vtable.h index 2db8f3f..52937d7 100644 --- a/mg_vtable.h +++ b/mg_vtable.h @@ -24,8 +24,6 @@ enum { /* pass one of these to get_vtbl */ want_vtbl_substr, want_vtbl_vec, want_vtbl_pos, - want_vtbl_bm, - want_vtbl_fm, want_vtbl_uvar, want_vtbl_defelem, want_vtbl_regexp, @@ -82,8 +80,6 @@ EXT_MGVTBL PL_magic_vtables[magic_vtable_max] = { { Perl_magic_getsubstr, Perl_magic_setsubstr, 0, 0, 0, 0, 0, 0 }, { Perl_magic_getvec, Perl_magic_setvec, 0, 0, 0, 0, 0, 0 }, { Perl_magic_getpos, Perl_magic_setpos, 0, 0, 0, 0, 0, 0 }, - { 0, Perl_magic_setregexp, 0, 0, 0, 0, 0, 0 }, - { 0, Perl_magic_setregexp, 0, 0, 0, 0, 0, 0 }, { Perl_magic_getuvar, Perl_magic_setuvar, 0, 0, 0, 0, 0, 0 }, { Perl_magic_getdefelem, Perl_magic_setdefelem, 0, 0, 0, 0, 0, 0 }, { 0, Perl_magic_setregexp, 0, 0, 0, 0, 0, 0 }, @@ -106,6 +102,9 @@ EXT_MGVTBL PL_magic_vtables[magic_vtable_max] = { EXT_MGVTBL PL_magic_vtables[magic_vtable_max]; #endif +#define want_vtbl_bm want_vtbl_regexp +#define want_vtbl_fm want_vtbl_regexp + #define PL_vtbl_amagic PL_magic_vtables[want_vtbl_amagic] #define PL_vtbl_amagicelem PL_magic_vtables[want_vtbl_amagicelem] #define PL_vtbl_arylen PL_magic_vtables[want_vtbl_arylen] diff --git a/regen/mg_vtable.pl b/regen/mg_vtable.pl index 3419070..20ba577 100644 --- a/regen/mg_vtable.pl +++ b/regen/mg_vtable.pl @@ -39,11 +39,9 @@ my @sig = 'substr' => {get => 'getsubstr', set => 'setsubstr'}, 'vec' => {get => 'getvec', set => 'setvec'}, 'pos' => {get => 'getpos', set => 'setpos'}, - 'bm' => {set => 'setregexp'}, - 'fm' => {set => 'setregexp'}, 'uvar' => {get => 'getuvar', set => 'setuvar'}, 'defelem' => {get => 'getdefelem', set => 'setdefelem'}, - 'regexp' => {set => 'setregexp'}, + 'regexp' => {set => 'setregexp', alias => [qw(bm fm)]}, 'regdata' => {len => 'regdata_cnt'}, 'regdatum' => {get => 'regdatum_get', set => 'regdatum_set'}, 'amagic' => {set => 'setamagic', free => 'setamagic'}, @@ -96,6 +94,7 @@ EXT_MGVTBL PL_magic_vtables[magic_vtable_max] = { EOH my @vtable_names; +my @aliases; while (my ($name, $data) = splice @sig, 0, 2) { push @vtable_names, $name; @@ -116,6 +115,10 @@ while (my ($name, $data) = splice @sig, 0, 2) { { 0, 0, 0, 0, 0, 0, 0, 0 }$comma #endif EOH + foreach(@{$data->{alias}}) { + push @aliases, "#define want_vtbl_$_ want_vtbl_$name\n"; + push @vtable_names, $_; + } } print $h <<'EOH'; @@ -126,6 +129,7 @@ EXT_MGVTBL PL_magic_vtables[magic_vtable_max]; EOH +print $h @aliases, "\n";; print $h "#define PL_vtbl_$_ PL_magic_vtables[want_vtbl_$_]\n" foreach sort @vtable_names;