tmp = AvARRAY(av) - AvALLOC(av);
Move(AvARRAY(av), AvALLOC(av), AvFILLp(av)+1, SV*);
AvMAX(av) += tmp;
- SvPVX(av) = (char*)AvALLOC(av);
+ SvPV_set(av, (char*)AvALLOC(av));
if (AvREAL(av)) {
while (tmp)
ary[--tmp] = &PL_sv_undef;
ary[--tmp] = &PL_sv_undef;
}
- SvPVX(av) = (char*)AvALLOC(av);
+ SvPV_set(av, (char*)AvALLOC(av));
AvMAX(av) = newmax;
}
}
sv_upgrade((SV *)av, SVt_PVAV);
AvREAL_on(av);
AvALLOC(av) = 0;
- SvPVX(av) = 0;
+ SvPV_set(av, (char*)0);
AvMAX(av) = AvFILLp(av) = -1;
return av;
}
register I32 i;
New(4,ary,size,SV*);
AvALLOC(av) = ary;
- SvPVX(av) = (char*)ary;
+ SvPV_set(av, (char*)ary);
AvFILLp(av) = size - 1;
AvMAX(av) = size - 1;
for (i = 0; i < size; i++) {
AvALLOC(av) = ary;
Copy(strp,ary,size,SV*);
AvFLAGS(av) = AVf_REIFY;
- SvPVX(av) = (char*)ary;
+ SvPV_set(av, (char*)ary);
AvFILLp(av) = size - 1;
AvMAX(av) = size - 1;
while (size--) {
}
if ((key = AvARRAY(av) - AvALLOC(av))) {
AvMAX(av) += key;
- SvPVX(av) = (char*)AvALLOC(av);
+ SvPV_set(av, (char*)AvALLOC(av));
}
AvFILLp(av) = -1;
}
Safefree(AvALLOC(av));
AvALLOC(av) = 0;
- SvPVX(av) = 0;
+ SvPV_set(av, (char*)0);
AvMAX(av) = AvFILLp(av) = -1;
if (AvARYLEN(av)) {
SvREFCNT_dec(AvARYLEN(av));
AvMAX(av) += i;
AvFILLp(av) += i;
- SvPVX(av) = (char*)(AvARRAY(av) - i);
+ SvPV_set(av, (char*)(AvARRAY(av) - i));
}
if (num) {
i = AvFILLp(av);
/* Make extra elements into a buffer */
AvMAX(av) -= slide;
AvFILLp(av) -= slide;
- SvPVX(av) = (char*)(AvARRAY(av) + slide);
+ SvPV_set(av, (char*)(AvARRAY(av) + slide));
}
}
retval = *AvARRAY(av);
if (AvREAL(av))
*AvARRAY(av) = &PL_sv_undef;
- SvPVX(av) = (char*)(AvARRAY(av) + 1);
+ SvPV_set(av, (char*)(AvARRAY(av) + 1));
AvMAX(av)--;
AvFILLp(av)--;
if (SvSMAGICAL(av))
#define CLEAR_ARGARRAY(ary) \
STMT_START { \
AvMAX(ary) += AvARRAY(ary) - AvALLOC(ary); \
- SvPVX(ary) = (char*)AvALLOC(ary); \
+ SvPV_set(ary, (char*)AvALLOC(ary)); \
AvFILLp(ary) = -1; \
} STMT_END
use = e->base.bufsiz;
}
}
- SvPVX(e->dataSV) = (char *) ptr;
+ SvPV_set(e->dataSV, (char *) ptr);
SvLEN(e->dataSV) = 0; /* Hands off sv.c - it isn't yours */
SvCUR_set(e->dataSV,use);
SvPOK_only(e->dataSV);
SAVETMPS;
str = sv_newmortal();
sv_upgrade(str, SVt_PV);
- SvPVX(str) = (char*)e->base.ptr;
+ SvPV_set(str, (char*)e->base.ptr);
SvLEN(str) = 0;
SvCUR_set(str, e->base.end - e->base.ptr);
SvPOK_only(str);
bytes_from_utf8 returned us. */
SvUPGRADE(in, SVt_PV);
SvPOK_on(in);
- SvPVX(in) = asbytes;
+ SvPV_set(in, asbytes);
SvLEN(in) = klen_tmp;
SvCUR(in) = klen_tmp - 1;
}
sv_upgrade((SV*)gv, SVt_PVGV);
if (SvLEN(gv)) {
if (proto) {
- SvPVX(gv) = NULL;
+ SvPV_set(gv, NULL);
SvLEN(gv) = 0;
SvPOK_off(gv);
} else
* pass along the same data via some unused fields in the CV
*/
CvSTASH(cv) = stash;
- SvPVX(cv) = (char *)name; /* cast to lose constness warning */
+ SvPV_set(cv, (char *)name); /* cast to lose constness warning */
SvCUR(cv) = len;
return gv;
}
}
SvPOK_off(sv);
- SvPVX(sv) = Nullch;
+ SvPV_set(sv, Nullch);
SvCUR(sv) = SvLEN(sv) = 0;
*size = malloced_size(pv) + M_OVERHEAD;
return pv - sizeof(union overhead);
SvFLAGS(PL_thrsv) = SVt_PV;
SvANY(PL_thrsv) = (void*)xpv;
SvREFCNT(PL_thrsv) = 1 << 30; /* practically infinite */
- SvPVX(PL_thrsv) = (char*)thr;
+ SvPV_set(PL_thrsvr, (char*)thr);
SvCUR_set(PL_thrsv, sizeof(thr));
SvLEN_set(PL_thrsv, sizeof(thr));
*SvEND(PL_thrsv) = '\0'; /* in the trailing_nul field */
*dst-- = *src--;
}
dst = AvARRAY(ary);
- SvPVX(ary) = (char*)(AvARRAY(ary) - diff); /* diff is negative */
+ SvPV_set(ary, (char*)(AvARRAY(ary) - diff)); /* diff is negative */
AvMAX(ary) += diff;
}
else {
dst = src - diff;
Move(src, dst, offset, SV*);
}
- SvPVX(ary) = (char*)(AvARRAY(ary) - diff);/* diff is positive */
+ SvPV_set(ary, (char*)(AvARRAY(ary) - diff));/* diff is positive */
AvMAX(ary) += diff;
AvFILLp(ary) += diff;
}
if (SvLEN(targ))
Safefree(SvPVX(targ));
}
- SvPVX(targ) = SvPVX(dstr);
+ SvPV_set(targ, SvPVX(dstr));
SvCUR_set(targ, SvCUR(dstr));
SvLEN_set(targ, SvLEN(dstr));
if (DO_UTF8(dstr))
SvUTF8_on(targ);
- SvPVX(dstr) = 0;
+ SvPV_set(dstr, (char*)0);
sv_free(dstr);
TAINT_IF(cx->sb_rxtainted & 1);
ary = AvALLOC(av);
if (AvARRAY(av) != ary) {
AvMAX(av) += AvARRAY(av) - AvALLOC(av);
- SvPVX(av) = (char*)ary;
+ SvPV_set(av, (char*)ary);
}
if (items >= AvMAX(av) + 1) {
AvMAX(av) = items - 1;
Renew(ary,items+1,SV*);
AvALLOC(av) = ary;
- SvPVX(av) = (char*)ary;
+ SvPV_set(av, (char*)ary);
}
}
++mark;
if (SvLEN(TARG))
Safefree(SvPVX(TARG));
}
- SvPVX(TARG) = SvPVX(dstr);
+ SvPV_set(TARG, SvPVX(dstr));
SvCUR_set(TARG, SvCUR(dstr));
SvLEN_set(TARG, SvLEN(dstr));
doutf8 |= DO_UTF8(dstr);
- SvPVX(dstr) = 0;
+ SvPV_set(dstr, (char*)0);
sv_free(dstr);
TAINT_IF(rxtainted & 1);
ary = AvALLOC(av);
if (AvARRAY(av) != ary) {
AvMAX(av) += AvARRAY(av) - AvALLOC(av);
- SvPVX(av) = (char*)ary;
+ SvPV_set(av, (char*)ary);
}
if (items > AvMAX(av) + 1) {
AvMAX(av) = items - 1;
Renew(ary,items,SV*);
AvALLOC(av) = ary;
- SvPVX(av) = (char*)ary;
+ SvPV_set(av, (char*)ary);
}
}
Copy(MARK,AvARRAY(av),items,SV*);
}
if (SvLEN(sv) != 0)
Safefree(from_start);
- SvPVX(sv) = to_start;
+ SvPV_set(sv, to_start);
SvCUR(sv) = to_ptr - to_start;
SvLEN(sv) = len;
SvUTF8_on(sv);
SV** ary = AvALLOC(av);
if (AvARRAY(av) != ary) {
AvMAX(av) += AvARRAY(av) - AvALLOC(av);
- SvPVX(av) = (char*)ary;
+ SvPV_set(av, (char*)ary);
}
if (AvMAX(av) < 1) {
AvMAX(av) = 1;
Renew(ary,2,SV*);
- SvPVX(av) = (char*)ary;
+ SvPV_set(av, (char*)ary);
}
}
AvFILLp(av) = 1;
if (SvPVX(gv) && SvLEN(gv) > 0) {
Safefree(SvPVX(gv));
}
- SvPVX(gv) = (char *)SSPOPPTR;
+ SvPV_set(gv, (char *)SSPOPPTR);
SvCUR(gv) = (STRLEN)SSPOPIV;
SvLEN(gv) = (STRLEN)SSPOPIV;
gp_free(gv);
break;
case SVt_PV:
SvANY(sv) = new_XPV();
- SvPVX(sv) = pv;
+ SvPV_set(sv, pv);
SvCUR(sv) = cur;
SvLEN(sv) = len;
break;
case SVt_PVIV:
SvANY(sv) = new_XPVIV();
- SvPVX(sv) = pv;
+ SvPV_set(sv, pv);
SvCUR(sv) = cur;
SvLEN(sv) = len;
SvIV_set(sv, iv);
break;
case SVt_PVNV:
SvANY(sv) = new_XPVNV();
- SvPVX(sv) = pv;
+ SvPV_set(sv, pv);
SvCUR(sv) = cur;
SvLEN(sv) = len;
SvIV_set(sv, iv);
break;
case SVt_PVMG:
SvANY(sv) = new_XPVMG();
- SvPVX(sv) = pv;
+ SvPV_set(sv, pv);
SvCUR(sv) = cur;
SvLEN(sv) = len;
SvIV_set(sv, iv);
break;
case SVt_PVLV:
SvANY(sv) = new_XPVLV();
- SvPVX(sv) = pv;
+ SvPV_set(sv, pv);
SvCUR(sv) = cur;
SvLEN(sv) = len;
SvIV_set(sv, iv);
SvANY(sv) = new_XPVAV();
if (pv)
Safefree(pv);
- SvPVX(sv) = 0;
+ SvPV_set(sv, (char*)0);
AvMAX(sv) = -1;
AvFILLp(sv) = -1;
SvIV_set(sv, 0);
SvANY(sv) = new_XPVHV();
if (pv)
Safefree(pv);
- SvPVX(sv) = 0;
+ SvPV_set(sv, (char*)0);
HvFILL(sv) = 0;
HvMAX(sv) = 0;
HvTOTALKEYS(sv) = 0;
case SVt_PVCV:
SvANY(sv) = new_XPVCV();
Zero(SvANY(sv), 1, XPVCV);
- SvPVX(sv) = pv;
+ SvPV_set(sv, pv);
SvCUR(sv) = cur;
SvLEN(sv) = len;
SvIV_set(sv, iv);
break;
case SVt_PVGV:
SvANY(sv) = new_XPVGV();
- SvPVX(sv) = pv;
+ SvPV_set(sv, pv);
SvCUR(sv) = cur;
SvLEN(sv) = len;
SvIV_set(sv, iv);
break;
case SVt_PVBM:
SvANY(sv) = new_XPVBM();
- SvPVX(sv) = pv;
+ SvPV_set(sv, pv);
SvCUR(sv) = cur;
SvLEN(sv) = len;
SvIV_set(sv, iv);
case SVt_PVFM:
SvANY(sv) = new_XPVFM();
Zero(SvANY(sv), 1, XPVFM);
- SvPVX(sv) = pv;
+ SvPV_set(sv, pv);
SvCUR(sv) = cur;
SvLEN(sv) = len;
SvIV_set(sv, iv);
case SVt_PVIO:
SvANY(sv) = new_XPVIO();
Zero(SvANY(sv), 1, XPVIO);
- SvPVX(sv) = pv;
+ SvPV_set(sv, pv);
SvCUR(sv) = cur;
SvLEN(sv) = len;
SvIV_set(sv, iv);
if (SvIVX(sv)) {
char *s = SvPVX(sv);
SvLEN(sv) += SvIVX(sv);
- SvPVX(sv) -= SvIVX(sv);
+ SvPV_set(sv, SvPVX(sv) - SvIVX(sv));
SvIV_set(sv, 0);
Move(s, SvPVX(sv), SvCUR(sv)+1, char);
}
(void)SvOOK_off(sv);
s = (U8*)SvPVX(sv);
len = SvCUR(sv) + 1; /* Plus the \0 */
- SvPVX(sv) = (char*)bytes_to_utf8((U8*)s, &len);
+ SvPV_set(sv, (char*)bytes_to_utf8((U8*)s, &len));
SvCUR(sv) = len - 1;
if (SvLEN(sv) != 0)
Safefree(s); /* No longer using what was there before. */
if (SvPVX(sv) && SvLEN(sv))
Safefree(SvPVX(sv));
Renew(ptr, len+1, char);
- SvPVX(sv) = ptr;
+ SvPV_set(sv, ptr);
SvCUR_set(sv, len);
SvLEN_set(sv, len+1);
*SvEND(sv) = '\0';
SvFAKE_off(sv);
SvREADONLY_off(sv);
/* This SV doesn't own the buffer, so need to New() a new one: */
- SvPVX(sv) = 0;
+ SvPV_set(sv, (char*)0);
SvLEN(sv) = 0;
if (flags & SV_COW_DROP_PV) {
/* OK, so we don't need to copy our buffer. */
U32 hash = SvUVX(sv);
SvFAKE_off(sv);
SvREADONLY_off(sv);
- SvPVX(sv) = 0;
+ SvPV_set(sv, (char*)0);
SvLEN(sv) = 0;
SvGROW(sv, len + 1);
Move(pvx,SvPVX(sv),len,char);
SvNIOK_off(sv);
SvLEN(sv) -= delta;
SvCUR(sv) -= delta;
- SvPVX(sv) += delta;
+ SvPV_set(sv, SvPVX(sv) + delta);
SvIV_set(sv, SvIVX(sv) + delta);
}
PERL_HASH(hash, src, len);
new_SV(sv);
sv_upgrade(sv, SVt_PVIV);
- SvPVX(sv) = sharepvn(src, is_utf8?-len:len, hash);
+ SvPV_set(sv, sharepvn(src, is_utf8?-len:len, hash));
SvCUR(sv) = len;
SvUV_set(sv, hash);
SvLEN(sv) = 0;
SvRV(dstr) = SvWEAKREF(sstr)
? sv_dup(SvRV(sstr), param)
: sv_dup_inc(SvRV(sstr), param);
+
}
else if (SvPVX(sstr)) {
/* Has something there */
if (SvLEN(sstr)) {
/* Normal PV - clone whole allocated space */
- SvPVX(dstr) = SAVEPVN(SvPVX(sstr), SvLEN(sstr)-1);
+ SvPV_set(dstr, SAVEPVN(SvPVX(sstr), SvLEN(sstr)-1));
if (SvREADONLY(sstr) && SvFAKE(sstr)) {
/* Not that normal - actually sstr is copy on write.
But we are a true, independant SV, so: */
and they should not have these flags
turned off */
- SvPVX(dstr) = sharepvn(SvPVX(sstr), SvCUR(sstr),
- SvUVX(sstr));
+ SvPV_set(dstr, sharepvn(SvPVX(sstr), SvCUR(sstr),
+ SvUVX(sstr)));
SvUV_set(dstr, SvUVX(sstr));
} else {
- SvPVX(dstr) = SAVEPVN(SvPVX(sstr), SvCUR(sstr));
+ SvPV_set(dstr, SAVEPVN(SvPVX(sstr), SvCUR(sstr)));
SvFAKE_off(dstr);
SvREADONLY_off(dstr);
}
}
else {
/* Some other special case - random pointer */
- SvPVX(dstr) = SvPVX(sstr);
+ SvPV_set(dstr, SvPVX(sstr));
}
}
}
else {
/* Copy the Null */
- SvPVX(dstr) = SvPVX(sstr);
+ if (SvTYPE(dstr) == SVt_RV)
+ SvRV(dstr) = 0;
+ else
+ SvPV_set(dstr, 0);
}
}
src_ary = AvARRAY((AV*)sstr);
Newz(0, dst_ary, AvMAX((AV*)sstr)+1, SV*);
ptr_table_store(PL_ptr_table, src_ary, dst_ary);
- SvPVX(dstr) = (char*)dst_ary;
+ SvPV_set(dstr, (char*)dst_ary);
AvALLOC((AV*)dstr) = dst_ary;
if (AvREAL((AV*)sstr)) {
while (items-- > 0)
}
}
else {
- SvPVX(dstr) = Nullch;
+ SvPV_set(dstr, Nullch);
AvALLOC((AV*)dstr) = (SV**)NULL;
}
break;
(bool)!!HvSHAREKEYS(sstr), param);
}
else {
- SvPVX(dstr) = Nullch;
+ SvPV_set(dstr, Nullch);
HvEITER((HV*)dstr) = (HE*)NULL;
}
HvPMROOT((HV*)dstr) = HvPMROOT((HV*)sstr); /* XXX */
SvREFCNT(&PL_sv_no) = (~(U32)0)/2;
SvFLAGS(&PL_sv_no) = SVp_IOK|SVf_IOK|SVp_NOK|SVf_NOK
|SVp_POK|SVf_POK|SVf_READONLY|SVt_PVNV;
- SvPVX(&PL_sv_no) = SAVEPVN(PL_No, 0);
+ SvPV_set(&PL_sv_no, SAVEPVN(PL_No, 0));
SvCUR(&PL_sv_no) = 0;
SvLEN(&PL_sv_no) = 1;
SvIV_set(&PL_sv_no, 0);
SvREFCNT(&PL_sv_yes) = (~(U32)0)/2;
SvFLAGS(&PL_sv_yes) = SVp_IOK|SVf_IOK|SVp_NOK|SVf_NOK
|SVp_POK|SVf_POK|SVf_READONLY|SVt_PVNV;
- SvPVX(&PL_sv_yes) = SAVEPVN(PL_Yes, 1);
+ SvPV_set(&PL_sv_yes, SAVEPVN(PL_Yes, 1));
SvCUR(&PL_sv_yes) = 1;
SvLEN(&PL_sv_yes) = 2;
SvIV_set(&PL_sv_yes, 1);