Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Tiny optimization to arrdup_max()



No need for arrlen() if we're just truncating.

diff --git a/Src/utils.c b/Src/utils.c
index cceaf4c..52201a9 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -4244,9 +4244,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)



Messages sorted by: Reverse Date, Date, Thread, Author