From ed6116ce9b9d13712ea252ee248b0400653db7f9 Mon Sep 17 00:00:00 2001 From: Larry Wall Date: Fri, 10 Dec 1993 00:00:00 +0000 Subject: 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] --- av.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'av.c') 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; } -- cgit v1.2.1