From 98b7960c78ef720c3d830bef2258f6aa86c055de Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Mon, 14 Nov 2016 14:44:57 -0800 Subject: 39943: no need to compute arrlen() in arrdup_max() when max == 0. --- ChangeLog | 5 +++++ Src/utils.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0040c2367..488f1ed45 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,11 @@ * 39947: Test/D04parameter.ztst: Test out-of-rantge multiple array subscripts with and without (@). +2016-11-14 Barton E. Schaefer + + * 39943: Src/utils.c: no need to compute arrlen() in arrdup_max() + when max == 0. + 2016-11-15 Jun-ichi Takimoto * 39937: Src/params.c: fix a problem introduced by 39886. diff --git a/Src/utils.c b/Src/utils.c index 92d831172..151e9e4eb 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -4252,9 +4252,10 @@ mod_export char ** arrdup_max(char **s, unsigned max) { char **x, **y, **send; - int len; + int len = 0; - len = arrlen(s); + if (max) + len = arrlen(s); /* Limit has sense only if not equal to len */ if (max > len) -- cgit 1.4.1