848: ptr = (void*)&PL_curpad[SSPOPLONG]; 849: sv = *(SV**)ptr; 850: 858: /* Can clear pad variable in place? */ 859: if (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) { 860: /* 861: * if a my variable that was made readonly is going out of 862: * scope, we want to remove the readonlyness so that it can 863: * go out of scope quietly 864: */ 865: if (SvPADMY(sv) && !SvFAKE(sv)) 866: SvREADONLY_off(sv); 867: 868: if (SvTHINKFIRST(sv)) 869: sv_force_normal_flags(sv, SV_IMMEDIATE_UNREF); 870: if (SvMAGICAL(sv)) 871: mg_free(sv); 872: 885: SvOK_off(sv); 888: SvPADSTALE_on(sv); /* mark as no longer live */ 889: } 890: else { /* Someone has a claim on this, so abandon it. */ 891: const U32 padflags = SvFLAGS(sv) & (SVs_PADMY|SVs_PADTMP); 895: *(SV**)ptr = newSV(0); 897: SvREFCNT_dec(sv); /* Cast current value to the winds. */ 898: /* preserve pad nature, but also mark as not live 899: * for any closure capturing */ 900: SvFLAGS(*(SV**)ptr) |= padflags | SVs_PADSTALE; 901: }