diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 1998-01-24 12:02:34 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 1998-01-24 12:02:34 +0000 |
commit | 67a38de0970070c8aa928e300768e725698b3516 (patch) | |
tree | 397c37ef7b089378b20e2cd74f1dd039b17662df /av.c | |
parent | 31da6858e76569983828f43aec742159e881d627 (diff) | |
download | perl-67a38de0970070c8aa928e300768e725698b3516.tar.gz |
Gisle's av_unshift tweak, two small patches from chip
and check for NULL in hv_delete in case '~' and tie magic
are present
p4raw-id: //depot/ansiperl@438
Diffstat (limited to 'av.c')
-rw-r--r-- | av.c | 25 |
1 files changed, 9 insertions, 16 deletions
@@ -436,7 +436,7 @@ void av_unshift(register AV *av, register I32 num) { register I32 i; - register SV **sstr,**dstr; + register SV **ary; MAGIC* mg; if (!av || num <= 0) @@ -471,22 +471,15 @@ av_unshift(register AV *av, register I32 num) 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); } } |