Don't cast the value returned from *malloc. No change to compiler output.

This commit is contained in:
dholland 2020-08-09 00:22:53 +00:00
parent efa54c4ea4
commit 85bd10cb24
6 changed files with 33 additions and 33 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: csh.c,v 1.50 2020/04/03 18:11:29 joerg Exp $ */
/* $NetBSD: csh.c,v 1.51 2020/08/09 00:22:53 dholland Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993\
#if 0
static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93";
#else
__RCSID("$NetBSD: csh.c,v 1.50 2020/04/03 18:11:29 joerg Exp $");
__RCSID("$NetBSD: csh.c,v 1.51 2020/08/09 00:22:53 dholland Exp $");
#endif
#endif /* not lint */
@ -697,7 +697,7 @@ importpath(Char *cp)
* i+2 where i is the number of colons in the path. There are i+1
* directories in the path plus we need room for a zero terminator.
*/
pv = (Char **)xcalloc((size_t) (i + 2), sizeof(Char **));
pv = xcalloc((size_t) (i + 2), sizeof(Char **));
dp = cp;
i = 0;
if (*dp)
@ -1211,7 +1211,7 @@ process(int catch)
* Made it!
*/
freelex(&paraml);
freesyn((struct command *) savet), savet = NULL;
freesyn(savet), savet = NULL;
}
resexit(osetexit);
savet = t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.33 2020/04/03 18:11:29 joerg Exp $ */
/* $NetBSD: dir.c,v 1.34 2020/08/09 00:22:53 dholland Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dir.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: dir.c,v 1.33 2020/04/03 18:11:29 joerg Exp $");
__RCSID("$NetBSD: dir.c,v 1.34 2020/08/09 00:22:53 dholland Exp $");
#endif
#endif /* not lint */
@ -128,7 +128,7 @@ dinit(Char *hp)
}
}
dp = (struct directory *)xcalloc(1, sizeof(struct directory));
dp = xcalloc(1, sizeof(*dp));
dp->di_name = cp;
dp->di_count = 0;
dhead.di_next = dhead.di_prev = dp;
@ -363,7 +363,7 @@ dochngd(Char **v, struct command *t)
}
else
cp = dfollow(*v);
dp = (struct directory *)xcalloc(1, sizeof(struct directory));
dp = xcalloc(1, sizeof(*dp));
dp->di_name = cp;
dp->di_count = 0;
dp->di_next = dcwd->di_next;
@ -510,7 +510,7 @@ dopushd(Char **v, struct command *t)
Char *ccp;
ccp = dfollow(*v);
dp = (struct directory *)xcalloc(1, sizeof(struct directory));
dp = xcalloc(1, sizeof(*dp));
dp->di_name = ccp;
dp->di_count = 0;
dp->di_prev = dcwd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: func.c,v 1.43 2019/01/06 01:22:50 christos Exp $ */
/* $NetBSD: func.c,v 1.44 2020/08/09 00:22:53 dholland Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)func.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: func.c,v 1.43 2019/01/06 01:22:50 christos Exp $");
__RCSID("$NetBSD: func.c,v 1.44 2020/08/09 00:22:53 dholland Exp $");
#endif
#endif /* not lint */
@ -414,7 +414,7 @@ doforeach(Char **v, struct command *t)
v = globall(v);
if (v == 0)
stderror(ERR_NAME | ERR_NOMATCH);
nwp = (struct whyle *) xcalloc(1, sizeof *nwp);
nwp = xcalloc(1, sizeof *nwp);
nwp->w_fe = nwp->w_fe0 = v;
gargv = 0;
btell(&nwp->w_start);
@ -452,7 +452,7 @@ dowhile(Char **v, struct command *t)
stderror(ERR_NAME | ERR_EXPRESSION);
if (!again) {
struct whyle *nwp =
(struct whyle *)xcalloc(1, sizeof(*nwp));
xcalloc(1, sizeof(*nwp));
nwp->w_start = lineloc;
nwp->w_end.type = F_SEEK;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lex.c,v 1.34 2019/02/01 08:29:03 mrg Exp $ */
/* $NetBSD: lex.c,v 1.35 2020/08/09 00:22:53 dholland Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)lex.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: lex.c,v 1.34 2019/02/01 08:29:03 mrg Exp $");
__RCSID("$NetBSD: lex.c,v 1.35 2020/08/09 00:22:53 dholland Exp $");
#endif
#endif /* not lint */
@ -877,7 +877,7 @@ dosub(int sc, struct wordent *en, int global)
wdp = hp;
while (--i >= 0) {
struct wordent *new = (struct wordent *)xcalloc(1, sizeof *wdp);
struct wordent *new = xcalloc(1, sizeof *new);
new->word = 0;
new->prev = wdp;
@ -1453,13 +1453,13 @@ again:
if (buf >= fblocks) {
Char **nfbuf;
nfbuf = (Char **)xcalloc((size_t) (fblocks + 2), sizeof(char **));
nfbuf = xcalloc((size_t) (fblocks + 2), sizeof(char **));
if (fbuf) {
(void)blkcpy(nfbuf, fbuf);
free(fbuf);
}
fbuf = nfbuf;
fbuf[fblocks] = (Char *)xcalloc(BUFSIZE, sizeof(Char));
fbuf[fblocks] = xcalloc(BUFSIZE, sizeof(Char));
fblocks++;
if (!intty)
goto again;
@ -1623,9 +1623,9 @@ settell(void)
return;
if (lseek(SHIN, (off_t) 0, SEEK_CUR) < 0 || errno == ESPIPE)
return;
fbuf = (Char **)xcalloc(2, sizeof(Char **));
fbuf = xcalloc(2, sizeof(Char **));
fblocks = 1;
fbuf[0] = (Char *)xcalloc(BUFSIZE, sizeof(Char));
fbuf[0] = xcalloc(BUFSIZE, sizeof(Char));
fseekp = fbobp = feobp = lseek(SHIN, (off_t) 0, SEEK_CUR);
cantell = 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.19 2019/01/05 16:54:00 christos Exp $ */
/* $NetBSD: parse.c,v 1.20 2020/08/09 00:22:53 dholland Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: parse.c,v 1.19 2019/01/05 16:54:00 christos Exp $");
__RCSID("$NetBSD: parse.c,v 1.20 2020/08/09 00:22:53 dholland Exp $");
#endif
#endif /* not lint */
@ -262,7 +262,7 @@ syn0(struct wordent *p1, struct wordent *p2, int flags)
if (t1->t_dtyp == NODE_LIST ||
t1->t_dtyp == NODE_AND ||
t1->t_dtyp == NODE_OR) {
t = (struct command *)xcalloc(1, sizeof(*t));
t = xcalloc(1, sizeof(*t));
t->t_dtyp = NODE_PAREN;
t->t_dflg = F_AMPERSAND | F_NOINTERRUPT;
t->t_dspr = t1;
@ -270,7 +270,7 @@ syn0(struct wordent *p1, struct wordent *p2, int flags)
}
else
t1->t_dflg |= F_AMPERSAND | F_NOINTERRUPT;
t = (struct command *)xcalloc(1, sizeof(*t));
t = xcalloc(1, sizeof(*t));
t->t_dtyp = NODE_LIST;
t->t_dflg = 0;
t->t_dcar = t1;
@ -308,7 +308,7 @@ syn1(struct wordent *p1, struct wordent *p2, int flags)
case '\n':
if (l != 0)
break;
t = (struct command *) xcalloc(1, sizeof(*t));
t = xcalloc(1, sizeof(*t));
t->t_dtyp = NODE_LIST;
t->t_dcar = syn1a(p1, p, flags);
t->t_dcdr = syntax(p->next, p2, flags);
@ -344,7 +344,7 @@ syn1a(struct wordent *p1, struct wordent *p2, int flags)
if (p->word[1] != '|')
continue;
if (l == 0) {
t = (struct command *)xcalloc(1, sizeof(*t));
t = xcalloc(1, sizeof(*t));
t->t_dtyp = NODE_OR;
t->t_dcar = syn1b(p1, p, flags);
t->t_dcdr = syn1a(p->next, p2, flags);
@ -379,7 +379,7 @@ syn1b(struct wordent *p1, struct wordent *p2, int flags)
continue;
case '&':
if (p->word[1] == '&' && l == 0) {
t = (struct command *)xcalloc(1, sizeof(*t));
t = xcalloc(1, sizeof(*t));
t->t_dtyp = NODE_AND;
t->t_dcar = syn2(p1, p, flags);
t->t_dcdr = syn1b(p->next, p2, flags);
@ -416,7 +416,7 @@ syn2(struct wordent *p1, struct wordent *p2, int flags)
case '|':
if (l != 0)
continue;
t = (struct command *)xcalloc(1, sizeof(*t));
t = xcalloc(1, sizeof(*t));
f = flags | POUT;
pn = p->next;
if (pn != p2 && pn->word[0] == '&') {
@ -508,8 +508,8 @@ again:
}
if (n < 0)
n = 0;
t = (struct command *)xcalloc(1, sizeof(*t));
av = (Char **)xcalloc((size_t)(n + 1), sizeof(Char **));
t = xcalloc(1, sizeof(*t));
av = xcalloc((size_t)(n + 1), sizeof(Char **));
t->t_dcom = av;
n = 0;
if (p2->word[0] == ')')

View File

@ -1,4 +1,4 @@
/* $NetBSD: proc.c,v 1.39 2020/04/03 18:11:29 joerg Exp $ */
/* $NetBSD: proc.c,v 1.40 2020/08/09 00:22:53 dholland Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)proc.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: proc.c,v 1.39 2020/04/03 18:11:29 joerg Exp $");
__RCSID("$NetBSD: proc.c,v 1.40 2020/08/09 00:22:53 dholland Exp $");
#endif
#endif /* not lint */
@ -455,7 +455,7 @@ palloc(int pid, struct command *t)
struct process *pp;
int i;
pp = (struct process *)xcalloc(1, (size_t)sizeof(struct process));
pp = xcalloc(1, sizeof(*pp));
pp->p_pid = pid;
pp->p_flags = t->t_dflg & F_AMPERSAND ? PRUNNING : PRUNNING | PFOREGND;
if (t->t_dflg & F_TIME)