about summary refs log tree commit diff
path: root/Src/subst.c
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2016-05-08 22:07:09 +0200
committerMikael Magnusson <mikachu@gmail.com>2016-05-08 22:10:56 +0200
commitf4ab07b48c747e8dade9ee85369445de3a10d669 (patch)
treecce6a0aab62389538581fb6c25c46880cf859dea /Src/subst.c
parentb7c2ddf65c9175b77bb9efc4ec7de7ef472d7a65 (diff)
downloadzsh-f4ab07b48c747e8dade9ee85369445de3a10d669.tar.gz
zsh-f4ab07b48c747e8dade9ee85369445de3a10d669.tar.xz
zsh-f4ab07b48c747e8dade9ee85369445de3a10d669.zip
Add typeset -C to control whether to assert the cached length mikachu/badarrays
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Src/subst.c b/Src/subst.c
index cc59c74d4..7081d467d 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -27,6 +27,8 @@
  *
  */
 
+#include <assert.h>
+
 #include "zsh.mdh"
 #include "subst.pro"
 
@@ -2551,9 +2553,11 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
 		 * to avoid the multsub() horror.
 		 */
 		int tmplen;
-		if (v->pm->node.flags & PM_CACHELEN)
+		if (v->pm->node.flags & PM_CACHELEN) {
 		    tmplen = arrcachelen(v->pm);
-		else
+		    if (v->pm->node.flags & PM_CHECKLEN)
+			assert(tmplen == arrlen(v->pm->gsu.a->getfn(v->pm)));
+		} else
 		    tmplen = arrlen(v->pm->gsu.a->getfn(v->pm));
 
 		if (v->start < 0)