Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ${a[(i)pattern]} if a=()
- X-seq: zsh-workers 24718
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Subject: Re: ${a[(i)pattern]} if a=()
- Date: Sun, 16 Mar 2008 10:59:24 -0700
- In-reply-to: <080316102021.ZM28339@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20080316144038.GA4910@xxxxxxxxxxxxxxx> <080316102021.ZM28339@xxxxxxxxxxxxxxxxxxxxxx>
On Mar 16, 10:20am, Bart Schaefer wrote:
}
} } $ zsh -f -c 'a=(); echo ${a[(i)a]}'
} } 0
}
} Hmm ... it seems it has always returned zero when the array is empty.
} It would seem to make more sense for it to return 1, but I'm worried
} there are other unforseen consequences.
The patch is trivial and all tests still pass. Thoughts?
Index: Src/params.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/params.c,v
retrieving revision 1.40
diff -c -r1.40 params.c
--- ../zsh-forge/current/Src/params.c 11 Jan 2008 01:18:07 -0000
+++ Src/params.c 16 Mar 2008 17:52:10 -0000
@@ -1317,7 +1317,7 @@
} else
ta = getarrvalue(v);
if (!ta || !*ta)
- return 0;
+ return !down;
len = arrlen(ta);
if (beg < 0)
beg += len;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author