Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Optimization of getarrvalue()
- X-seq: zsh-workers 39893
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] Optimization of getarrvalue()
- Date: Wed, 9 Nov 2016 08:03:28 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=SLVgFkB+WoQ4CGwzce8lt/F4XRt3r5w6mk4xVqodUwA=; b=up+S30MOpQkJ6ChoKPOGBUozeGwJxchUobAS7U+nfXVU/ZBN6A2631cqpI5kluYv5u ZyqGB/8lS8iAwwZTNRd8qd4B7AAk+mk5cSm7I96eqQflfZuv0S8SIbcX80wJzevMruFf BBIGvc/Jqdyf0yMp2hXRpVesItzuo3ZlVUscJvP1sPdASHtvDkoCh30PgTqpU5gvRK20 iqak8dRL8zLrkn5RsDJANprcd1HOrabf6ORKrBCYgU/z25ayYvFJOgLBI2dR0w0MgQNO EdOSJTi5rmQIoqsliQpg7ZUIGTf4kHlJF3uVhkt7XzpG/YE8GIeYaJ7XQmufVCsBgDq3 6cCA==
- In-reply-to: <20161109114207.6b929440@pwslap01u.europe.root.pri>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20161108201233epcas1p1e2900e2d67af8b8558ebdb70eb7ad480@epcas1p1.samsung.com> <1478635899.1897979.781551353.05792438@webmail.messagingengine.com> <20161109114207.6b929440@pwslap01u.europe.root.pri>
On Nov 9, 11:42am, Peter Stephenson wrote:
}
} + } else if (v->end <= v->start) {
} + s = arrdup_max(s, 1);
} + s[0] = NULL;
Might as well make it obvious?
diff --git a/Src/params.c b/Src/params.c
index ef72cba..6736aa5 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -2293,10 +2293,9 @@ getarrvalue(Value v)
/* Null if 1) array too short, 2) index still negative */
if (arrlen_lt(s, v->start) || v->start < 0) {
- s = arrdup(nular);
+ s = arrdup_max(nular, 1);
} else if (v->end <= v->start) {
- s = arrdup_max(s, 1);
- s[0] = NULL;
+ s = arrdup_max(nular, 0);
} else {
/* Copy to a point before the end of the source array:
* arrdup_max will copy at most v->end - v->start elements,
Messages sorted by:
Reverse Date,
Date,
Thread,
Author