SV* shared_sv_attach_sv (SV* sv, shared_sv* shared) {
HV* shared_hv = get_hv("threads::shared::shared", FALSE);
- SV* id = newSViv((IV)shared);
+ SV* id = newSViv(PTR2IV(shared));
STRLEN length = sv_len(id);
SV* tiedobject;
SV** tiedobject_ = hv_fetch(shared_hv, SvPV(id,length), length, 0);
SV* obj_ref = newSViv(0);
SV* obj = newSVrv(obj_ref,"threads::shared::av");
AV* hv = newAV();
- sv_setiv(obj,(IV)shared);
+ sv_setiv(obj,PTR2IV(shared));
weakref = newRV((SV*)hv);
sv = newRV_noinc((SV*)hv);
sv_rvweaken(weakref);
SV* obj_ref = newSViv(0);
SV* obj = newSVrv(obj_ref,"threads::shared::hv");
HV* hv = newHV();
- sv_setiv(obj,(IV)shared);
+ sv_setiv(obj,PTR2IV(shared));
weakref = newRV((SV*)hv);
sv = newRV_noinc((SV*)hv);
sv_rvweaken(weakref);
default: {
MAGIC* shared_magic;
SV* value = newSVsv(SHAREDSvGET(shared));
- SV* obj = newSViv((IV)shared);
+ SV* obj = newSViv(PTR2IV(shared));
sv_magic(value, 0, PERL_MAGIC_ext, "threads::shared", 16);
shared_magic = mg_find(value, PERL_MAGIC_ext);
shared_magic->mg_virtual = &svtable;
- shared_magic->mg_obj = newSViv((IV)shared);
+ shared_magic->mg_obj = newSViv(PTR2IV(shared));
shared_magic->mg_flags |= MGf_REFCOUNTED;
shared_magic->mg_private = 0;
SvMAGICAL_on(value);
int shared_sv_fetch_mg (pTHX_ SV* sv, MAGIC *mg) {
- shared_sv* shared = (shared_sv*) SvIV(mg->mg_obj);
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(mg->mg_obj));
SHAREDSvLOCK(shared);
if(mg->mg_private != shared->index) {
if(SvROK(SHAREDSvGET(shared))) {
- shared_sv* target = (shared_sv*) SvIV(SvRV(SHAREDSvGET(shared)));
+ shared_sv* target = INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(shared))));
shared_sv_attach_sv(sv, target);
} else {
sv_setsv(sv, SHAREDSvGET(shared));
}
int shared_sv_store_mg (pTHX_ SV* sv, MAGIC *mg) {
- shared_sv* shared = (shared_sv*) SvIV(mg->mg_obj);
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(mg->mg_obj));
SHAREDSvLOCK(shared);
if(SvROK(SHAREDSvGET(shared)))
- Perl_sharedsv_thrcnt_dec(aTHX_ (shared_sv*) SvIV(SvRV(SHAREDSvGET(shared))));
+ Perl_sharedsv_thrcnt_dec(aTHX_ INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(shared)))));
if(SvROK(sv)) {
shared_sv* target = Perl_sharedsv_find(aTHX_ SvRV(sv));
if(!target) {
}
SHAREDSvEDIT(shared);
Perl_sv_free(PL_sharedsv_space,SHAREDSvGET(shared));
- SHAREDSvGET(shared) = newRV_noinc(newSViv((IV)target));
+ SHAREDSvGET(shared) = newRV_noinc(newSViv(PTR2IV(target)));
} else {
SHAREDSvEDIT(shared);
sv_setsv(SHAREDSvGET(shared), sv);
mg->mg_private = shared->index;
SHAREDSvRELEASE(shared);
if(SvROK(SHAREDSvGET(shared)))
- Perl_sharedsv_thrcnt_inc(aTHX_ (shared_sv*) SvIV(SvRV(SHAREDSvGET(shared))));
+ Perl_sharedsv_thrcnt_inc(aTHX_ INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(shared)))));
SHAREDSvUNLOCK(shared);
return 0;
}
int shared_sv_destroy_mg (pTHX_ SV* sv, MAGIC *mg) {
- shared_sv* shared = (shared_sv*) SvIV(mg->mg_obj);
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(mg->mg_obj));
if(!shared)
return 0;
{
HV* shared_hv = get_hv("threads::shared::shared", FALSE);
- SV* id = newSViv((IV)shared);
+ SV* id = newSViv(PTR2IV(shared));
STRLEN length = sv_len(id);
hv_delete(shared_hv, SvPV(id,length), length,0);
}
SV* perl
CODE:
shared_sv* shared;
- PerlInterpreter* origperl = (PerlInterpreter*) SvIV(perl);
+ PerlInterpreter* origperl = INT2PTR(PerlInterpreter*, SvIV(perl));
PerlInterpreter* oldperl = PERL_GET_CONTEXT;
if(SvROK(ref))
ref = SvRV(ref);
_thrcnt_dec(ref)
SV* ref
CODE:
- shared_sv* shared = (shared_sv*) SvIV(ref);
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(ref));
if(!shared)
croak("thrcnt can only be used on shared values");
Perl_sharedsv_thrcnt_dec(aTHX_ shared);
CODE:
shared_sv* shared = Perl_sharedsv_new(aTHX);
MAGIC* shared_magic;
- SV* obj = newSViv((IV)shared);
+ SV* obj = newSViv(PTR2IV(shared));
SHAREDSvEDIT(shared);
SHAREDSvGET(shared) = newSVsv(value);
SHAREDSvRELEASE(shared);
sv_magic(value, 0, PERL_MAGIC_ext, "threads::shared", 16);
shared_magic = mg_find(value, PERL_MAGIC_ext);
shared_magic->mg_virtual = &svtable;
- shared_magic->mg_obj = newSViv((IV)shared);
+ shared_magic->mg_obj = newSViv(PTR2IV(shared));
shared_magic->mg_flags |= MGf_REFCOUNTED;
shared_magic->mg_private = 0;
SvMAGICAL_on(value);
SV* value
CODE:
shared_sv* shared = Perl_sharedsv_new(aTHX);
- SV* obj = newSViv((IV)shared);
+ SV* obj = newSViv(PTR2IV(shared));
SHAREDSvEDIT(shared);
SHAREDSvGET(shared) = (SV*) newAV();
SHAREDSvRELEASE(shared);
SV* index
SV* value
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
shared_sv* slot;
SV* aentry;
SV** aentry_;
if(!target) {
Perl_croak(aTHX_ "You cannot assign a non shared reference to an shared array");
}
- value = newRV_noinc(newSViv((IV)target));
+ value = newRV_noinc(newSViv(PTR2IV(target)));
}
SHAREDSvLOCK(shared);
aentry_ = av_fetch((AV*) SHAREDSvGET(shared), SvIV(index), 0);
if(aentry_ && SvIV((*aentry_))) {
aentry = (*aentry_);
- slot = (shared_sv*) SvIV(aentry);
+ slot = INT2PTR(shared_sv*, SvIV(aentry));
if(SvROK(SHAREDSvGET(slot)))
- Perl_sharedsv_thrcnt_dec(aTHX_ (shared_sv*) SvIV(SvRV(SHAREDSvGET(slot))));
+ Perl_sharedsv_thrcnt_dec(aTHX_ INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(slot)))));
SHAREDSvEDIT(slot);
sv_setsv(SHAREDSvGET(slot), value);
SHAREDSvRELEASE(slot);
slot = Perl_sharedsv_new(aTHX);
SHAREDSvEDIT(shared);
SHAREDSvGET(slot) = newSVsv(value);
- aentry = newSViv((IV)slot);
+ aentry = newSViv(PTR2IV(slot));
av_store((AV*) SHAREDSvGET(shared), SvIV(index), aentry);
SHAREDSvRELEASE(shared);
}
if(SvROK(SHAREDSvGET(slot)))
- Perl_sharedsv_thrcnt_inc(aTHX_ (shared_sv*) SvIV(SvRV(SHAREDSvGET(slot))));
+ Perl_sharedsv_thrcnt_inc(aTHX_ INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(slot)))));
SHAREDSvUNLOCK(shared);
SV* self
SV* index
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
shared_sv* slot;
SV* aentry;
SV** aentry_;
if(SvTYPE(aentry) == SVt_NULL) {
retval = &PL_sv_undef;
} else {
- slot = (shared_sv*) SvIV(aentry);
+ slot = INT2PTR(shared_sv*, SvIV(aentry));
if(SvROK(SHAREDSvGET(slot))) {
- shared_sv* target = (shared_sv*) SvIV(SvRV(SHAREDSvGET(slot)));
+ shared_sv* target = INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(slot))));
retval = shared_sv_attach_sv(NULL,target);
} else {
retval = newSVsv(SHAREDSvGET(slot));
PUSH(self, ...)
SV* self
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
int i;
SHAREDSvLOCK(shared);
for(i = 1; i < items; i++) {
if(!target) {
Perl_croak(aTHX_ "You cannot assign a non shared reference to an shared array");
}
- tmp = newRV_noinc(newSViv((IV)target));
+ tmp = newRV_noinc(newSViv(PTR2IV(target)));
}
SHAREDSvEDIT(slot);
SHAREDSvGET(slot) = newSVsv(tmp);
- av_push((AV*) SHAREDSvGET(shared), newSViv((IV)slot));
+ av_push((AV*) SHAREDSvGET(shared), newSViv(PTR2IV(slot)));
SHAREDSvRELEASE(slot);
if(SvROK(SHAREDSvGET(slot)))
- Perl_sharedsv_thrcnt_inc(aTHX_ (shared_sv*) SvIV(SvRV(SHAREDSvGET(slot))));
+ Perl_sharedsv_thrcnt_inc(aTHX_ INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(slot)))));
}
SHAREDSvUNLOCK(shared);
UNSHIFT(self, ...)
SV* self
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
int i;
SHAREDSvLOCK(shared);
SHAREDSvEDIT(shared);
if(!target) {
Perl_croak(aTHX_ "You cannot assign a non shared reference to an shared array");
}
- tmp = newRV_noinc(newSViv((IV)target));
+ tmp = newRV_noinc(newSViv(PTR2IV(target)));
}
SHAREDSvEDIT(slot);
SHAREDSvGET(slot) = newSVsv(tmp);
- av_store((AV*) SHAREDSvGET(shared), i - 1, newSViv((IV)slot));
+ av_store((AV*) SHAREDSvGET(shared), i - 1, newSViv(PTR2IV(slot)));
SHAREDSvRELEASE(slot);
if(SvROK(SHAREDSvGET(slot)))
- Perl_sharedsv_thrcnt_inc(aTHX_ (shared_sv*) SvIV(SvRV(SHAREDSvGET(slot))));
+ Perl_sharedsv_thrcnt_inc(aTHX_ INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(slot)))));
}
SHAREDSvUNLOCK(shared);
POP(self)
SV* self
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
shared_sv* slot;
SV* retval;
SHAREDSvLOCK(shared);
retval = av_pop((AV*)SHAREDSvGET(shared));
SHAREDSvRELEASE(shared);
if(retval && SvIV(retval)) {
- slot = (shared_sv*) SvIV(retval);
+ slot = INT2PTR(shared_sv*, SvIV(retval));
if(SvROK(SHAREDSvGET(slot))) {
- shared_sv* target = (shared_sv*) SvIV(SvRV(SHAREDSvGET(slot)));
+ shared_sv* target = INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(slot))));
retval = shared_sv_attach_sv(NULL,target);
} else {
retval = newSVsv(SHAREDSvGET(slot));
SHIFT(self)
SV* self
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
shared_sv* slot;
SV* retval;
SHAREDSvLOCK(shared);
retval = av_shift((AV*)SHAREDSvGET(shared));
SHAREDSvRELEASE(shared);
if(retval && SvIV(retval)) {
- slot = (shared_sv*) SvIV(retval);
+ slot = INT2PTR(shared_sv*, SvIV(retval));
if(SvROK(SHAREDSvGET(slot))) {
- shared_sv* target = (shared_sv*) SvIV(SvRV(SHAREDSvGET(slot)));
+ shared_sv* target = INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(slot))));
retval = shared_sv_attach_sv(NULL,target);
} else {
retval = newSVsv(SHAREDSvGET(slot));
CLEAR(self)
SV* self
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
shared_sv* slot;
SV** svp;
I32 i;
i = AvFILLp((AV*)SHAREDSvGET(shared));
while ( i >= 0) {
if(SvIV(svp[i])) {
- Perl_sharedsv_thrcnt_dec(aTHX_ (shared_sv*) SvIV(svp[i]));
+ Perl_sharedsv_thrcnt_dec(aTHX_ INT2PTR(shared_sv*, SvIV(svp[i])));
}
i--;
}
SV* self
SV* count
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
SHAREDSvEDIT(shared);
av_extend((AV*)SHAREDSvGET(shared), (I32) SvIV(count));
SHAREDSvRELEASE(shared);
SV* self
SV* index
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
I32 exists;
SHAREDSvLOCK(shared);
exists = av_exists((AV*) SHAREDSvGET(shared), (I32) SvIV(index));
SV* self
SV* count
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
SHAREDSvEDIT(shared);
av_fill((AV*) SHAREDSvGET(shared), (I32) SvIV(count));
SHAREDSvRELEASE(shared);
FETCHSIZE(self)
SV* self
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
SHAREDSvLOCK(shared);
RETVAL = newSViv(av_len((AV*) SHAREDSvGET(shared)) + 1);
SHAREDSvUNLOCK(shared);
SV* self
SV* index
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
shared_sv* slot;
SHAREDSvLOCK(shared);
if(av_exists((AV*) SHAREDSvGET(shared), (I32) SvIV(index))) {
tmp = av_delete((AV*)SHAREDSvGET(shared), (I32) SvIV(index),0);
SHAREDSvRELEASE(shared);
if(SvIV(tmp)) {
- slot = (shared_sv*) SvIV(tmp);
+ slot = INT2PTR(shared_sv*, SvIV(tmp));
if(SvROK(SHAREDSvGET(slot))) {
- shared_sv* target = (shared_sv*) SvIV(SvRV(SHAREDSvGET(slot)));
+ shared_sv* target = INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(slot))));
RETVAL = shared_sv_attach_sv(NULL,target);
} else {
RETVAL = newSVsv(SHAREDSvGET(slot));
SV* value
CODE:
shared_sv* shared = Perl_sharedsv_new(aTHX);
- SV* obj = newSViv((IV)shared);
+ SV* obj = newSViv(PTR2IV(shared));
SHAREDSvEDIT(shared);
SHAREDSvGET(shared) = (SV*) newHV();
SHAREDSvRELEASE(shared);
SV* key
SV* value
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
shared_sv* slot;
SV* hentry;
SV** hentry_;
Perl_croak(aTHX_ "You cannot assign a non shared reference to a shared hash");
}
SHAREDSvEDIT(shared);
- value = newRV_noinc(newSViv((IV)target));
+ value = newRV_noinc(newSViv(PTR2IV(target)));
SHAREDSvRELEASE(shared);
}
hentry_ = hv_fetch((HV*) SHAREDSvGET(shared), ckey, len, 0);
if(hentry_ && SvIV((*hentry_))) {
hentry = (*hentry_);
- slot = (shared_sv*) SvIV(hentry);
+ slot = INT2PTR(shared_sv*, SvIV(hentry));
if(SvROK(SHAREDSvGET(slot)))
- Perl_sharedsv_thrcnt_dec(aTHX_ (shared_sv*) SvIV(SvRV(SHAREDSvGET(slot))));
+ Perl_sharedsv_thrcnt_dec(aTHX_ INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(slot)))));
SHAREDSvEDIT(slot);
sv_setsv(SHAREDSvGET(slot), value);
SHAREDSvRELEASE(slot);
slot = Perl_sharedsv_new(aTHX);
SHAREDSvEDIT(shared);
SHAREDSvGET(slot) = newSVsv(value);
- hentry = newSViv((IV)slot);
+ hentry = newSViv(PTR2IV(slot));
hv_store((HV*) SHAREDSvGET(shared), ckey,len , hentry, 0);
SHAREDSvRELEASE(shared);
}
if(SvROK(SHAREDSvGET(slot)))
- Perl_sharedsv_thrcnt_inc(aTHX_ (shared_sv*) SvIV(SvRV(SHAREDSvGET(slot))));
+ Perl_sharedsv_thrcnt_inc(aTHX_ INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(slot)))));
SHAREDSvUNLOCK(shared);
SV* self
SV* key
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
shared_sv* slot;
SV* hentry;
SV** hentry_;
if(SvTYPE(hentry) == SVt_NULL) {
retval = &PL_sv_undef;
} else {
- slot = (shared_sv*) SvIV(hentry);
+ slot = INT2PTR(shared_sv*, SvIV(hentry));
if(SvROK(SHAREDSvGET(slot))) {
- shared_sv* target = (shared_sv*) SvIV(SvRV(SHAREDSvGET(slot)));
+ shared_sv* target = INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(slot))));
retval = shared_sv_attach_sv(NULL, target);
} else {
retval = newSVsv(SHAREDSvGET(slot));
CLEAR(self)
SV* self
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
shared_sv* slot;
HE* entry;
SHAREDSvLOCK(shared);
Perl_hv_iterinit(PL_sharedsv_space, (HV*) SHAREDSvGET(shared));
entry = Perl_hv_iternext(PL_sharedsv_space, (HV*) SHAREDSvGET(shared));
while(entry) {
- slot = (shared_sv*) SvIV(Perl_hv_iterval(PL_sharedsv_space, (HV*) SHAREDSvGET(shared), entry));
+ slot = INT2PTR(shared_sv*, SvIV(Perl_hv_iterval(PL_sharedsv_space, (HV*) SHAREDSvGET(shared), entry)));
Perl_sharedsv_thrcnt_dec(aTHX_ slot);
entry = Perl_hv_iternext(PL_sharedsv_space,(HV*) SHAREDSvGET(shared));
}
FIRSTKEY(self)
SV* self
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
char* key = NULL;
I32 len;
HE* entry;
SV* self
SV* oldkey
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
char* key = NULL;
I32 len;
HE* entry;
SV* self
SV* key
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
STRLEN len;
char* ckey = SvPV(key, len);
SHAREDSvLOCK(shared);
SV* self
SV* key
CODE:
- shared_sv* shared = (shared_sv*) SvIV(SvRV(self));
+ shared_sv* shared = INT2PTR(shared_sv*, SvIV(SvRV(self)));
shared_sv* slot;
STRLEN len;
char* ckey = SvPV(key, len);
tmp = hv_delete((HV*) SHAREDSvGET(shared), ckey, len,0);
SHAREDSvRELEASE(shared);
if(tmp) {
- slot = (shared_sv*) SvIV(tmp);
+ slot = INT2PTR(shared_sv*, SvIV(tmp));
if(SvROK(SHAREDSvGET(slot))) {
- shared_sv* target = (shared_sv*) SvIV(SvRV(SHAREDSvGET(slot)));
+ shared_sv* target = INT2PTR(shared_sv*, SvIV(SvRV(SHAREDSvGET(slot))));
RETVAL = shared_sv_attach_sv(NULL, target);
} else {
RETVAL = newSVsv(SHAREDSvGET(slot));