Index: Src/hashtable.c
--- Src/hashtable.c	6 Feb 2005 20:36:42 -0000	1.21
+++ Src/hashtable.c	15 Nov 2005 08:41:00 -0000
@@ -337,7 +337,7 @@ hnamcmp(const void *ap, const void *bp)
 {
     HashNode a = *(HashNode *)ap;
     HashNode b = *(HashNode *)bp;
-    return ztrcmp((unsigned char *) a->nam, (unsigned char *) b->nam);
+    return ztrcmp(a->nam, b->nam);
 }
 
 /* Scan the nodes in a hash table and execute scanfunc on nodes based on
Index: Src/init.c
--- Src/init.c	20 Sep 2005 15:10:27 -0000	1.59
+++ Src/init.c	15 Nov 2005 08:41:00 -0000
@@ -1180,7 +1180,7 @@ mod_export ZleVoidIntFn zlesetkeymapptr 
 #endif /* !LINKED_XMOD_zshQszle */
 
 /**/
-unsigned char *
+char *
 autoload_zleread(char **lp, char **rp, int ha, int con)
 {
     zlereadptr = fallback_zleread;
@@ -1190,7 +1190,7 @@ autoload_zleread(char **lp, char **rp, i
 }
 
 /**/
-mod_export unsigned char *
+mod_export char *
 fallback_zleread(char **lp, UNUSED(char **rp), UNUSED(int ha), UNUSED(int con))
 {
     char *pptbuf;
@@ -1200,7 +1200,7 @@ fallback_zleread(char **lp, UNUSED(char 
     write(2, (WRITE_ARG_2_T)pptbuf, pptlen);
     free(pptbuf);
 
-    return (unsigned char *)shingetline();
+    return shingetline();
 }
 
 /**/
Index: Src/input.c
--- Src/input.c	14 Jan 2005 13:05:21 -0000	1.12
+++ Src/input.c	15 Nov 2005 08:41:00 -0000
@@ -275,8 +275,7 @@ inputline(void)
 	int flags = ZLRF_HISTORY|ZLRF_NOSETTY;
 	if (isset(IGNOREEOF))
 	    flags |= ZLRF_IGNOREEOF;
-	ingetcline = (char *)zlereadptr(ingetcpmptl, ingetcpmptr, flags,
-					context);
+	ingetcline = zlereadptr(ingetcpmptl, ingetcpmptr, flags, context);
 	histdone |= HISTFLAG_SETTY;
     }
     if (!ingetcline) {
Index: Src/loop.c
--- Src/loop.c	14 Jan 2005 13:05:21 -0000	1.16
+++ Src/loop.c	15 Nov 2005 08:41:00 -0000
@@ -245,7 +245,7 @@ execselect(Estate state, UNUSED(int do_e
 		    int oef = errflag;
 
 		    isfirstln = 1;
-		    str = (char *)zlereadptr(&prompt3, NULL, 0, ZLCON_SELECT);
+		    str = zlereadptr(&prompt3, NULL, 0, ZLCON_SELECT);
 		    if (errflag)
 			str = NULL;
 		    errflag = oef;
Index: Src/utils.c
--- Src/utils.c	1 Nov 2005 02:50:24 -0000	1.102
+++ Src/utils.c	15 Nov 2005 08:41:01 -0000
@@ -3223,35 +3223,34 @@ unmeta(const char *file_name)
     return fn;
 }
 
-/* Unmetafy and compare two strings, with unsigned characters. *
- * "a\0" sorts after "a".                                      */
+/* Unmetafy and compare two strings, comparing unsigned character values.
+ * "a\0" sorts after "a".  */
 
 /**/
 int
-ztrcmp(unsigned char const *s1, unsigned char const *s2)
+ztrcmp(char const *s1, char const *s2)
 {
     int c1, c2;
 
-    while(*s1 && *s1 == *s2) {
+    while (*s1 && *s1 == *s2) {
 	s1++;
 	s2++;
     }
 
-    if(!(c1 = *s1))
+    if (!(c1 = STOUC(*s1)))
 	c1 = -1;
-    else if(c1 == STOUC(Meta))
-	c1 = *++s1 ^ 32;
-    if(!(c2 = *s2))
+    else if (c1 == STOUC(Meta))
+	c1 = STOUC(*++s1) ^ 32;
+    if (!(c2 = STOUC(*s2)))
 	c2 = -1;
-    else if(c2 == STOUC(Meta))
-	c2 = *++s2 ^ 32;
+    else if (c2 == STOUC(Meta))
+	c2 = STOUC(*++s2) ^ 32;
 
-    if(c1 == c2)
+    if (c1 == c2)
 	return 0;
-    else if(c1 < c2)
+    if (c1 < c2)
 	return -1;
-    else
-	return 1;
+    return 1;
 }
 
 /* Return the unmetafied length of a metafied string. */
@@ -3262,7 +3261,7 @@ ztrlen(char const *s)
 {
     int l;
 
-    for (l = 0; *s; l++)
+    for (l = 0; *s; l++) {
 	if (*s++ == Meta) {
 #ifdef DEBUG
 	    if (! *s)
@@ -3271,6 +3270,7 @@ ztrlen(char const *s)
 #endif
 	    s++;
 	}
+    }
     return l;
 }
 
@@ -3282,7 +3282,7 @@ ztrsub(char const *t, char const *s)
 {
     int l = t - s;
 
-    while (s != t)
+    while (s != t) {
 	if (*s++ == Meta) {
 #ifdef DEBUG
 	    if (! *s || s == t)
@@ -3292,6 +3292,7 @@ ztrsub(char const *t, char const *s)
 	    s++;
 	    l--;
 	}
+    }
     return l;
 }
 
@@ -3586,9 +3587,10 @@ mb_width(const char *s)
 mod_export int
 hasspecial(char const *s)
 {
-    for (; *s; s++)
+    for (; *s; s++) {
 	if (ispecial(*s == Meta ? *++s ^ 32 : *s))
 	    return 1;
+    }
     return 0;
 }
 
Index: Src/zsh.h
--- Src/zsh.h	1 Nov 2005 03:26:50 -0000	1.82
+++ Src/zsh.h	15 Nov 2005 08:41:01 -0000
@@ -1918,8 +1918,8 @@ typedef int (*CompctlReadFn) _((char *, 
 
 typedef void (*ZleVoidFn) _((void));
 typedef void (*ZleVoidIntFn) _((int));
-typedef unsigned char *(*ZleReadFn) _((char **, char **, int, int));
-typedef unsigned char *(*ZleGetLineFn) _((int *, int *));
+typedef char *(*ZleReadFn) _((char **, char **, int, int));
+typedef char *(*ZleGetLineFn) _((int *, int *));
 
 /***************************************/
 /* Hooks in core.                      */
Index: Src/Zle/compcore.c
--- Src/Zle/compcore.c	13 Oct 2005 16:30:14 -0000	1.77
+++ Src/Zle/compcore.c	15 Nov 2005 08:41:02 -0000
@@ -442,7 +442,7 @@ do_completion(UNUSED(Hookdef dummy), Com
     for (n = firstnode(matchers); n; incnode(n))
 	freecmatcher((Cmatcher) getdata(n));
 
-    zlemetall = strlen((char *)zlemetaline);
+    zlemetall = strlen(zlemetaline);
     if (zlemetacs > zlemetall)
 	zlemetacs = zlemetall;
     popheap();
@@ -1317,7 +1317,7 @@ set_comp_sep(void)
     zleparse = 1;
     ocs = zlemetacs;
     oll = zlemetall;
-    ol = (char *)zlemetaline;
+    ol = zlemetaline;
     addedx = 1;
     noerrs = 1;
     lexsave();
@@ -1358,7 +1358,7 @@ set_comp_sep(void)
     odq = dq;
     osq = sq;
     inpush(dupstrspace(tmp), 0, NULL);
-    zlemetaline = (unsigned char *) tmp;
+    zlemetaline = tmp;
     zlemetall = tl - 1;
     strinbeg(0);
     noaliases = 1;
@@ -1427,7 +1427,7 @@ set_comp_sep(void)
     wb = owb;
     we = owe;
     zlemetacs = ocs;
-    zlemetaline = (unsigned char *) ol;
+    zlemetaline = ol;
     zlemetall = oll;
     if (cur < 0 || i < 1)
 	return 1;
Index: Src/Zle/compctl.c
--- Src/Zle/compctl.c	13 Oct 2005 16:30:14 -0000	1.24
+++ Src/Zle/compctl.c	15 Nov 2005 08:41:03 -0000
@@ -220,11 +220,11 @@ compctlread(char *name, char **args, Opt
 	/* without -n, the current line is assigned to the given parameter as a
 	scalar */
 	if (OPT_ISSET(ops,'e') || OPT_ISSET(ops,'E')) {
-	    zputs((char *) zlemetaline, stdout);
+	    zputs(zlemetaline, stdout);
 	    putchar('\n');
 	}
 	if (!OPT_ISSET(ops,'e'))
-	    setsparam(reply, ztrdup((char *) zlemetaline));
+	    setsparam(reply, ztrdup(zlemetaline));
     } else {
 	int i;
 
@@ -2761,7 +2761,7 @@ sep_comp_string(char *ss, char *s, int n
     int owe = we, owb = wb, ocs = zlemetacs, swb, swe, scs, soffs, ne = noerrs;
     int sl = strlen(ss), tl, got = 0, i = 0, cur = -1, oll = zlemetall, remq;
     int ois = instring, oib = inbackt, ona = noaliases;
-    char *tmp, *p, *ns, *ol = (char *) zlemetaline, sav, *oaq = autoq;
+    char *tmp, *p, *ns, *ol = zlemetaline, sav, *oaq = autoq;
     char *qp, *qs, *ts, qc = '\0';
 
     swb = swe = soffs = 0;
@@ -2784,7 +2784,7 @@ sep_comp_string(char *ss, char *s, int n
     if ((remq = (*compqstack == '\\')))
 	tmp = rembslash(tmp);
     inpush(dupstrspace(tmp), 0, NULL);
-    zlemetaline = (unsigned char *) tmp;
+    zlemetaline = tmp;
     zlemetall = tl - 1;
     strinbeg(0);
     noaliases = 1;
@@ -2831,7 +2831,7 @@ sep_comp_string(char *ss, char *s, int n
     wb = owb;
     we = owe;
     zlemetacs = ocs;
-    zlemetaline = (unsigned char *) ol;
+    zlemetaline = ol;
     zlemetall = oll;
     if (cur < 0 || i < 1)
 	return 1;
@@ -3213,7 +3213,7 @@ makecomplistflags(Compctl cc, char *s, i
 	    char save = zlemetaline[zlemetacs];
 
 	    zlemetaline[zlemetacs] = 0;
-	    lppre = dupstring((char *) zlemetaline + wb +
+	    lppre = dupstring(zlemetaline + wb +
 			      (qipre && *qipre ?
 			       (strlen(qipre) -
 				(*qipre == '\'' || *qipre == '\"')) : 0));
@@ -3249,7 +3249,7 @@ makecomplistflags(Compctl cc, char *s, i
 		end -= ql - (qisuf[ql-1] == '\'' || qisuf[ql-1] == '"');
 	    }
 	    zlemetaline[end] = 0;
-	    lpsuf = dupstring((char *) (zlemetaline + zlemetacs));
+	    lpsuf = dupstring(zlemetaline + zlemetacs);
 	    zlemetaline[end] = save;
 	    if (brend) {
 		Brinfo bp;
Index: Src/Zle/complist.c
--- Src/Zle/complist.c	28 Oct 2005 17:34:33 -0000	1.77
+++ Src/Zle/complist.c	15 Nov 2005 08:41:03 -0000
@@ -1855,16 +1855,16 @@ setmstatus(char *status, char *sline, in
         *llp = zlemetall;
         *lenp = lastend - wb;
 
-        ret = dupstring((char *) zlemetaline);
+        ret = dupstring(zlemetaline);
 
         p = (char *) zhalloc(zlemetacs - wb + 1);
-        strncpy(p, (char *) zlemetaline + wb, zlemetacs - wb);
+        strncpy(p, zlemetaline + wb, zlemetacs - wb);
         p[zlemetacs - wb] = '\0';
         if (lastend < zlemetacs)
             s = "";
         else {
             s = (char *) zhalloc(lastend - zlemetacs + 1);
-            strncpy(s, (char *) zlemetaline + zlemetacs, lastend - zlemetacs);
+            strncpy(s, zlemetaline + zlemetacs, lastend - zlemetacs);
             s[lastend - zlemetacs] = '\0';
         }
         zlemetacs = 0;
@@ -2109,7 +2109,7 @@ domenuselect(Hookdef dummy, Chdata dat)
             zlemetacs = 0;
             foredel(zlemetall);
             spaceinline(l);
-            strncpy((char *) zlemetaline, origline, l);
+            strncpy(zlemetaline, origline, l);
             zlemetacs = origcs;
             setmstatus(status, NULL, 0 , 0, NULL, NULL, NULL);
         } else if (strpfx("search", s)) {
@@ -2210,16 +2210,15 @@ domenuselect(Hookdef dummy, Chdata dat)
 	     * completion we don't want that, we always want to
 	     * be able to type the next character.
 	     */
-	    modeline = dupstring((char *)zlemetaline);
+	    modeline = dupstring(zlemetaline);
             modecs = zlemetacs;
             modell = zlemetall;
             modelen = minfo.len;
         }
         first = 0;
-        if (mode == MM_INTER) {
-	    statusline = stringaszleline((unsigned char *)status, 0,
-					 &statusll, NULL, NULL);
-        } else if (mode) {
+        if (mode == MM_INTER)
+	    statusline = stringaszleline(status, 0, &statusll, NULL, NULL);
+        else if (mode) {
             int l = sprintf(status, "%s%sisearch%s: ",
                             ((msearchstate & MS_FAILED) ? "failed " : ""),
                             ((msearchstate & MS_WRAPPED) ? "wrapped " : ""),
@@ -2227,8 +2226,7 @@ domenuselect(Hookdef dummy, Chdata dat)
 
             strncat(status, msearchstr, MAX_STATUS - l - 1);
 
-            statusline = stringaszleline((unsigned char *)status, 0,
-					 &statusll, NULL, NULL);
+            statusline = stringaszleline(status, 0, &statusll, NULL, NULL);
         } else {
             statusline = NULL;
             statusll = 0;
@@ -2312,7 +2310,7 @@ domenuselect(Hookdef dummy, Chdata dat)
                 zlemetacs = 0;
                 foredel(zlemetall);
                 spaceinline(l);
-                strncpy((char *) zlemetaline, origline, l);
+                strncpy(zlemetaline, origline, l);
                 zlemetacs = origcs;
                 setmstatus(status, NULL, 0, 0, NULL, NULL, NULL);
 
@@ -2328,7 +2326,7 @@ domenuselect(Hookdef dummy, Chdata dat)
 
 	    s->prev = u;
 	    u = s;
-	    s->line = dupstring((char *) zlemetaline);
+	    s->line = dupstring(zlemetaline);
 	    s->cs = zlemetacs;
 	    s->mline = mline;
 	    s->mlbeg = mlbeg;
@@ -2371,7 +2369,7 @@ domenuselect(Hookdef dummy, Chdata dat)
                 zlemetacs = 0;
                 foredel(zlemetall);
                 spaceinline(l);
-                strncpy((char *) zlemetaline, origline, l);
+                strncpy(zlemetaline, origline, l);
                 zlemetacs = origcs;
 
                 if (cmd == Th(z_selfinsert))
@@ -2399,7 +2397,7 @@ domenuselect(Hookdef dummy, Chdata dat)
 	    if (nmatches < 1 || !minfo.cur || !*(minfo.cur)) {
 		nolist = 1;
                 if (mode == MM_INTER) {
-                    statusline = stringaszleline((unsigned char *)status, 0,
+                    statusline = stringaszleline(status, 0,
 						 &statusll, NULL, NULL);
                 } else {
 		    /* paranoia */
@@ -2444,7 +2442,7 @@ domenuselect(Hookdef dummy, Chdata dat)
             mode = 0;
 	    s->prev = u;
 	    u = s;
-	    s->line = dupstring((char *) zlemetaline);
+	    s->line = dupstring(zlemetaline);
 	    s->cs = zlemetacs;
 	    s->mline = mline;
 	    s->mlbeg = mlbeg;
@@ -2502,7 +2500,7 @@ domenuselect(Hookdef dummy, Chdata dat)
 	    zlemetacs = 0;
 	    foredel(zlemetall);
 	    spaceinline(l = strlen(u->line));
-	    strncpy((char *) zlemetaline, u->line, l);
+	    strncpy(zlemetaline, u->line, l);
 	    zlemetacs = u->cs;
 	    menuacc = u->acc;
 	    memcpy(&minfo, &(u->info), sizeof(struct menuinfo));
@@ -2540,7 +2538,7 @@ domenuselect(Hookdef dummy, Chdata dat)
 
             if (nolist) {
                 if (mode == MM_INTER) {
-                    statusline = stringaszleline((unsigned char *)status, 0,
+                    statusline = stringaszleline(status, 0,
 						 &statusll, NULL, NULL);
                 } else {
 		    /* paranoia */
@@ -2891,7 +2889,7 @@ domenuselect(Hookdef dummy, Chdata dat)
                 zlemetacs = 0;
                 foredel(zlemetall);
                 spaceinline(origll);
-                strncpy((char *) zlemetaline, origline, origll);
+                strncpy(zlemetaline, origline, origll);
                 zlemetacs = origcs;
                 minfo.len = modelen;
             } else {
Index: Src/Zle/compresult.c
--- Src/Zle/compresult.c	7 Nov 2005 09:37:34 -0000	1.60
+++ Src/Zle/compresult.c	15 Nov 2005 08:41:03 -0000
@@ -470,7 +470,7 @@ cline_str(Cline l, int ins, int *csp, Li
 	 * requested, we copy it and remove from the line. */
 	char *r = zalloc((i = zlemetacs - ocs) + 1);
 
-	memcpy(r, (char *) (zlemetaline + ocs), i);
+	memcpy(r, zlemetaline + ocs, i);
 	r[i] = '\0';
 	zlemetacs = ocs;
 	foredel(i);
@@ -629,7 +629,7 @@ instmatch(Cmatch m, int *scs)
 	    ocs += l;
 	}
 	lastprebr = (char *) zalloc(pcs - a + 1);
-	memcpy(lastprebr, (char *) zlemetaline + a, pcs - a);
+	memcpy(lastprebr, zlemetaline + a, pcs - a);
 	lastprebr[pcs - a] = '\0';
 	zlemetacs = ocs;
     }
@@ -671,7 +671,7 @@ instmatch(Cmatch m, int *scs)
     }
     if (brend) {
 	lastpostbr = (char *) zalloc(zlemetacs - brb + 1);
-	memcpy(lastpostbr, (char *) zlemetaline + brb, zlemetacs - brb);
+	memcpy(lastpostbr, zlemetaline + brb, zlemetacs - brb);
 	lastpostbr[zlemetacs - brb] = '\0';
     }
     lastend = zlemetacs;
@@ -771,7 +771,7 @@ do_ambiguous(void)
 	/* First remove the old string from the line. */
 	tcs = zlemetacs;
 	zlemetacs = wb;
-	memcpy(old, (char *) zlemetaline + wb, we - wb);
+	memcpy(old, zlemetaline + wb, we - wb);
 	foredel(we - wb);
 
 	/* Now get the unambiguous string and insert it into the line. */
@@ -798,7 +798,7 @@ do_ambiguous(void)
 	/* la is non-zero if listambiguous may be used. Copying and
 	 * comparing the line looks like BFI but it is the easiest
 	 * solution. Really. */
-	la = (zlemetall != origll || strncmp(origline, (char *) zlemetaline, zlemetall));
+	la = (zlemetall != origll || strncmp(origline, zlemetaline, zlemetall));
 
 	/* If REC_EXACT and AUTO_MENU are set and what we inserted is an  *
 	 * exact match, we want menu completion the next time round       *
Index: Src/Zle/zle.h
--- Src/Zle/zle.h	7 Nov 2005 09:37:34 -0000	1.24
+++ Src/Zle/zle.h	15 Nov 2005 08:41:04 -0000
@@ -94,9 +94,9 @@ typedef char *ZLE_STRING_T;
 typedef int ZLE_INT_T;
 #define ZLE_CHAR_SIZE	sizeof(ZLE_CHAR_T)
 
-/* Leave character or string as is, but string must be unsigned char * */
+/* Leave character or string as is. */
 #define ZWC(c)	c
-#define ZWS(s)	(ZLE_STRING_T)s
+#define ZWS(s)	s
 
 #define ZLEEOF	EOF
 
Index: Src/Zle/zle_hist.c
--- Src/Zle/zle_hist.c	28 Oct 2005 17:34:33 -0000	1.30
+++ Src/Zle/zle_hist.c	15 Nov 2005 08:41:04 -0000
@@ -85,8 +85,7 @@ zletext(Histent ent, struct zle_text *zt
     }
 
     duptext = ztrdup(ent->text);
-    zt->text = stringaszleline((unsigned char *)duptext, 0,
-			       &zt->len, NULL, NULL);
+    zt->text = stringaszleline(duptext, 0, &zt->len, NULL, NULL);
     zsfree(duptext);
     zt->alloced = 1;
 }
@@ -355,9 +354,9 @@ historysearchbackward(char **args)
 	zmult = n;
 	return ret;
     }
-    if (*args) {
-	str = stringaszleline((unsigned char *)*args, 0, &hp, NULL, NULL);
-    } else {
+    if (*args)
+	str = stringaszleline(*args, 0, &hp, NULL, NULL);
+    else {
 	if (histline == curhist || histline != srch_hl || zlecs != srch_cs ||
 	    mark != 0 || ZS_memcmp(srch_str, zleline, histpos) != 0) {
 	    zfree(srch_str, histpos);
@@ -414,9 +413,9 @@ historysearchforward(char **args)
 	zmult = n;
 	return ret;
     }
-    if (*args) {
-	str = stringaszleline((unsigned char *)*args, 0, &hp, NULL, NULL);
-    } else {
+    if (*args)
+	str = stringaszleline(*args, 0, &hp, NULL, NULL);
+    else {
 	if (histline == curhist || histline != srch_hl || zlecs != srch_cs ||
 	    mark != 0 || ZS_memcmp(srch_str, zleline, histpos) != 0) {
 	    zfree(srch_str, histpos * ZLE_CHAR_SIZE);
@@ -539,7 +538,7 @@ insertlastword(char **args)
     if (lastinsert && lastlen &&
 	lastpos <= zlemetacs &&
 	lastlen == zlemetacs - lastpos &&
-	memcmp(lastinsert, (char *)&zlemetaline[lastpos], lastlen) == 0)
+	memcmp(lastinsert, &zlemetaline[lastpos], lastlen) == 0)
 	deleteword = 1;
     else
 	lasthist = curhist;
@@ -644,7 +643,7 @@ insertlastword(char **args)
 
     unmetafy_line();
 
-    zs = stringaszleline((unsigned char *)s, 0, &len, NULL, NULL);
+    zs = stringaszleline(s, 0, &len, NULL, NULL);
     doinsert(zs, len);
     free(zs);
     zmult = n;
@@ -749,8 +748,7 @@ pushlineoredit(char **args)
     if (zmult < 0)
 	return 1;
     if (hline && *hline) {
-	ZLE_STRING_T zhline = stringaszleline((unsigned char *)hline, 0,
-					      &ics, NULL, NULL);
+	ZLE_STRING_T zhline = stringaszleline(hline, 0, &ics, NULL, NULL);
 
 	sizeline(ics + zlell + 1);
 	/* careful of overlapping copy */
@@ -787,7 +785,7 @@ pushinput(char **args)
 int
 zgetline(UNUSED(char **args))
 {
-    unsigned char *s = (unsigned char *)getlinknode(bufstack);
+    char *s = getlinknode(bufstack);
 
     if (!s) {
 	return 1;
@@ -1270,8 +1268,7 @@ getvisrchstr(void)
 	    	cmd == Th(z_vicmdmode)) {
 	    int newlen;
 	    sbuf[sptr] = ZWC('\0');
-	    visrchstr = (char *)zlelineasstring(sbuf + 1, sptr - 1, 0, &newlen,
-						NULL, 0);
+	    visrchstr = zlelineasstring(sbuf+1, sptr-1, 0, &newlen, NULL, 0);
 	    if (!newlen) {
 	        zsfree(visrchstr);
 		visrchstr = ztrdup(vipenultsrchstr);
@@ -1391,8 +1388,7 @@ virepeatsearch(UNUSED(char **args))
 	n = -n;
 	visrchsense = -visrchsense;
     }
-    srcstr = stringaszleline((unsigned char *)visrchstr, 0,
-			     &srclen, NULL, NULL);
+    srcstr = stringaszleline(visrchstr, 0, &srclen, NULL, NULL);
     if (!(he = quietgethist(histline)))
 	return 1;
     while ((he = movehistent(he, visrchsense, hist_skip_flags))) {
Index: Src/Zle/zle_main.c
--- Src/Zle/zle_main.c	28 Oct 2005 17:34:33 -0000	1.79
+++ Src/Zle/zle_main.c	15 Nov 2005 08:41:04 -0000
@@ -908,10 +908,10 @@ zlecore(void)
 /* Read a line.  It is returned metafied. */
 
 /**/
-unsigned char *
+char *
 zleread(char **lp, char **rp, int flags, int context)
 {
-    unsigned char *s;
+    char *s;
     int old_errno = errno;
     int tmout = getiparam("TMOUT");
     Thingy initthingy;
@@ -932,7 +932,7 @@ zleread(char **lp, char **rp, int flags,
 			  &pptlen);
 	write(2, (WRITE_ARG_2_T)pptbuf, pptlen);
 	free(pptbuf);
-	return (unsigned char *)shingetline();
+	return shingetline();
     }
 
     keytimeout = getiparam("KEYTIMEOUT");
@@ -976,9 +976,9 @@ zleread(char **lp, char **rp, int flags,
     selectkeymap("main", 1);
     selectlocalmap(NULL);
     fixsuffix();
-    if ((s = (unsigned char *)getlinknode(bufstack))) {
-	setline((char *)s, ZSL_TOEND);
-	zsfree((char *)s);
+    if ((s = getlinknode(bufstack))) {
+	setline(s, ZSL_TOEND);
+	zsfree(s);
 	if (stackcs != -1) {
 	    zlecs = stackcs;
 	    stackcs = -1;
@@ -1350,8 +1350,7 @@ bin_vared(char *name, char **args, Optio
     if (OPT_ISSET(ops,'h'))
 	hbegin(2);
     isfirstln = OPT_ISSET(ops,'e');
-    t = (char *) zleread(&p1, &p2, OPT_ISSET(ops,'h') ? ZLRF_HISTORY : 0,
-			 ZLCON_VARED);
+    t = zleread(&p1, &p2, OPT_ISSET(ops,'h') ? ZLRF_HISTORY : 0, ZLCON_VARED);
     if (OPT_ISSET(ops,'h'))
 	hend(NULL);
     isfirstln = ifl;
Index: Src/Zle/zle_misc.c
--- Src/Zle/zle_misc.c	7 Nov 2005 09:37:34 -0000	1.34
+++ Src/Zle/zle_misc.c	15 Nov 2005 08:41:04 -0000
@@ -476,8 +476,7 @@ whatcursorposition(UNUSED(char **args))
 	     * convert a single character, remembering it may
 	     * turn into a multibyte string or be metafied.
 	     */
-	    mbstr = (char *)zlelineasstring(zleline+zlecs, 1, 0,
-					    &len, NULL, 1);
+	    mbstr = zlelineasstring(zleline+zlecs, 1, 0, &len, NULL, 1);
 	    strcpy(s, mbstr);
 	    s += len;
 	}
@@ -651,7 +650,7 @@ copyprevshellword(UNUSED(char **args))
     LinkList l;
     LinkNode n;
     int i;
-    unsigned char *p = NULL;
+    char *p = NULL;
 
     if (zmult <= 0)
 	return 1;
@@ -662,7 +661,7 @@ copyprevshellword(UNUSED(char **args))
 	    return 1;
         for (n = firstnode(l); n; incnode(n))
             if (!i--) {
-                p = (unsigned char *)getdata(n);
+                p = getdata(n);
                 break;
             }
     }
@@ -792,7 +791,7 @@ executenamedcommand(char *prmt)
     clearlist = 1;
     /* prmt may be constant */
     prmt = ztrdup(prmt);
-    zprmt = stringaszleline((unsigned char *)prmt, 0, &l, NULL, NULL);
+    zprmt = stringaszleline(prmt, 0, &l, NULL, NULL);
     cmdbuf = zhalloc((l + NAMLEN + 2) * ZLE_CHAR_SIZE);
     ZS_memcpy(cmdbuf, zprmt, l);
     free(zprmt);
@@ -875,8 +874,7 @@ executenamedcommand(char *prmt)
 		Thingy r;
 		unambiguous:
 		*ptr = 0;
-		namedcmdstr = (char *)zlelineasstring(cmdbuf, len, 0,
-						      NULL, NULL, 0);
+		namedcmdstr = zlelineasstring(cmdbuf, len, 0, NULL, NULL, 0);
 		r = rthingy(namedcmdstr);
 		free(namedcmdstr);
 		namedcmdstr = NULL;
@@ -906,8 +904,7 @@ executenamedcommand(char *prmt)
 
 		namedcmdll = newlinklist();
 
-		namedcmdstr = (char *)zlelineasstring(cmdbuf, len, 0,
-						      NULL, NULL, 0);
+		namedcmdstr = zlelineasstring(cmdbuf, len, 0, NULL, NULL, 0);
 		scanhashtable(thingytab, 1, 0, DISABLED, scancompcmd, 0);
 		free(namedcmdstr);
 		namedcmdstr = NULL;
@@ -929,9 +926,8 @@ executenamedcommand(char *prmt)
 		    zmult = zmultsav;
 		} else if (!nextnode(firstnode(namedcmdll))) {
 		    char *peekstr = ztrdup(peekfirst(namedcmdll));
-		    ZLE_STRING_T ztmp = 
-			stringaszleline((unsigned char *)peekstr, 0, &len,
-					NULL, NULL);
+		    ZLE_STRING_T ztmp = stringaszleline(peekstr, 0, &len,
+							NULL, NULL);
 		    zsfree(peekstr);
 		    ZS_memcpy(ptr = cmdbuf, ztmp, len);
 		    ptr += len;
@@ -941,9 +937,8 @@ executenamedcommand(char *prmt)
 		} else {
 		    int ltmp;
 		    char *peekstr = ztrdup(peekfirst(namedcmdll));
-		    ZLE_STRING_T ztmp =
-			stringaszleline((unsigned char *)peekstr, 0, &ltmp,
-					NULL, NULL);
+		    ZLE_STRING_T ztmp = stringaszleline(peekstr, 0, &ltmp,
+							NULL, NULL);
 		    zsfree(peekstr);
 		    ZS_memcpy(cmdbuf, ztmp, ltmp);
 		    free(ztmp);
Index: Src/Zle/zle_params.c
--- Src/Zle/zle_params.c	10 Aug 2005 10:56:41 -0000	1.26
+++ Src/Zle/zle_params.c	15 Nov 2005 08:41:04 -0000
@@ -190,9 +190,8 @@ static char *
 get_buffer(UNUSED(Param pm))
 {
     if (zlemetaline != 0)
-	return dupstring((char *)zlemetaline);
-    else
-	return (char *)zlelineasstring(zleline, zlell, 0, NULL, NULL, 1);
+	return dupstring(zlemetaline);
+    return zlelineasstring(zleline, zlell, 0, NULL, NULL, 1);
 }
 
 /**/
@@ -222,8 +221,7 @@ get_cursor(UNUSED(Param pm))
 	free(tmpline);
 	return tmpcs;
     }
-    else
-	return zlecs;
+    return zlecs;
 }
 
 /**/
@@ -253,7 +251,7 @@ set_lbuffer(UNUSED(Param pm), char *x)
     int len;
 
     if (x && *x != ZWC('\0'))
-	y = stringaszleline((unsigned char *)x, 0, &len, NULL, NULL);
+	y = stringaszleline(x, 0, &len, NULL, NULL);
     else
 	y = ZWS(""), len = 0;
     sizeline(zlell - zlecs + len);
@@ -273,9 +271,8 @@ static char *
 get_lbuffer(UNUSED(Param pm))
 {
     if (zlemetaline != NULL)
-	return dupstrpfx((char *)zlemetaline, zlemetacs);
-    else
-	return (char *)zlelineasstring(zleline, zlecs, 0, NULL, NULL, 1);
+	return dupstrpfx(zlemetaline, zlemetacs);
+    return zlelineasstring(zleline, zlecs, 0, NULL, NULL, 1);
 }
 
 /**/
@@ -286,7 +283,7 @@ set_rbuffer(UNUSED(Param pm), char *x)
     int len;
 
     if (x && *x != ZWC('\0'))
-	y = stringaszleline((unsigned char *)x, 0, &len, NULL, NULL);
+	y = stringaszleline(x, 0, &len, NULL, NULL);
     else
 	y = ZWS(""), len = 0;
     sizeline(zlell = zlecs + len);
@@ -304,9 +301,7 @@ get_rbuffer(UNUSED(Param pm))
 {
     if (zlemetaline != NULL)
 	return dupstrpfx((char *)zleline + zlemetacs, zlemetall - zlemetacs);
-    else
-	return (char *)zlelineasstring(zleline + zlecs, zlell - zlecs,
-				       0, NULL, NULL, 1);
+    return zlelineasstring(zleline + zlecs, zlell - zlecs, 0, NULL, NULL, 1);
 }
 
 /**/
@@ -315,8 +310,7 @@ get_prebuffer(UNUSED(Param pm))
 {
     if (chline)
 	return dupstrpfx(chline, hptr - chline);
-    else
-	return dupstring("");
+    return dupstring("");
 }
 
 /**/
@@ -335,10 +329,9 @@ get_widgetfunc(UNUSED(Param pm))
 
     if (flags & WIDGET_INT)
 	return ".internal";	/* Don't see how this can ever be returned... */
-    else if (flags & WIDGET_NCOMP)
+    if (flags & WIDGET_NCOMP)
 	return widget->u.comp.func;
-    else
-	return widget->u.fnnam;
+    return widget->u.fnnam;
 }
 
 /**/
@@ -350,10 +343,9 @@ get_widgetstyle(UNUSED(Param pm))
 
     if (flags & WIDGET_INT)
 	return ".internal";	/* Don't see how this can ever be returned... */
-    else if (flags & WIDGET_NCOMP)
+    if (flags & WIDGET_NCOMP)
 	return widget->u.comp.wid;
-    else
-	return "";
+    return "";
 }
 
 /**/
@@ -440,10 +432,8 @@ static char *
 get_cutbuffer(UNUSED(Param pm))
 {
     if (cutbuf.buf)
-	return (char *)
-	    zlelineasstring(cutbuf.buf, cutbuf.len, 0, NULL, NULL, 1);
-    else
-	return "";
+	return zlelineasstring(cutbuf.buf, cutbuf.len, 0, NULL, NULL, 1);
+    return "";
 }
 
 
@@ -456,7 +446,7 @@ set_cutbuffer(UNUSED(Param pm), char *x)
     cutbuf.flags = 0;
     if (x) {
 	int n;
-	cutbuf.buf = stringaszleline((unsigned char *)x, 0, &n, NULL, NULL);
+	cutbuf.buf = stringaszleline(x, 0, &n, NULL, NULL);
 	cutbuf.len = n;
 	free(x);
     } else {
@@ -511,8 +501,7 @@ set_killring(UNUSED(Param pm), char **x)
 	    int n, len = strlen(*p);
 	    kptr = kring + kpos;
 
-	    kptr->buf = stringaszleline((unsigned char *)*p, 0, &n,
-					NULL, NULL);
+	    kptr->buf = stringaszleline(*p, 0, &n, NULL, NULL);
 	    kptr->len = n;
 
 	    zfree(*p, len+1);
@@ -547,8 +536,7 @@ get_killring(UNUSED(Param pm))
 	if (kptr->buf)
 	{
 	    /* Allocate on heap. */
-	    *p++ = (char *)zlelineasstring(kptr->buf, kptr->len,
-					   0, NULL, NULL, 1);
+	    *p++ = zlelineasstring(kptr->buf, kptr->len, 0, NULL, NULL, 1);
 	}
 	else
 	    *p++ = dupstring("");
@@ -578,7 +566,7 @@ set_prepost(ZLE_STRING_T *textvar, int *
 	*lenvar = 0;
     }
     if (x) {
-	*textvar = stringaszleline((unsigned char *)x, 0, lenvar, NULL, NULL);
+	*textvar = stringaszleline(x, 0, lenvar, NULL, NULL);
 	free(x);
     }
 }
@@ -586,7 +574,7 @@ set_prepost(ZLE_STRING_T *textvar, int *
 static char *
 get_prepost(ZLE_STRING_T text, int len)
 {
-    return (char *)zlelineasstring(text, len, 0, NULL, NULL, 1);
+    return zlelineasstring(text, len, 0, NULL, NULL, 1);
 }
 
 /**/
@@ -631,11 +619,11 @@ free_prepostdisplay(void)
 static char *
 get_lsearch(UNUSED(Param pm))
 {
-    if (previous_search_len)
-	return (char *)zlelineasstring(previous_search, previous_search_len, 0,
-				       NULL, NULL, 1);
-    else
-	return "";
+    if (previous_search_len) {
+	return zlelineasstring(previous_search, previous_search_len, 0,
+			       NULL, NULL, 1);
+    }
+    return "";
 }
 
 /**/
Index: Src/Zle/zle_thingy.c
--- Src/Zle/zle_thingy.c	28 Oct 2005 17:34:33 -0000	1.22
+++ Src/Zle/zle_thingy.c	15 Nov 2005 08:41:04 -0000
@@ -415,10 +415,8 @@ bin_zle_refresh(UNUSED(char *name), char
     statusline = NULL;
     statusll = 0;
     if (*args) {
-	if (**args) {
-	    statusline = stringaszleline((unsigned char *)*args, 0, &statusll,
-					 NULL, NULL);
-	}
+	if (**args)
+	    statusline = stringaszleline(*args, 0, &statusll, NULL, NULL);
 	if (*++args) {
 	    LinkList l = newlinklist();
 	    int zmultsav = zmult;
Index: Src/Zle/zle_tricky.c
--- Src/Zle/zle_tricky.c	1 Nov 2005 23:10:22 -0000	1.60
+++ Src/Zle/zle_tricky.c	15 Nov 2005 08:41:05 -0000
@@ -63,7 +63,7 @@
  * zlemetacs and zlemetall are defined in lex.c.
  */
 /**/
-mod_export unsigned char *zlemetaline;
+mod_export char *zlemetaline;
 /**/
 mod_export int metalinesz;
 
@@ -611,7 +611,7 @@ docomplete(int lst)
     metafy_line();
 
     ocs = zlemetacs;
-    origline = dupstring((char *) zlemetaline);
+    origline = dupstring(zlemetaline);
     origcs = zlemetacs;
     origll = zlemetall;
     if (!isfirstln && chline != NULL) {
@@ -619,7 +619,7 @@ docomplete(int lst)
 	 * taken from the history), we have to prepend the stuff saved *
 	 * in chline to the contents of line.                          */
 
-	ol = dupstring((char *)zlemetaline);
+	ol = dupstring(zlemetaline);
 	/* Make sure that chline is zero-terminated. */
 	*hptr = '\0';
 	zlemetacs = 0;
@@ -647,16 +647,16 @@ docomplete(int lst)
      * would never change the pointer in the middle of an insertion, but  *
      * then vi doesn't have completion.  More to the point, this is only  *
      * an emulation.                                                      */
-    if (viinsbegin > ztrsub((char *) zlemetaline + wb, (char *) zlemetaline))
-	viinsbegin = ztrsub((char *) zlemetaline + wb, (char *) zlemetaline);
+    if (viinsbegin > ztrsub(zlemetaline + wb, zlemetaline))
+	viinsbegin = ztrsub(zlemetaline + wb, zlemetaline);
     /* If we added chline to the line buffer, reset the original contents. */
     if (ol) {
 	zlemetacs -= chl;
 	wb -= chl;
 	we -= chl;
 	if (wb < 0) {
-	    strcpy((char *) zlemetaline, ol);
-	    zlemetall = strlen((char *) zlemetaline);
+	    strcpy(zlemetaline, ol);
+	    zlemetall = strlen(zlemetaline);
 	    zlemetacs = ocs;
 	    popheap();
 	    unmetafy_line();
@@ -792,7 +792,7 @@ docomplete(int lst)
 	    /* Do expansion. */
 	    char *ol = (olst == COMP_EXPAND ||
                         olst == COMP_EXPAND_COMPLETE) ?
-		dupstring((char *)zlemetaline) : (char *)zlemetaline;
+		dupstring(zlemetaline) : zlemetaline;
 	    int ocs = zlemetacs, ne = noerrs;
 
 	    noerrs = 1;
@@ -803,7 +803,7 @@ docomplete(int lst)
 	    /* If expandorcomplete was invoked and the expansion didn't *
 	     * change the command line, do completion.                  */
 	    if (olst == COMP_EXPAND_COMPLETE &&
-		!strcmp(ol, (char *)zlemetaline)) {
+		!strcmp(ol, zlemetaline)) {
 		zlemetacs = ocs;
 		errflag = 0;
 
@@ -825,7 +825,7 @@ docomplete(int lst)
             } else {
                 if (ret)
                     clearlist = 1;
-                if (!strcmp(ol, (char *)zlemetaline)) {
+                if (!strcmp(ol, zlemetaline)) {
                     /* We may have removed some quotes. For completion, other
                      * parts of the code re-install them, but for expansion
                      * we have to do it here. */
@@ -893,15 +893,13 @@ addx(char **ptmp)
 	(instring && (zlemetaline[zlemetacs] == '"' ||
 		      zlemetaline[zlemetacs] == '\'')) ||
 	(addspace = (comppref && !iblank(zlemetaline[zlemetacs])))) {
-	*ptmp = (char *)zlemetaline;
-	zlemetaline = (unsigned char *)zhalloc(strlen((char *)zlemetaline)
-					       + 3 + addspace);
+	*ptmp = zlemetaline;
+	zlemetaline = zhalloc(strlen(zlemetaline) + 3 + addspace);
 	memcpy(zlemetaline, *ptmp, zlemetacs);
 	zlemetaline[zlemetacs] = 'x';
 	if (addspace)
 	    zlemetaline[zlemetacs+1] = ' ';
-	strcpy((char *)zlemetaline + zlemetacs + 1 + addspace,
-	       (*ptmp) + zlemetacs);
+	strcpy(zlemetaline + zlemetacs + 1 + addspace, (*ptmp) + zlemetacs);
 	addedx = 1 + addspace;
     } else {
 	addedx = 0;
@@ -1035,7 +1033,7 @@ get_comp_string(void)
     int t0, tt0, i, j, k, cp, rd, sl, ocs, ins, oins, ia, parct, varq = 0;
     int ona = noaliases, qsub;
     char *s = NULL, *tmp, *p, *tt = NULL, rdop[20];
-    unsigned char *linptr, *u;
+    char *linptr, *u;
 
     METACHECK();
 
@@ -1090,7 +1088,7 @@ get_comp_string(void)
     zleparse = 1;
     clwpos = -1;
     lexsave();
-    inpush(dupstrspace((char *) linptr), 0, NULL);
+    inpush(dupstrspace(linptr), 0, NULL);
     strinbeg(0);
     i = tt0 = cp = rd = ins = oins = linarr = parct = ia = 0;
 
@@ -1260,8 +1258,7 @@ get_comp_string(void)
 	/* We are in command or process substitution if we are not in
 	 * a $((...)). */
 	if (parend >= 0 && !tmp)
-	    zlemetaline = (unsigned char *)
-		dupstring(tmp = (char *)zlemetaline);
+	    zlemetaline = dupstring(tmp = zlemetaline);
 	linptr = zlemetaline + zlemetall + addedx - parbegin + 1;
 	if ((linptr - zlemetaline) < 3 || *linptr != '(' ||
 	    linptr[-1] != '(' || linptr[-2] != '$') {
@@ -1333,10 +1330,10 @@ get_comp_string(void)
     }
     if (we > zlemetall)
 	we = zlemetall;
-    tt = (char *)zlemetaline;
+    tt = zlemetaline;
     if (tmp) {
-	zlemetaline = (unsigned char *)tmp;
-	zlemetall = strlen((char *)zlemetaline);
+	zlemetaline = tmp;
+	zlemetall = strlen(zlemetaline);
     }
     if (t0 != STRING && inwhat != IN_MATH) {
 	if (tmp) {
@@ -1403,11 +1400,11 @@ get_comp_string(void)
 		    if (lev)
 			lev--;
 		}
-	    p = (char *) zlemetaline + wb;
+	    p = zlemetaline + wb;
 	    wb++;
 	    if (wb && (*p == '[' || *p == '(') &&
 		!skipparens(*p, (*p == '[' ? ']' : ')'), &p)) {
-		we = (p - (char *) zlemetaline) - 1;
+		we = (p - zlemetaline) - 1;
 		if (insubscr == 2)
 		    insubscr = 3;
 	    }
@@ -1421,19 +1418,19 @@ get_comp_string(void)
 	}
 	zsfree(s);
 	s = zalloc(we - wb + 1);
-	strncpy(s, (char *) zlemetaline + wb, we - wb);
+	strncpy(s, zlemetaline + wb, we - wb);
 	s[we - wb] = '\0';
 	if (wb > 2 && zlemetaline[wb - 1] == '[' &&
 	    iident(zlemetaline[wb - 2])) {
 	    int i = wb - 3;
-	    unsigned char sav = zlemetaline[wb - 1];
+	    char sav = zlemetaline[wb - 1];
 
 	    while (i >= 0 && iident(zlemetaline[i]))
 		i--;
 
 	    zlemetaline[wb - 1] = '\0';
 	    zsfree(varname);
-	    varname = ztrdup((char *) zlemetaline + i + 1);
+	    varname = ztrdup(zlemetaline + i + 1);
 	    zlemetaline[wb - 1] = sav;
 	    if ((keypm = (Param) paramtab->getnode(paramtab, varname)) &&
 		(keypm->flags & PM_HASHED)) {
@@ -1785,19 +1782,19 @@ inststrlen(char *str, int move, int len)
 	len = strlen(str);
     spaceinline(len);
     if (zlemetaline != NULL) {
-	strncpy((char *)(zlemetaline + zlemetacs), str, len);
+	strncpy(zlemetaline + zlemetacs, str, len);
 	if (move)
 	    zlemetacs += len;
     } else {
-	unsigned char *instr;
+	char *instr;
 	ZLE_STRING_T zlestr;
 	int zlelen;
 
-	instr = (unsigned char *)ztrduppfx((char *)str, len);
+	instr = ztrduppfx((char *)str, len);
 	zlestr = stringaszleline(instr, 0, &zlelen, NULL, NULL);
 	ZS_strncpy(zleline + zlecs, zlestr, zlelen);
 	free(zlestr);
-	zsfree((char *)instr);
+	zsfree(instr);
 	if (move)
 	    zlecs += len;
     }
@@ -2341,7 +2338,7 @@ listlist(LinkList l)
 int
 doexpandhist(void)
 {
-    unsigned char *ol;
+    char *ol;
     int oll, ocs, ne = noerrs, err, ona = noaliases;
 
     UNMETACHECK();
@@ -2350,13 +2347,13 @@ doexpandhist(void)
     metafy_line();
     oll = zlemetall;
     ocs = zlemetacs;
-    ol = (unsigned char *)dupstring((char *)zlemetaline);
+    ol = dupstring(zlemetaline);
     expanding = 1;
     excs = zlemetacs;
     zlemetall = zlemetacs = 0;
     lexsave();
     /* We push ol as it will remain unchanged */
-    inpush((char *) ol, 0, NULL);
+    inpush(ol, 0, NULL);
     strinbeg(1);
     noaliases = 1;
     noerrs = 1;
@@ -2380,7 +2377,7 @@ doexpandhist(void)
 
     if (!err) {
 	zlemetacs = excs;
-	if (strcmp((char *)zlemetaline, (char *)ol)) {
+	if (strcmp(zlemetaline, ol)) {
 	    unmetafy_line();
 	    /* For vi mode -- reset the beginning-of-insertion pointer   *
 	     * to the beginning of the line.  This seems a little silly, *
@@ -2392,7 +2389,7 @@ doexpandhist(void)
 	}
     }
 
-    strcpy((char *)zlemetaline, (char *)ol);
+    strcpy(zlemetaline, ol);
     zlemetall = oll;
     zlemetacs = ocs;
     unmetafy_line();
@@ -2473,7 +2470,7 @@ getcurcmd(void)
     zleparse = 2;
     lexsave();
     metafy_line();
-    inpush(dupstrspace((char *) zlemetaline), 0, NULL);
+    inpush(dupstrspace(zlemetaline), 0, NULL);
     strinbeg(1);
     pushheap();
     do {
@@ -2549,8 +2546,7 @@ expandcmdpath(UNUSED(char **args))
 	return 1;
     zlecs = cmdwb;
     foredel(cmdwe - cmdwb);
-    zlestr = stringaszleline((unsigned char *)str, 0,
-			     &strll, NULL, NULL);
+    zlestr = stringaszleline(str, 0, &strll, NULL, NULL);
     spaceinline(strll);
     ZS_strncpy(zleline + zlecs, zlestr, strll);
     free(zlestr);
Index: Src/Zle/zle_utils.c
--- Src/Zle/zle_utils.c	1 Nov 2005 03:26:57 -0000	1.32
+++ Src/Zle/zle_utils.c	15 Nov 2005 08:41:05 -0000
@@ -76,7 +76,7 @@ sizeline(int sz)
 
 	if (zlemetaline != NULL) {
 	    /* One spare character for the NULL */
-	    zlemetaline = (unsigned char *)realloc(zlemetaline, cursz + 1);
+	    zlemetaline = realloc(zlemetaline, cursz + 1);
 	} else {
 	    /* One spare character for the NULL, one for the newline */
 	    zleline =
@@ -125,7 +125,7 @@ zleaddtoline(int chr)
  */
 
 /**/
-mod_export unsigned char *
+mod_export char *
 zlelineasstring(ZLE_STRING_T instr, int inll, int incs, int *outllp,
 		int *outcsp, int useheap)
 {
@@ -167,12 +167,12 @@ zlelineasstring(ZLE_STRING_T instr, int 
      */
     if (outcsp != NULL || outllp != NULL) {
 #ifdef MULTIBYTE_SUPPORT
-	unsigned char *strp = (unsigned char *)s;
+	char *strp = s;
 #else
-	unsigned char *strp = (unsigned char *)instr;
+	char *strp = instr;
 #endif
-	unsigned char *stopcs = strp + outcs;
-	unsigned char *stopll = strp + outll;
+	char *stopcs = strp + outcs;
+	char *stopll = strp + outll;
 
 	while (strp < stopll) {
 	    if (imeta(*strp)) {
@@ -190,17 +190,15 @@ zlelineasstring(ZLE_STRING_T instr, int 
 
 #ifdef MULTIBYTE_SUPPORT
     if (useheap) {
-	unsigned char *ret =
-	    (unsigned char *) metafy((char *) s, mb_len, META_HEAPDUP);
+	char *ret = metafy(s, mb_len, META_HEAPDUP);
 
-	zfree((char *)s, inll * MB_CUR_MAX + 1);
+	zfree(s, inll * MB_CUR_MAX + 1);
 
 	return ret;
     }
-    return (unsigned char *) metafy((char *) s, mb_len, META_REALLOC);
+    return metafy(s, mb_len, META_REALLOC);
 #else
-    return (unsigned char *) metafy((char *) instr, inll,
-				    useheap ? META_HEAPDUP : META_DUP);
+    return metafy(instr, inll, useheap ? META_HEAPDUP : META_DUP);
 #endif
 }
 
@@ -232,8 +230,7 @@ zlelineasstring(ZLE_STRING_T instr, int 
 
 /**/
 mod_export ZLE_STRING_T
-stringaszleline(unsigned char *instr, int incs,
-		int *outll, int *outsz, int *outcs)
+stringaszleline(char *instr, int incs, int *outll, int *outsz, int *outcs)
 {
     ZLE_STRING_T outstr;
     int ll, sz;
@@ -248,16 +245,16 @@ stringaszleline(unsigned char *instr, in
 	 * of multibyte characters.  If there are none, this
 	 * is all the processing required to calculate outcs.
 	 */
-	unsigned char *inptr = instr, *cspos = instr + incs;
+	char *inptr = instr, *cspos = instr + incs;
 	while (*inptr && inptr < cspos) {
-	    if (*inptr == STOUC(Meta)) {
+	    if (*inptr == Meta) {
 		inptr++;
 		incs--;
 	    }
 	    inptr++;
 	}
     }
-    unmetafy((char *)instr, &ll);
+    unmetafy(instr, &ll);
 
     /*
      * ll is the maximum number of characters there can be in
@@ -271,7 +268,7 @@ stringaszleline(unsigned char *instr, in
 
 #ifdef MULTIBYTE_SUPPORT
     if (ll) {
-	char *inptr = (char *)instr;
+	char *inptr = instr;
 	wchar_t *outptr = outstr;
 
 	/* Reset shift state to input complete string */
@@ -300,7 +297,7 @@ stringaszleline(unsigned char *instr, in
 		ret = 1;
 
 	    if (outcs) {
-		int offs = inptr - (char *)instr;
+		int offs = inptr - instr;
 		if (offs <= incs && incs < offs + (int)ret)
 		    *outcs = outptr - outstr;
 	    }
@@ -309,7 +306,7 @@ stringaszleline(unsigned char *instr, in
 	    outptr++;
 	    ll -= ret;
 	}
-	if (outcs && inptr <= (char *)instr + incs)
+	if (outcs && inptr <= instr + incs)
 	    *outcs = outptr - outstr;
 	*outll = outptr - outstr;
     } else {
@@ -318,7 +315,7 @@ stringaszleline(unsigned char *instr, in
 	    *outcs = 0;
     }
 #else
-    memcpy((char *)outstr, (char *)instr, ll);
+    memcpy(outstr, instr, ll);
     *outll = ll;
     if (outcs)
 	*outcs = incs;
@@ -335,19 +332,18 @@ stringaszleline(unsigned char *instr, in
  */
 
 /**/
-mod_export unsigned char *
+mod_export char *
 zlegetline(int *ll, int *cs)
 {
     if (zlemetaline != NULL) {
 	*ll = zlemetall;
 	*cs = zlemetacs;
-	return (unsigned char *)ztrdup((char *)zlemetaline);
-    } else if (zleline) {
-	return zlelineasstring(zleline, zlell, zlecs, ll, cs, 0);
-    } else {
-	*ll = *cs = 0;
-	return (unsigned char *)ztrdup("");
+	return ztrdup(zlemetaline);
     }
+    if (zleline)
+	return zlelineasstring(zleline, zlell, zlecs, ll, cs, 0);
+    *ll = *cs = 0;
+    return ztrdup("");
 }
 
 
@@ -542,7 +538,7 @@ setline(char *s, int flags)
      */
     free(zleline);
 
-    zleline = stringaszleline((unsigned char *)scp, 0, &zlell, &linesz, NULL);
+    zleline = stringaszleline(scp, 0, &zlell, &linesz, NULL);
 
     if ((flags & ZSL_TOEND) && (zlecs = zlell) && invicmdmode())
 	zlecs--;
