summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>1998-01-24 12:02:34 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>1998-01-24 12:02:34 +0000
commit67a38de0970070c8aa928e300768e725698b3516 (patch)
tree397c37ef7b089378b20e2cd74f1dd039b17662df /av.c
parent31da6858e76569983828f43aec742159e881d627 (diff)
downloadperl-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.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/av.c b/av.c
index 5925a17869..20c77d8444 100644
--- a/av.c
+++ b/av.c
@@ -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);
}
}