From: Rafael Garcia-Suarez Date: Mon, 23 Jan 2006 14:44:59 +0000 (+0000) Subject: Un-const magic virtual tables; this consting breaks the nasty X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=92e67595817e2efa2a2f6c3e6498b1f1babb5fbd;p=p5sagit%2Fp5-mst-13.2.git Un-const magic virtual tables; this consting breaks the nasty things done by Swig, as noticed by Audrey. p4raw-id: //depot/perl@26924 --- diff --git a/embed.fnc b/embed.fnc index d3fd5bb..9cd0ff1 100644 --- a/embed.fnc +++ b/embed.fnc @@ -790,7 +790,7 @@ Apd |STRLEN |sv_len |NULLOK SV* sv Apd |STRLEN |sv_len_utf8 |NULLOK SV* sv Apd |void |sv_magic |NN SV* sv|NULLOK SV* obj|int how|NULLOK const char* name \ |I32 namlen -Apd |MAGIC *|sv_magicext |NN SV* sv|NULLOK SV* obj|int how|NULLOK const MGVTBL *vtbl \ +Apd |MAGIC *|sv_magicext |NN SV* sv|NULLOK SV* obj|int how|NULLOK MGVTBL *vtbl \ |NULLOK const char* name|I32 namlen ApdaR |SV* |sv_mortalcopy |NULLOK SV* oldsv ApdR |SV* |sv_newmortal diff --git a/mg.c b/mg.c index fb47f1f..a85cc46 100644 --- a/mg.c +++ b/mg.c @@ -409,7 +409,7 @@ Perl_mg_localize(pTHX_ SV *sv, SV *nsv) dVAR; MAGIC *mg; for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) { - const MGVTBL* const vtbl = mg->mg_virtual; + MGVTBL* const vtbl = mg->mg_virtual; switch (mg->mg_type) { /* value magic types: don't copy */ case PERL_MAGIC_bm: diff --git a/mg.h b/mg.h index 3e90732..a373def 100644 --- a/mg.h +++ b/mg.h @@ -26,7 +26,7 @@ struct mgvtbl { struct magic { MAGIC* mg_moremagic; - const MGVTBL* mg_virtual; /* pointer to magic functions */ + MGVTBL* mg_virtual; /* pointer to magic functions */ U16 mg_private; char mg_type; U8 mg_flags; diff --git a/perl.h b/perl.h index fb0f1e9..f4d20f8 100644 --- a/perl.h +++ b/perl.h @@ -4344,11 +4344,11 @@ END_EXTERN_C START_EXTERN_C #ifdef DOINIT -# define MGVTBL_SET(var,a,b,c,d,e,f,g) EXTCONST MGVTBL var = {a,b,c,d,e,f,g} -# define MGVTBL_SET_CONST_MAGIC_GET(var,a,b,c,d,e,f,g) EXTCONST MGVTBL var = {(int (*)(pTHX_ SV *, MAGIC *))a,b,c,d,e,f,g} /* Like MGVTBL_SET but with the get magic having a const MG* */ +# define MGVTBL_SET(var,a,b,c,d,e,f,g) EXT MGVTBL var = {a,b,c,d,e,f,g} +# define MGVTBL_SET_CONST_MAGIC_GET(var,a,b,c,d,e,f,g) EXT MGVTBL var = {(int (*)(pTHX_ SV *, MAGIC *))a,b,c,d,e,f,g} /* Like MGVTBL_SET but with the get magic having a const MG* */ #else -# define MGVTBL_SET(var,a,b,c,d,e,f,g) EXTCONST MGVTBL var -# define MGVTBL_SET_CONST_MAGIC_GET(var,a,b,c,d,e,f,g) EXTCONST MGVTBL var +# define MGVTBL_SET(var,a,b,c,d,e,f,g) EXT MGVTBL var +# define MGVTBL_SET_CONST_MAGIC_GET(var,a,b,c,d,e,f,g) EXT MGVTBL var #endif MGVTBL_SET( diff --git a/pod/perlapi.pod b/pod/perlapi.pod index 933b2aa..5d807df 100644 --- a/pod/perlapi.pod +++ b/pod/perlapi.pod @@ -5092,7 +5092,7 @@ to contain an C and is stored as-is with its REFCNT incremented. (This is now used as a subroutine by C.) - MAGIC * sv_magicext(SV* sv, SV* obj, int how, const MGVTBL *vtbl, const char* name, I32 namlen) + MAGIC * sv_magicext(SV* sv, SV* obj, int how, MGVTBL *vtbl, const char* name, I32 namlen) =for hackers Found in file sv.c diff --git a/proto.h b/proto.h index d80f969..f401ade 100644 --- a/proto.h +++ b/proto.h @@ -2190,7 +2190,7 @@ PERL_CALLCONV STRLEN Perl_sv_len_utf8(pTHX_ SV* sv); PERL_CALLCONV void Perl_sv_magic(pTHX_ SV* sv, SV* obj, int how, const char* name, I32 namlen) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV MAGIC * Perl_sv_magicext(pTHX_ SV* sv, SV* obj, int how, const MGVTBL *vtbl, const char* name, I32 namlen) +PERL_CALLCONV MAGIC * Perl_sv_magicext(pTHX_ SV* sv, SV* obj, int how, MGVTBL *vtbl, const char* name, I32 namlen) __attribute__nonnull__(pTHX_1); PERL_CALLCONV SV* Perl_sv_mortalcopy(pTHX_ SV* oldsv) diff --git a/sv.c b/sv.c index 6c884b0..60237b6 100644 --- a/sv.c +++ b/sv.c @@ -4060,7 +4060,7 @@ to contain an C and is stored as-is with its REFCNT incremented. =cut */ MAGIC * -Perl_sv_magicext(pTHX_ SV* sv, SV* obj, int how, const MGVTBL *vtable, +Perl_sv_magicext(pTHX_ SV* sv, SV* obj, int how, MGVTBL *vtable, const char* name, I32 namlen) { dVAR; @@ -4149,7 +4149,7 @@ void Perl_sv_magic(pTHX_ register SV *sv, SV *obj, int how, const char *name, I32 namlen) { dVAR; - const MGVTBL *vtable; + MGVTBL *vtable; MAGIC* mg; #ifdef PERL_OLD_COPY_ON_WRITE