This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Create a lookup table for magic vtables from magic type, PL_magic_data.
authorNicholas Clark <nick@ccl4.org>
Sun, 15 May 2011 12:21:09 +0000 (13:21 +0100)
committerNicholas Clark <nick@ccl4.org>
Sat, 11 Jun 2011 08:39:59 +0000 (10:39 +0200)
commit6f83ef0e5a45c465f83de3304c5818ba44492250
tree6b5a754cde4ee86baf633e6415f18b5fd8e721ff
parent546efe9fbd6c3c651c39b369e97d0835230a0f9f
Create a lookup table for magic vtables from magic type, PL_magic_data.

Use it to eliminate the large switch statement in Perl_sv_magic().

As the table needs to be keyed on magic type, which is expressed as C character
constants, the order depends on the compiler's character set. Frustratingly,
EBCDIC variants don't agree on the code points for '~' and ']', which we use
here. Instead of having (at least) 4 tables, get the local runtime to sort the
table for us. Hence the regen script writes out the (unsorted) mg_raw.h, which
generate_uudmap sorts to generate mg_data.h
13 files changed:
MANIFEST
Makefile.SH
Makefile.micro
generate_uudmap.c
globvar.sym
mg_raw.h [new file with mode: 0644]
perl.h
regen/mg_vtable.pl
sv.c
t/porting/regen.t
vms/descrip_mms.template
win32/Makefile
win32/makefile.mk