summary refs log tree commit diff
path: root/Src/module.c
diff options
context:
space:
mode:
authorPhil Pennock <zsh-workers+phil.pennock@spodhuis.org>2017-08-10 22:02:46 -0400
committerPeter Stephenson <pws@zsh.org>2017-08-11 15:02:06 +0100
commitb5f40f415668be88f451dbce956597e77f1bc056 (patch)
tree350018db66f2bbcab67bd496dd938d0b19018ad3 /Src/module.c
parent0f8cf76ecea79c2aea14b649164a6a38b249ded0 (diff)
downloadzsh-b5f40f415668be88f451dbce956597e77f1bc056.tar.gz
zsh-b5f40f415668be88f451dbce956597e77f1bc056.tar.xz
zsh-b5f40f415668be88f451dbce956597e77f1bc056.zip
41527 (tweaked for heap memory): fix [[ -<cond> ]] from modules
Diffstat (limited to 'Src/module.c')
-rw-r--r--Src/module.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Src/module.c b/Src/module.c
index 21d68b1ac..4ae78310f 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -649,11 +649,21 @@ getconddef(int inf, const char *name, int autol)
 {
     Conddef p;
     int f = 1;
+    char *lookup, *s;
+
+    /* detokenize the Dash to the form encoded in lookup tables */
+    lookup = dupstring(name);
+    if (!lookup)
+	return NULL;
+    for (s = lookup; *s != '\0'; s++) {
+	if (*s == Dash)
+	    *s = '-';
+    }
 
     do {
 	for (p = condtab; p; p = p->next) {
 	    if ((!!inf == !!(p->flags & CONDF_INFIX)) &&
-		!strcmp(name, p->name))
+		!strcmp(lookup, p->name))
 		break;
 	}
 	if (autol && p && p->module) {
@@ -664,7 +674,7 @@ getconddef(int inf, const char *name, int autol)
 	    if (f) {
 		(void)ensurefeature(p->module,
 				    (p->flags & CONDF_INFIX) ? "C:" : "c:",
-				    (p->flags & CONDF_AUTOALL) ? NULL : name);
+				    (p->flags & CONDF_AUTOALL) ? NULL : lookup);
 		f = 0;
 		p = NULL;
 	    } else {
@@ -674,6 +684,7 @@ getconddef(int inf, const char *name, int autol)
 	} else
 	    break;
     } while (!p);
+
     return p;
 }