about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/complete.c21
-rw-r--r--Src/Zle/zleparameter.c2
2 files changed, 15 insertions, 8 deletions
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index fa1476a90..d4c9f76c8 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -1133,14 +1133,21 @@ static void
 compunsetfn(Param pm, int exp)
 {
     if (exp) {
-	if (PM_TYPE(pm->flags) == PM_SCALAR) {
-	    zsfree(*((char **) pm->u.data));
-	    *((char **) pm->u.data) = ztrdup("");
-	} else if (PM_TYPE(pm->flags) == PM_ARRAY) {
-	    freearray(*((char ***) pm->u.data));
-	    *((char ***) pm->u.data) = zcalloc(sizeof(char *));
+	if (pm->u.data) {
+	    if (PM_TYPE(pm->flags) == PM_SCALAR) {
+		zsfree(*((char **) pm->u.data));
+		*((char **) pm->u.data) = ztrdup("");
+	    } else if (PM_TYPE(pm->flags) == PM_ARRAY) {
+		freearray(*((char ***) pm->u.data));
+		*((char ***) pm->u.data) = zcalloc(sizeof(char *));
+	    } else if (PM_TYPE(pm->flags) == PM_HASHED) {
+		deleteparamtable(pm->u.hash);
+		pm->u.hash = NULL;
+	    }
 	}
-	pm->flags |= PM_UNSET;
+    } else if (PM_TYPE(pm->flags) == PM_HASHED) {
+	deletehashtable(pm->u.hash);
+	pm->u.hash = NULL;
     }
 }
 
diff --git a/Src/Zle/zleparameter.c b/Src/Zle/zleparameter.c
index d10fe99b1..1ef3c1b40 100644
--- a/Src/Zle/zleparameter.c
+++ b/Src/Zle/zleparameter.c
@@ -54,7 +54,7 @@ createspecialhash(char *name, GetNodeFunc get, ScanTabFunc scan)
     pm->gets.hfn = hashgetfn;
     pm->sets.hfn = hashsetfn;
     pm->unsetfn = stdunsetfn;
-    pm->u.hash = ht = newhashtable(7, name, NULL);
+    pm->u.hash = ht = newhashtable(0, name, NULL);
 
     ht->hash        = hasher;
     ht->emptytable  = (TableFunc) shempty;