From: Nicholas Clark Date: Thu, 26 May 2005 16:07:20 +0000 (+0000) Subject: Rename the members of the SV head union to avoid pre-processor X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=339049b035d3e07ff8c7f574dac68f06816b9af2;p=p5sagit%2Fp5-mst-13.2.git Rename the members of the SV head union to avoid pre-processor arguments with embed.h p4raw-id: //depot/perl@24590 --- diff --git a/av.h b/av.h index 488e098..f377ea9 100644 --- a/av.h +++ b/av.h @@ -86,7 +86,7 @@ Same as C. Deprecated, use C instead. #define Nullav Null(AV*) -#define AvARRAY(av) ((av)->sv_u.sv_array) +#define AvARRAY(av) ((av)->sv_u.svu_array) #define AvALLOC(av) (*((SV***)&((XPVAV*) SvANY(av))->xav_alloc)) #define AvMAX(av) ((XPVAV*) SvANY(av))->xav_max #define AvFILLp(av) ((XPVAV*) SvANY(av))->xav_fill diff --git a/hv.h b/hv.h index db6ad94..12029ce 100644 --- a/hv.h +++ b/hv.h @@ -213,7 +213,7 @@ C. #define Nullhv Null(HV*) -#define HvARRAY(hv) (*(HE***)&((hv)->sv_u.sv_array)) +#define HvARRAY(hv) (*(HE***)&((hv)->sv_u.svu_array)) #define HvFILL(hv) ((XPVHV*) SvANY(hv))->xhv_fill #define HvMAX(hv) ((XPVHV*) SvANY(hv))->xhv_max #define HvRITER(hv) (*Perl_hv_riter_p(aTHX_ (HV*)(hv))) diff --git a/sv.c b/sv.c index 67ef7e6..c838a6d 100644 --- a/sv.c +++ b/sv.c @@ -1845,7 +1845,7 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) case SVt_NULL: Perl_croak(aTHX_ "Can't upgrade to undef"); case SVt_IV: - SvANY(sv) = (XPVIV*)((char*)&(sv->sv_u.sv_iv) - STRUCT_OFFSET(XPVIV, xiv_iv)); + SvANY(sv) = (XPVIV*)((char*)&(sv->sv_u.svu_iv) - STRUCT_OFFSET(XPVIV, xiv_iv)); SvIV_set(sv, iv); break; case SVt_NV: @@ -1853,7 +1853,7 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) SvNV_set(sv, nv); break; case SVt_RV: - SvANY(sv) = &sv->sv_u.sv_rv; + SvANY(sv) = &sv->sv_u.svu_rv; SvRV_set(sv, (SV*)pv); break; case SVt_PVHV: @@ -3797,9 +3797,9 @@ Perl_sv_2bool(pTHX_ register SV *sv) if (SvPOKp(sv)) { register XPV* Xpvtmp; if ((Xpvtmp = (XPV*)SvANY(sv)) && - (*sv->sv_u.sv_pv > '0' || + (*sv->sv_u.svu_pv > '0' || Xpvtmp->xpv_cur > 1 || - (Xpvtmp->xpv_cur && *sv->sv_u.sv_pv != '0'))) + (Xpvtmp->xpv_cur && *sv->sv_u.svu_pv != '0'))) return 1; else return 0; @@ -5760,9 +5760,9 @@ Perl_sv_replace(pTHX_ register SV *sv, register SV *nsv) it would be unclear. */ if(SvTYPE(sv) == SVt_IV) SvANY(sv) - = (XPVIV*)((char*)&(sv->sv_u.sv_iv) - STRUCT_OFFSET(XPVIV, xiv_iv)); + = (XPVIV*)((char*)&(sv->sv_u.svu_iv) - STRUCT_OFFSET(XPVIV, xiv_iv)); else if (SvTYPE(sv) == SVt_RV) { - SvANY(sv) = &sv->sv_u.sv_rv; + SvANY(sv) = &sv->sv_u.svu_rv; } @@ -8039,7 +8039,7 @@ Perl_sv_true(pTHX_ register SV *sv) const register XPV* tXpv; if ((tXpv = (XPV*)SvANY(sv)) && (tXpv->xpv_cur > 1 || - (tXpv->xpv_cur && *sv->sv_u.sv_pv != '0'))) + (tXpv->xpv_cur && *sv->sv_u.svu_pv != '0'))) return 1; else return 0; @@ -10726,7 +10726,7 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) SvANY(dstr) = NULL; break; case SVt_IV: - SvANY(dstr) = (XPVIV*)((char*)&(dstr->sv_u.sv_iv) - STRUCT_OFFSET(XPVIV, xiv_iv)); + SvANY(dstr) = (XPVIV*)((char*)&(dstr->sv_u.svu_iv) - STRUCT_OFFSET(XPVIV, xiv_iv)); SvIV_set(dstr, SvIVX(sstr)); break; case SVt_NV: @@ -10734,7 +10734,7 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) SvNV_set(dstr, SvNVX(sstr)); break; case SVt_RV: - SvANY(dstr) = &(dstr->sv_u.sv_rv); + SvANY(dstr) = &(dstr->sv_u.svu_rv); Perl_rvpv_dup(aTHX_ dstr, sstr, param); break; case SVt_PV: diff --git a/sv.h b/sv.h index 69aad46..1533fb9 100644 --- a/sv.h +++ b/sv.h @@ -69,11 +69,11 @@ struct STRUCT_SV { /* struct sv { */ U32 sv_refcnt; /* how many references to us */ U32 sv_flags; /* what we are */ union { - IV sv_iv; - UV sv_uv; - SV* sv_rv; /* pointer to another SV */ - char* sv_pv; /* pointer to malloced string */ - SV** sv_array; + IV svu_iv; + UV svu_uv; + SV* svu_rv; /* pointer to another SV */ + char* svu_pv; /* pointer to malloced string */ + SV** svu_array; } sv_u; #ifdef DEBUG_LEAKING_SCALARS unsigned sv_debug_optype:9; /* the type of OP that allocated us */ @@ -89,11 +89,11 @@ struct gv { U32 sv_refcnt; /* how many references to us */ U32 sv_flags; /* what we are */ union { - IV sv_iv; - UV sv_uv; - SV* sv_rv; - char* sv_pv; - SV** sv_array; + IV svu_iv; + UV svu_uv; + SV* svu_rv; + char* svu_pv; + SV** svu_array; } sv_u; }; @@ -102,11 +102,11 @@ struct cv { U32 sv_refcnt; /* how many references to us */ U32 sv_flags; /* what we are */ union { - IV sv_iv; - UV sv_uv; - SV* sv_rv; - char* sv_pv; - SV** sv_array; + IV svu_iv; + UV svu_uv; + SV* svu_rv; + char* svu_pv; + SV** svu_array; } sv_u; }; @@ -115,11 +115,11 @@ struct av { U32 sv_refcnt; /* how many references to us */ U32 sv_flags; /* what we are */ union { - IV sv_iv; - UV sv_uv; - SV* sv_rv; - char* sv_pv; /* pointer to first array element */ - SV** sv_array; + IV svu_iv; + UV svu_uv; + SV* svu_rv; + char* svu_pv; /* pointer to first array element */ + SV** svu_array; } sv_u; }; @@ -128,11 +128,11 @@ struct hv { U32 sv_refcnt; /* how many references to us */ U32 sv_flags; /* what we are */ union { - IV sv_iv; - UV sv_uv; - SV* sv_rv; - char* sv_pv; - SV** sv_array; + IV svu_iv; + UV svu_uv; + SV* svu_rv; + char* svu_pv; + SV** svu_array; } sv_u; }; @@ -141,11 +141,11 @@ struct io { U32 sv_refcnt; /* how many references to us */ U32 sv_flags; /* what we are */ union { - IV sv_iv; - UV sv_uv; - SV* sv_rv; - char* sv_pv; - SV** sv_array; + IV svu_iv; + UV svu_uv; + SV* svu_rv; + char* svu_pv; + SV** svu_array; } sv_u; }; @@ -276,7 +276,7 @@ perform the upgrade if necessary. See C. struct xpv { IV xpv_dummy; /* This isn't allocated. */ - STRLEN xpv_cur; /* length of sv_pv as a C string */ + STRLEN xpv_cur; /* length of svu_pv as a C string */ STRLEN xpv_len; /* allocated size */ }; @@ -284,26 +284,26 @@ struct xpv { typedef struct xpv xpv_allocated; #else typedef struct { - STRLEN xpv_cur; /* length of sv_pv as a C string */ + STRLEN xpv_cur; /* length of svu_pv as a C string */ STRLEN xpv_len; /* allocated size */ } xpv_allocated; #endif struct xpviv { IV xiv_iv; /* integer value or pv offset */ - STRLEN xpv_cur; /* length of sv_pv as a C string */ + STRLEN xpv_cur; /* length of svu_pv as a C string */ STRLEN xpv_len; /* allocated size */ }; struct xpvuv { UV xuv_uv; /* unsigned value or pv offset */ - STRLEN xpv_cur; /* length of sv_pv as a C string */ + STRLEN xpv_cur; /* length of svu_pv as a C string */ STRLEN xpv_len; /* allocated size */ }; struct xpvnv { IV xiv_iv; /* integer value or pv offset */ - STRLEN xpv_cur; /* length of sv_pv as a C string */ + STRLEN xpv_cur; /* length of svu_pv as a C string */ STRLEN xpv_len; /* allocated size */ union { struct { @@ -322,7 +322,7 @@ struct xpvnv { /* These structure must match the beginning of struct xpvhv in hv.h. */ struct xpvmg { IV xiv_iv; /* integer value or pv offset */ - STRLEN xpv_cur; /* length of sv_pv as a C string */ + STRLEN xpv_cur; /* length of svu_pv as a C string */ STRLEN xpv_len; /* allocated size */ union { struct { @@ -340,7 +340,7 @@ struct xpvmg { struct xpvlv { IV xiv_iv; /* integer value or pv offset */ - STRLEN xpv_cur; /* length of sv_pv as a C string */ + STRLEN xpv_cur; /* length of svu_pv as a C string */ STRLEN xpv_len; /* allocated size */ union { struct { @@ -371,7 +371,7 @@ struct xpvlv { struct xpvgv { IV xiv_iv; /* integer value or pv offset */ - STRLEN xpv_cur; /* length of sv_pv as a C string */ + STRLEN xpv_cur; /* length of svu_pv as a C string */ STRLEN xpv_len; /* allocated size */ union { struct { @@ -395,7 +395,7 @@ struct xpvgv { struct xpvbm { IV xiv_iv; /* integer value or pv offset */ - STRLEN xpv_cur; /* length of sv_pv as a C string */ + STRLEN xpv_cur; /* length of svu_pv as a C string */ STRLEN xpv_len; /* allocated size */ union { struct { @@ -421,7 +421,7 @@ typedef U16 cv_flags_t; struct xpvfm { IV xiv_iv; /* integer value or pv offset */ - STRLEN xpv_cur; /* length of sv_pv as a C string */ + STRLEN xpv_cur; /* length of svu_pv as a C string */ STRLEN xpv_len; /* allocated size */ union { struct { @@ -455,7 +455,7 @@ struct xpvfm { struct xpvio { IV xiv_iv; /* integer value or pv offset */ - STRLEN xpv_cur; /* length of sv_pv as a C string */ + STRLEN xpv_cur; /* length of svu_pv as a C string */ STRLEN xpv_len; /* allocated size */ union { struct { @@ -865,9 +865,9 @@ in gv.h: */ #endif #ifdef PERL_DEBUG_COW -#define SvRV(sv) (0 + (sv)->sv_u.sv_rv) +#define SvRV(sv) (0 + (sv)->sv_u.svu_rv) #else -#define SvRV(sv) ((sv)->sv_u.sv_rv) +#define SvRV(sv) ((sv)->sv_u.svu_rv) #endif #define SvRVx(sv) SvRV(sv) @@ -875,10 +875,10 @@ in gv.h: */ #define SvIVX(sv) (0 + ((XPVIV*) SvANY(sv))->xiv_iv) #define SvUVX(sv) (0 + ((XPVUV*) SvANY(sv))->xuv_uv) #define SvNVX(sv) (0 + ((XPVNV*) SvANY(sv))->xnv_nv) -#define SvPVX(sv) (0 + (sv)->sv_u.sv_pv) +#define SvPVX(sv) (0 + (sv)->sv_u.svu_pv) #define SvCUR(sv) (0 + ((XPV*) SvANY(sv))->xpv_cur) #define SvLEN(sv) (0 + ((XPV*) SvANY(sv))->xpv_len) -#define SvEND(sv) ((sv)->sv_u.sv_pv + ((XPV*)SvANY(sv))->xpv_cur) +#define SvEND(sv) ((sv)->sv_u.svu_pv + ((XPV*)SvANY(sv))->xpv_cur) #ifdef DEBUGGING # ifdef PERL_IN_SV_C @@ -900,10 +900,10 @@ in gv.h: */ #define SvIVX(sv) ((XPVIV*) SvANY(sv))->xiv_iv #define SvUVX(sv) ((XPVUV*) SvANY(sv))->xuv_uv #define SvNVX(sv) ((XPVNV*) SvANY(sv))->xnv_nv -#define SvPVX(sv) ((sv)->sv_u.sv_pv) +#define SvPVX(sv) ((sv)->sv_u.svu_pv) #define SvCUR(sv) ((XPV*) SvANY(sv))->xpv_cur #define SvLEN(sv) ((XPV*) SvANY(sv))->xpv_len -#define SvEND(sv) ((sv)->sv_u.sv_pv + ((XPV*)SvANY(sv))->xpv_cur) +#define SvEND(sv) ((sv)->sv_u.svu_pv + ((XPV*)SvANY(sv))->xpv_cur) #ifdef DEBUGGING #define SvMAGIC(sv) (*(assert(SvTYPE(sv) >= SVt_PVMG), &((XPVMG*) SvANY(sv))->xmg_magic)) @@ -937,13 +937,13 @@ in gv.h: */ (((XPVNV*)SvANY(sv))->xnv_nv = (val)); } STMT_END #define SvPV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_PV); \ - ((sv)->sv_u.sv_pv = (val)); } STMT_END + ((sv)->sv_u.svu_pv = (val)); } STMT_END #define SvUV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ (((XPVUV*)SvANY(sv))->xuv_uv = (val)); } STMT_END #define SvRV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ - ((sv)->sv_u.sv_rv = (val)); } STMT_END + ((sv)->sv_u.svu_rv = (val)); } STMT_END #define SvMAGIC_set(sv, val) \ STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ (((XPVMG*)SvANY(sv))->xmg_magic = (val)); } STMT_END @@ -1267,7 +1267,7 @@ Like C but doesn't process magic. ? (({XPV *nxpv = (XPV*)SvANY(sv); \ nxpv && \ (nxpv->xpv_cur > 1 || \ - (nxpv->xpv_cur && *(sv)->sv_u.sv_pv != '0')); }) \ + (nxpv->xpv_cur && *(sv)->sv_u.svu_pv != '0')); }) \ ? 1 \ : 0) \ : \ @@ -1295,7 +1295,7 @@ Like C but doesn't process magic. : SvPOK(sv) \ ? ((PL_Xpv = (XPV*)SvANY(PL_Sv = (sv))) && \ (PL_Xpv->xpv_cur > 1 || \ - (PL_Xpv->xpv_cur && *PL_Sv->sv_u.sv_pv != '0')) \ + (PL_Xpv->xpv_cur && *PL_Sv->sv_u.svu_pv != '0')) \ ? 1 \ : 0) \ : \