summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorLarry Wall <larry@netlabs.com>1993-12-10 00:00:00 +0000
committerLarry Wall <larry@netlabs.com>1993-12-10 00:00:00 +0000
commited6116ce9b9d13712ea252ee248b0400653db7f9 (patch)
tree348e8de37401fa4381f6bfe0989abef2e3b409e0 /av.c
parent9bbf408117c16189b372e6657c9e5a15d01ea504 (diff)
downloadperl-ed6116ce9b9d13712ea252ee248b0400653db7f9.tar.gz
perl 5.0 alpha 5
[editor's note: the sparc executables have not been included, and emacs backup files and other cruft such as patch backup files have been removed. This was reconstructed from a tarball found on the September 1994 InfoMagic CD]
Diffstat (limited to 'av.c')
-rw-r--r--av.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/av.c b/av.c
index 822f935c7b..dd54bd5d01 100644
--- a/av.c
+++ b/av.c
@@ -51,15 +51,20 @@ I32 lval;
}
if (key < 0 || key > AvFILL(av)) {
- if (lval && key >= 0) {
+ if (key < 0) {
+ key += AvFILL(av) + 1;
+ if (key < 0)
+ return 0;
+ }
+ else {
+ if (!lval)
+ return 0;
if (AvREAL(av))
sv = NEWSV(5,0);
else
sv = sv_mortalcopy(&sv_undef);
return av_store(av,key,sv);
}
- else
- return 0;
}
if (!AvARRAY(av)[key]) {
if (lval) {
@@ -80,8 +85,11 @@ SV *val;
I32 tmp;
SV** ary;
- if (key < 0)
- return 0;
+ if (key < 0) {
+ key += AvFILL(av) + 1;
+ if (key < 0)
+ return 0;
+ }
if (SvMAGICAL(av)) {
if (mg_find((SV*)av,'P')) {
@@ -181,6 +189,7 @@ register SV **strp;
}
strp++;
}
+ SvOK_on(av);
return av;
}
@@ -207,6 +216,7 @@ register SV **strp;
SvTEMP_off(*strp);
strp++;
}
+ SvOK_on(av);
return av;
}