mirror of
https://github.com/zsh-users/zsh
synced 2024-10-14 11:53:24 +00:00
33818: fix types passed to sizeof detected by coverity as being wrong
This commit is contained in:
parent
49d6aace41
commit
0d4b548d1e
|
@ -1,3 +1,9 @@
|
|||
2014-11-30 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 33818: Src/Builtins/sched.c, Src/Zle/complist.c,
|
||||
Src/exec.c, Src/sort.c, Src/utils.c: fix types passed to sizeof
|
||||
detected by coverity as being wrong
|
||||
|
||||
2014-11-28 Barton E. Schaefer <schaefer@brasslantern.com>
|
||||
|
||||
* 33819: Test/A06assign.ztst: regression tests for 33816
|
||||
|
|
|
@ -346,7 +346,7 @@ schedgetfn(UNUSED(Param pm))
|
|||
for (i = 0, sch = schedcmds; sch; sch = sch->next, i++)
|
||||
;
|
||||
|
||||
aptr = ret = zhalloc(sizeof(char **) * (i+1));
|
||||
aptr = ret = zhalloc(sizeof(char *) * (i+1));
|
||||
for (sch = schedcmds; sch; sch = sch->next, aptr++) {
|
||||
char tbuf[40], *flagstr;
|
||||
time_t t;
|
||||
|
|
|
@ -2059,8 +2059,8 @@ complistmatches(UNUSED(Hookdef dummy), Chdata dat)
|
|||
|
||||
i = zterm_columns * listdat.nlines;
|
||||
free(mtab);
|
||||
mtab = (Cmatch **) zalloc(i * sizeof(Cmatch **));
|
||||
memset(mtab, 0, i * sizeof(Cmatch **));
|
||||
mtab = (Cmatch **) zalloc(i * sizeof(Cmatch *));
|
||||
memset(mtab, 0, i * sizeof(Cmatch *));
|
||||
free(mgtab);
|
||||
mgtab = (Cmgroup *) zalloc(i * sizeof(Cmgroup));
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -2299,13 +2299,13 @@ addvars(Estate state, Wordcode pc, int addflags)
|
|||
continue;
|
||||
}
|
||||
if (vl) {
|
||||
ptr = arr = (char **) zalloc(sizeof(char **) *
|
||||
ptr = arr = (char **) zalloc(sizeof(char *) *
|
||||
(countlinknodes(vl) + 1));
|
||||
|
||||
while (nonempty(vl))
|
||||
*ptr++ = ztrdup((char *) ugetnode(vl));
|
||||
} else
|
||||
ptr = arr = (char **) zalloc(sizeof(char **));
|
||||
ptr = arr = (char **) zalloc(sizeof(char *));
|
||||
|
||||
*ptr = NULL;
|
||||
if (xtr) {
|
||||
|
|
|
@ -368,7 +368,7 @@ strmetasort(char **array, int sortwhat, int *unmetalenp)
|
|||
sortdir = (sortwhat & SORTIT_BACKWARDS) ? -1 : 1;
|
||||
sortnumeric = (sortwhat & SORTIT_NUMERICALLY) ? 1 : 0;
|
||||
|
||||
qsort(sortptrarr, nsort, sizeof(SortElt *), eltpcmp);
|
||||
qsort(sortptrarr, nsort, sizeof(SortElt), eltpcmp);
|
||||
|
||||
sortnumeric = oldsortnumeric;
|
||||
sortdir = oldsortdir;
|
||||
|
|
|
@ -693,12 +693,12 @@ slashsplit(char *s)
|
|||
int t0;
|
||||
|
||||
if (!*s)
|
||||
return (char **) zshcalloc(sizeof(char **));
|
||||
return (char **) zshcalloc(sizeof(char *));
|
||||
|
||||
for (t = s, t0 = 0; *t; t++)
|
||||
if (*t == '/')
|
||||
t0++;
|
||||
q = r = (char **) zalloc(sizeof(char **) * (t0 + 2));
|
||||
q = r = (char **) zalloc(sizeof(char *) * (t0 + 2));
|
||||
|
||||
while ((t = strchr(s, '/'))) {
|
||||
*q++ = ztrduppfx(s, t - s);
|
||||
|
@ -2955,7 +2955,7 @@ colonsplit(char *s, int uniq)
|
|||
for (t = s, ct = 0; *t; t++) /* count number of colons */
|
||||
if (*t == ':')
|
||||
ct++;
|
||||
ptr = ret = (char **) zalloc(sizeof(char **) * (ct + 2));
|
||||
ptr = ret = (char **) zalloc(sizeof(char *) * (ct + 2));
|
||||
|
||||
t = s;
|
||||
do {
|
||||
|
|
Loading…
Reference in a new issue