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/compctl.c18
-rw-r--r--Src/Zle/compctl.h6
-rw-r--r--Src/Zle/complete.c22
-rw-r--r--Src/Zle/compresult.c2
-rw-r--r--Src/Zle/computil.c2
-rw-r--r--Src/Zle/zle_hist.c24
-rw-r--r--Src/Zle/zle_main.c6
-rw-r--r--Src/Zle/zle_params.c2
-rw-r--r--Src/Zle/zle_tricky.c6
-rw-r--r--Src/Zle/zleparameter.c18
10 files changed, 52 insertions, 54 deletions
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index 8b72abf07..1c994ef64 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -93,7 +93,7 @@ freecompctlp(HashNode hn)
 {
     Compctlp ccp = (Compctlp) hn;
 
-    zsfree(ccp->nam);
+    zsfree(ccp->node.nam);
     freecompctl(ccp->cc);
     zfree(ccp, sizeof(struct compctlp));
 }
@@ -1342,7 +1342,7 @@ compctl_process_cc(char **s, Compctl cc)
 	    if (compctl_name_pat(&n))
 		delpatcomp(n);
 	    else if ((ccp = (Compctlp) compctltab->removenode(compctltab, n)))
-		compctltab->freenode((HashNode) ccp);
+		compctltab->freenode(&ccp->node);
 	}
     } else {
 	/* Add the compctl just read to the hash table */
@@ -1570,7 +1570,7 @@ printcompctlp(HashNode hn, int printflags)
     Compctlp ccp = (Compctlp) hn;
 
     /* Function needed for use by scanhashtable() */
-    printcompctl(ccp->nam, ccp->cc, printflags, 0);
+    printcompctl(ccp->node.nam, ccp->cc, printflags, 0);
 }
 
 /* Main entry point for the `compctl' builtin */
@@ -1979,7 +1979,7 @@ addmatch(char *s, char *t)
 	isfile = CMF_FILE;
     } else if (addwhat == CC_QUOTEFLAG || addwhat == -2  ||
 	      (addwhat == -3 && !(hn->flags & DISABLED)) ||
-	      (addwhat == -4 && (PM_TYPE(pm->flags) == PM_SCALAR) &&
+	      (addwhat == -4 && (PM_TYPE(pm->node.flags) == PM_SCALAR) &&
 	       !pm->level && (tt = pm->gsu.s->getfn(pm)) && *tt == '/') ||
 	      (addwhat == -9 && !(hn->flags & PM_UNSET) && !pm->level) ||
 	      (addwhat > 0 &&
@@ -2255,9 +2255,9 @@ gen_matches_files(int dirs, int execs, int all)
 static LinkNode
 findnode(LinkList list, void *dat)
 {
-    LinkNode tmp = list->first;
+    LinkNode tmp = firstnode(list);
 
-    while (tmp && tmp->dat != dat) tmp = tmp->next;
+    while (tmp && getdata(tmp) != dat) incnode(tmp);
 
     return tmp;
 }
@@ -3692,7 +3692,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 	    if (!errflag)
 		/* And add the resulting words as matches. */
 		for (n = firstnode(foo); n; incnode(n))
-		    addmatch((char *)n->dat, NULL);
+		    addmatch(getdata(n), NULL);
 	}
 	opts[NULLGLOB] = ng;
 	we = oowe;
@@ -3720,8 +3720,8 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 	while (n-- && he) {
 	    int iwords;
 	    for (iwords = he->nwords - 1; iwords >= 0; iwords--) {
-		h = he->text + he->words[iwords*2];
-		e = he->text + he->words[iwords*2+1];
+		h = he->node.nam + he->words[iwords*2];
+		e = he->node.nam + he->words[iwords*2+1];
 		hpatsav = *e;
 		*e = '\0';
 		/* We now have a word from the history, ignore it *
diff --git a/Src/Zle/compctl.h b/Src/Zle/compctl.h
index 9a8ba5692..dcfebb71b 100644
--- a/Src/Zle/compctl.h
+++ b/Src/Zle/compctl.h
@@ -1,5 +1,5 @@
 /*
- * comp.h - header file for completion
+ * compctl.h - header file for completion
  *
  * This file is part of zsh, the Z shell.
  *
@@ -37,9 +37,7 @@ typedef struct patcomp   *Patcomp;
 /* node for compctl hash table (compctltab) */
 
 struct compctlp {
-    HashNode next;		/* next in hash chain               */
-    char *nam;			/* command name                     */
-    int flags;			/* CURRENTLY UNUSED                 */
+    struct hashnode node;
     Compctl cc;			/* pointer to the compctl desc.     */
 };
 
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index c70c8c191..1da9c7f19 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -1148,7 +1148,7 @@ set_compstate(UNUSED(Param pm), HashTable ht)
 			zsfree(*((char **) cp->var));
 			*((char **) cp->var) = ztrdup(str);
 		    }
-		    (*pp)->flags &= ~PM_UNSET;
+		    (*pp)->node.flags &= ~PM_UNSET;
 
 		    break;
 		}
@@ -1229,18 +1229,18 @@ compunsetfn(Param pm, int exp)
 {
     if (exp) {
 	if (pm->u.data) {
-	    if (PM_TYPE(pm->flags) == PM_SCALAR) {
+	    if (PM_TYPE(pm->node.flags) == PM_SCALAR) {
 		zsfree(*((char **) pm->u.data));
 		*((char **) pm->u.data) = ztrdup("");
-	    } else if (PM_TYPE(pm->flags) == PM_ARRAY) {
+	    } else if (PM_TYPE(pm->node.flags) == PM_ARRAY) {
 		freearray(*((char ***) pm->u.data));
 		*((char ***) pm->u.data) = zshcalloc(sizeof(char *));
-	    } else if (PM_TYPE(pm->flags) == PM_HASHED) {
+	    } else if (PM_TYPE(pm->node.flags) == PM_HASHED) {
 		deleteparamtable(pm->u.hash);
 		pm->u.hash = NULL;
 	    }
 	}
-    } else if (PM_TYPE(pm->flags) == PM_HASHED) {
+    } else if (PM_TYPE(pm->node.flags) == PM_HASHED) {
 	Param *p;
 	int i;
 
@@ -1272,9 +1272,9 @@ comp_setunset(int rset, int runset, int kset, int kunset)
 	for (p = comprpms; rset || runset; rset >>= 1, runset >>= 1, p++) {
 	    if (*p) {
 		if (rset & 1)
-		    (*p)->flags &= ~PM_UNSET;
+		    (*p)->node.flags &= ~PM_UNSET;
 		if (runset & 1)
-		    (*p)->flags |= PM_UNSET;
+		    (*p)->node.flags |= PM_UNSET;
 	    }
 	}
     }
@@ -1282,9 +1282,9 @@ comp_setunset(int rset, int runset, int kset, int kunset)
 	for (p = compkpms; kset || kunset; kset >>= 1, kunset >>= 1, p++) {
 	    if (*p) {
 		if (kset & 1)
-		    (*p)->flags &= ~PM_UNSET;
+		    (*p)->node.flags &= ~PM_UNSET;
 		if (kunset & 1)
-		    (*p)->flags |= PM_UNSET;
+		    (*p)->node.flags |= PM_UNSET;
 	    }
 	}
     }
@@ -1306,10 +1306,10 @@ comp_wrapper(Eprog prog, FuncWrap w, char *name)
 	m = CP_WORDS | CP_REDIRS | CP_CURRENT | CP_PREFIX | CP_SUFFIX | 
 	    CP_IPREFIX | CP_ISUFFIX | CP_QIPREFIX | CP_QISUFFIX;
 	for (pp = comprpms, sm = 1; m; pp++, m >>= 1, sm <<= 1) {
-	    if ((m & 1) && ((*pp)->flags & PM_UNSET))
+	    if ((m & 1) && ((*pp)->node.flags & PM_UNSET))
 		runset |= sm;
 	}
-	if (compkpms[CPN_RESTORE]->flags & PM_UNSET)
+	if (compkpms[CPN_RESTORE]->node.flags & PM_UNSET)
 	    kunset = CP_RESTORE;
 	orest = comprestore;
 	comprestore = ztrdup("auto");
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 4c31dab1b..2aa382cb5 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -1062,7 +1062,7 @@ do_single(Cmatch m)
 			    n = p + 1;
 
 			if ((pm = (Param) paramtab->getnode(paramtab, n)) &&
-			    PM_TYPE(pm->flags) != PM_SCALAR)
+			    PM_TYPE(pm->node.flags) != PM_SCALAR)
 			    tryit = 0;
 		    }
 		    if (tryit) {
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 6bc02e36d..af813a376 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -3371,7 +3371,7 @@ bin_compquote(char *nam, char **args, Options ops, UNUSED(int func))
 	name = dupstring(name);
 	queue_signals();
 	if ((v = getvalue(&vbuf, &name, 0))) {
-	    switch (PM_TYPE(v->pm->flags)) {
+	    switch (PM_TYPE(v->pm->node.flags)) {
 	    case PM_SCALAR:
 		setstrvalue(v, ztrdup(comp_quote(getstrvalue(v), 
 						 OPT_ISSET(ops,'p'))));
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index af4529489..da8f9244e 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -84,7 +84,7 @@ zletext(Histent ent, struct zle_text *zt)
 	return;
     }
 
-    duptext = ztrdup(ent->text);
+    duptext = ztrdup(ent->node.nam);
     zt->text = stringaszleline(duptext, 0, &zt->len, NULL, NULL);
     zsfree(duptext);
     zt->alloced = 1;
@@ -318,7 +318,7 @@ acceptlineanddownhistory(UNUSED(char **args))
     Histent he = quietgethist(histline);
 
     if (he && (he = movehistent(he, 1, HIST_FOREIGN))) {
-	zpushnode(bufstack, ztrdup(he->text));
+	zpushnode(bufstack, ztrdup(he->node.nam));
 	stackhist = he->histnum;
     }
     done = 1;
@@ -375,7 +375,7 @@ historysearchbackward(char **args)
 	return 1;
     }
     while ((he = movehistent(he, -1, hist_skip_flags))) {
-	if (isset(HISTFINDNODUPS) && he->flags & HIST_DUP)
+	if (isset(HISTFINDNODUPS) && he->node.flags & HIST_DUP)
 	    continue;
 	zletext(he, &zt);
 	if (zlinecmp(zt.text, zt.len, str, hp) < 0 &&
@@ -434,7 +434,7 @@ historysearchforward(char **args)
 	return 1;
     }
     while ((he = movehistent(he, 1, hist_skip_flags))) {
-	if (isset(HISTFINDNODUPS) && he->flags & HIST_DUP)
+	if (isset(HISTFINDNODUPS) && he->node.flags & HIST_DUP)
 	    continue;
 	zletext(he, &zt);
 	if (zlinecmp(zt.text, zt.len, str, hp) < (he->histnum == curhist) &&
@@ -627,8 +627,8 @@ insertlastword(char **args)
 	s = (char *)getdata(node);
 	t = s + strlen(s);
     } else {
-	s = he->text + he->words[2*n-2];
-	t = he->text + he->words[2*n-1];
+	s = he->node.nam + he->words[2*n-2];
+	t = he->node.nam + he->words[2*n-1];
     }
 
     save = *t;
@@ -672,7 +672,7 @@ zle_setline(Histent he)
 	if ((zlecs = zlell) && invicmdmode())
 	    zlecs--;
     } else {
-	setline(he->text, ZSL_COPY|ZSL_TOEND);
+	setline(he->node.nam, ZSL_COPY|ZSL_TOEND);
     }
     setlastline();
     clearlist = 1;
@@ -985,7 +985,7 @@ doisearch(char **args, int dir)
 		zletextfree(&zt);
 		zletext(he, &zt);
 		pos = (dir == 1) ? 0 : zt.len;
-		skip_line = isset(HISTFINDNODUPS) ? !!(he->flags & HIST_DUP)
+		skip_line = isset(HISTFINDNODUPS) ? !!(he->node.flags & HIST_DUP)
 		    : (zt.len == last_len &&
 		       !ZS_memcmp(zt.text, last_line, zt.len));
 	    }
@@ -1186,7 +1186,7 @@ acceptandinfernexthistory(char **args)
 
     if (!(he = infernexthist(hist_ring, args)))
 	return 1;
-    zpushnode(bufstack, ztrdup(he->text));
+    zpushnode(bufstack, ztrdup(he->node.nam));
     done = 1;
     stackhist = he->histnum;
     return 0;
@@ -1397,7 +1397,7 @@ virepeatsearch(UNUSED(char **args))
     if (!(he = quietgethist(histline)))
 	return 1;
     while ((he = movehistent(he, visrchsense, hist_skip_flags))) {
-	if (isset(HISTFINDNODUPS) && he->flags & HIST_DUP)
+	if (isset(HISTFINDNODUPS) && he->node.flags & HIST_DUP)
 	    continue;
 	zletext(he, &zt);
 	if (zlinecmp(zt.text, zt.len, zleline, zlell) &&
@@ -1452,7 +1452,7 @@ historybeginningsearchbackward(char **args)
     if (!(he = quietgethist(histline)))
 	return 1;
     while ((he = movehistent(he, -1, hist_skip_flags))) {
-	if (isset(HISTFINDNODUPS) && he->flags & HIST_DUP)
+	if (isset(HISTFINDNODUPS) && he->node.flags & HIST_DUP)
 	    continue;
 	zletext(he, &zt);
 	if (zlinecmp(zt.text, zt.len, zleline, zlecs) < 0 &&
@@ -1491,7 +1491,7 @@ historybeginningsearchforward(char **args)
     if (!(he = quietgethist(histline)))
 	return 1;
     while ((he = movehistent(he, 1, hist_skip_flags))) {
-	if (isset(HISTFINDNODUPS) && he->flags & HIST_DUP)
+	if (isset(HISTFINDNODUPS) && he->node.flags & HIST_DUP)
 	    continue;
 	zletext(he, &zt);
 	if (zlinecmp(zt.text, zt.len, zleline, zlecs) <
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index a4ea10339..f21dea9cc 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1129,7 +1129,7 @@ execzlefunc(Thingy func, char **args)
 	    makezleparams(0);
 	    sfcontext = SFC_WIDGET;
 	    opts[XTRACE] = 0;
-	    ret = doshfunc(w->u.fnnam, prog, largs, shf->flags, 1);
+	    ret = doshfunc(w->u.fnnam, prog, largs, shf->node.flags, 1);
 	    opts[XTRACE] = oxt;
 	    sfcontext = osc;
 	    endparamscope();
@@ -1384,7 +1384,7 @@ bin_vared(char *name, char **args, Options ops, UNUSED(int func))
     }
     queue_signals();
     pm = (Param) paramtab->getnode(paramtab, args[0]);
-    if (pm && (PM_TYPE(pm->flags) & (PM_ARRAY|PM_HASHED))) {
+    if (pm && (PM_TYPE(pm->node.flags) & (PM_ARRAY|PM_HASHED))) {
 	char **a;
 
 	/*
@@ -1393,7 +1393,7 @@ bin_vared(char *name, char **args, Options ops, UNUSED(int func))
 	 */
 	a = spacesplit(t, 1, 0, 1);
 	zsfree(t);
-	if (PM_TYPE(pm->flags) == PM_ARRAY)
+	if (PM_TYPE(pm->node.flags) == PM_ARRAY)
 	    setaparam(args[0], a);
 	else
 	    sethparam(args[0], a);
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index 145836442..f2fc153f6 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -156,7 +156,7 @@ makezleparams(int ro)
 		break;
 	}
 	if ((zp->type & PM_UNSET) && (zmod.flags & MOD_MULT))
-	    pm->flags &= ~PM_UNSET;
+	    pm->node.flags &= ~PM_UNSET;
     }
 }
 
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 09cbb0a92..ee4bfbb7f 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1305,7 +1305,7 @@ get_comp_string(void)
 	    s = NULL;
 	    inwhat = IN_MATH;
 	    if ((keypm = (Param) paramtab->getnode(paramtab, varname)) &&
-		(keypm->flags & PM_HASHED))
+		(keypm->node.flags & PM_HASHED))
 		insubscr = 2;
 	    else
 		insubscr = 1;
@@ -1381,7 +1381,7 @@ get_comp_string(void)
 		varname = ztrdup(nb);
 		*ne = sav;
 		if ((keypm = (Param) paramtab->getnode(paramtab, varname)) &&
-		    (keypm->flags & PM_HASHED))
+		    (keypm->node.flags & PM_HASHED))
 		    insubscr = 2;
 	    }
 	}
@@ -1436,7 +1436,7 @@ get_comp_string(void)
 	    varname = ztrdup(zlemetaline + i + 1);
 	    zlemetaline[wb - 1] = sav;
 	    if ((keypm = (Param) paramtab->getnode(paramtab, varname)) &&
-		(keypm->flags & PM_HASHED)) {
+		(keypm->node.flags & PM_HASHED)) {
 		if (insubscr != 3)
 		    insubscr = 2;
 	    } else
diff --git a/Src/Zle/zleparameter.c b/Src/Zle/zleparameter.c
index bf6b60479..e2e8186f2 100644
--- a/Src/Zle/zleparameter.c
+++ b/Src/Zle/zleparameter.c
@@ -99,8 +99,8 @@ getpmwidgets(UNUSED(HashTable ht), char *name)
     Thingy th;
 
     pm = (Param) hcalloc(sizeof(struct param));
-    pm->nam = dupstring(name);
-    pm->flags = PM_SCALAR | PM_READONLY;
+    pm->node.nam = dupstring(name);
+    pm->node.flags = PM_SCALAR | PM_READONLY;
     pm->gsu.s = &nullsetscalar_gsu;
 
     if ((th = (Thingy) thingytab->getnode(thingytab, name)) &&
@@ -108,9 +108,9 @@ getpmwidgets(UNUSED(HashTable ht), char *name)
 	pm->u.str = widgetstr(th->widget);
     else {
 	pm->u.str = dupstring("");
-	pm->flags |= PM_UNSET;
+	pm->node.flags |= PM_UNSET;
     }
-    return (HashNode) pm;
+    return &pm->node;
 }
 
 /**/
@@ -122,17 +122,17 @@ scanpmwidgets(UNUSED(HashTable ht), ScanFunc func, int flags)
     HashNode hn;
 
     memset((void *)&pm, 0, sizeof(struct param));
-    pm.flags = PM_SCALAR | PM_READONLY;
+    pm.node.flags = PM_SCALAR | PM_READONLY;
     pm.gsu.s = &nullsetscalar_gsu;
 
     for (i = 0; i < thingytab->hsize; i++)
 	for (hn = thingytab->nodes[i]; hn; hn = hn->next) {
-	    pm.nam = hn->nam;
+	    pm.node.nam = hn->nam;
 	    if (func != scancountparams &&
 		((flags & (SCANPM_WANTVALS|SCANPM_MATCHVAL)) ||
 		 !(flags & SCANPM_WANTKEYS)))
 		pm.u.str = widgetstr(((Thingy) hn)->widget);
-	    func((HashNode) &pm, flags);
+	    func(&pm.node, flags);
 	}
 }
 
@@ -207,7 +207,7 @@ boot_(UNUSED(Module m))
 	    if (!(def->pm = createspecialhash(def->name, def->getnfn,
 					      def->scantfn)))
 		return 1;
-	    def->pm->flags |= def->flags;
+	    def->pm->node.flags |= def->flags;
 	    if (def->hash_gsu)
 		def->pm->gsu.h = def->hash_gsu;
 	} else {
@@ -229,7 +229,7 @@ cleanup_(UNUSED(Module m))
     for (def = partab; def->name; def++) {
 	if ((pm = (Param) paramtab->getnode(paramtab, def->name)) &&
 	    pm == def->pm) {
-	    pm->flags &= ~PM_READONLY;
+	    pm->node.flags &= ~PM_READONLY;
 	    unsetparam_pm(pm, 0, 1);
 	}
     }