diff options
author | Wayne Davison <wayned@users.sourceforge.net> | 2005-11-15 08:44:17 +0000 |
---|---|---|
committer | Wayne Davison <wayned@users.sourceforge.net> | 2005-11-15 08:44:17 +0000 |
commit | e79af955f0620a699b01f11b584788404ba81767 (patch) | |
tree | 3cea0f78df60c7622321e1835ff8b67b347e796f | |
parent | 915e6ff66ad4e64c66eb9be3ced6bc6fdd26c0cf (diff) | |
download | zsh-e79af955f0620a699b01f11b584788404ba81767.tar.gz zsh-e79af955f0620a699b01f11b584788404ba81767.tar.xz zsh-e79af955f0620a699b01f11b584788404ba81767.zip |
Got rid of some unsigned-char/char pointer casts.
-rw-r--r-- | Src/Zle/compcore.c | 8 | ||||
-rw-r--r-- | Src/Zle/compctl.c | 14 | ||||
-rw-r--r-- | Src/Zle/complist.c | 36 | ||||
-rw-r--r-- | Src/Zle/compresult.c | 10 | ||||
-rw-r--r-- | Src/Zle/zle_hist.c | 30 | ||||
-rw-r--r-- | Src/Zle/zle_misc.c | 25 | ||||
-rw-r--r-- | Src/Zle/zle_params.c | 62 | ||||
-rw-r--r-- | Src/Zle/zle_thingy.c | 6 | ||||
-rw-r--r-- | Src/hashtable.c | 2 | ||||
-rw-r--r-- | Src/input.c | 3 | ||||
-rw-r--r-- | Src/loop.c | 2 |
11 files changed, 86 insertions, 112 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index e911cee5f..b777e31ee 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -442,7 +442,7 @@ do_completion(UNUSED(Hookdef dummy), Compldat dat) 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; diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c index 1c1176715..8b72abf07 100644 --- a/Src/Zle/compctl.c +++ b/Src/Zle/compctl.c @@ -220,11 +220,11 @@ compctlread(char *name, char **args, Options ops, char *reply) /* 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 noffs) 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 noffs) 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 noffs) 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, int incmd, int compadd) 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, int incmd, int compadd) 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; diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c index a84a34768..b1d807ac8 100644 --- a/Src/Zle/complist.c +++ b/Src/Zle/complist.c @@ -1855,16 +1855,16 @@ setmstatus(char *status, char *sline, int sll, int scs, *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 { diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c index 84e276747..4c31dab1b 100644 --- a/Src/Zle/compresult.c +++ b/Src/Zle/compresult.c @@ -470,7 +470,7 @@ cline_str(Cline l, int ins, int *csp, LinkList posl) * 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 * diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c index 38540a032..a26aee764 100644 --- a/Src/Zle/zle_hist.c +++ b/Src/Zle/zle_hist.c @@ -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))) { diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c index 4caf0b915..cd91744f8 100644 --- a/Src/Zle/zle_misc.c +++ b/Src/Zle/zle_misc.c @@ -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, <mp, - NULL, NULL); + ZLE_STRING_T ztmp = stringaszleline(peekstr, 0, <mp, + NULL, NULL); zsfree(peekstr); ZS_memcpy(cmdbuf, ztmp, ltmp); free(ztmp); diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c index 7aef5959d..145836442 100644 --- a/Src/Zle/zle_params.c +++ b/Src/Zle/zle_params.c @@ -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, char *x) *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 *lenvar, char *x) 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 ""; } /**/ diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c index 5e0c30633..c947bdd9d 100644 --- a/Src/Zle/zle_thingy.c +++ b/Src/Zle/zle_thingy.c @@ -415,10 +415,8 @@ bin_zle_refresh(UNUSED(char *name), char **args, Options ops, UNUSED(char func)) 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; diff --git a/Src/hashtable.c b/Src/hashtable.c index 470978574..881b45bea 100644 --- a/Src/hashtable.c +++ b/Src/hashtable.c @@ -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 diff --git a/Src/input.c b/Src/input.c index ef3472259..546ed2f6a 100644 --- a/Src/input.c +++ b/Src/input.c @@ -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) { diff --git a/Src/loop.c b/Src/loop.c index bb45690a7..56c76b4bb 100644 --- a/Src/loop.c +++ b/Src/loop.c @@ -245,7 +245,7 @@ execselect(Estate state, UNUSED(int do_exec)) 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; |