av_unshift(register AV *av, register I32 num)
{
register I32 i;
- register SV **sstr,**dstr;
+ register SV **ary;
MAGIC* mg;
if (!av || num <= 0)
AvFILLp(av) += i;
SvPVX(av) = (char*)(AvARRAY(av) - i);
}
- if (num) {
- av_extend(av,AvFILLp(av)+num);
+ if (num) {
+ i = AvFILLp(av);
+ av_extend(av, i + num);
AvFILLp(av) += num;
- dstr = AvARRAY(av) + AvFILLp(av);
- sstr = dstr - num;
-#ifdef BUGGY_MSC5
- # pragma loop_opt(off) /* don't loop-optimize the following code */
-#endif /* BUGGY_MSC5 */
- for (i = AvFILLp(av) - num; i >= 0; --i) {
- *dstr-- = *sstr--;
-#ifdef BUGGY_MSC5
- # pragma loop_opt() /* loop-optimization back to command-line setting */
-#endif /* BUGGY_MSC5 */
- }
- while (num)
- AvARRAY(av)[--num] = &sv_undef;
+ ary = AvARRAY(av);
+ Move(ary, ary + num, i + 1, SV*);
+ do {
+ ary[--num] = &sv_undef;
+ } while (num);
}
}
register U32 hash;
register HE *entry;
register HE **oentry;
+ SV **svp;
SV *sv;
if (!hv)
bool needs_store;
hv_magic_check (hv, &needs_copy, &needs_store);
- if (needs_copy) {
- sv = *hv_fetch(hv, key, klen, TRUE);
+ if (needs_copy && (svp = hv_fetch(hv, key, klen, TRUE))) {
+ sv = *svp;
mg_clear(sv);
if (!needs_store) {
if (mg_find(sv, 'p')) {
bool needs_store;
hv_magic_check (hv, &needs_copy, &needs_store);
- if (needs_copy) {
- entry = hv_fetch_ent(hv, keysv, TRUE, hash);
+ if (needs_copy && (entry = hv_fetch_ent(hv, keysv, TRUE, hash))) {
sv = HeVAL(entry);
mg_clear(sv);
if (!needs_store) {
HV *newstash;
CV *caller;
AV* comppadlist;
+ I32 i;
in_eval = 1;
SAVEI32(max_intro_pending);
caller = compcv;
+ for (i = cxstack_ix - 1; i >= 0; i--) {
+ PERL_CONTEXT *cx = &cxstack[i];
+ if (cx->cx_type == CXt_EVAL)
+ break;
+ else if (cx->cx_type == CXt_SUB) {
+ caller = cx->blk_sub.cv;
+ break;
+ }
+ }
+
SAVESPTR(compcv);
compcv = (CV*)NEWSV(1104,0);
sv_upgrade((SV *)compcv, SVt_PVCV);
save_ary(GV *gv)
{
dTHR;
- AV *oav, *av;
+ AV *oav = GvAVn(gv);
+ AV *av;
+ if (!AvREAL(oav) && AvREIFY(oav))
+ av_reify(oav);
SSCHECK(3);
SSPUSHPTR(gv);
- SSPUSHPTR(oav = GvAVn(gv));
+ SSPUSHPTR(oav);
SSPUSHINT(SAVEt_AV);
GvAV(gv) = Null(AV*);