Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/csh Don't cast the value returned from *malloc. No chang...



details:   https://anonhg.NetBSD.org/src/rev/62880a53d495
branches:  trunk
changeset: 937092:62880a53d495
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Aug 09 00:22:53 2020 +0000

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

diffstat:

 bin/csh/csh.c   |   8 ++++----
 bin/csh/dir.c   |  10 +++++-----
 bin/csh/func.c  |   8 ++++----
 bin/csh/lex.c   |  14 +++++++-------
 bin/csh/parse.c |  20 ++++++++++----------
 bin/csh/proc.c  |   6 +++---
 6 files changed, 33 insertions(+), 33 deletions(-)

diffs (282 lines):

diff -r 407bdb3b0d62 -r 62880a53d495 bin/csh/csh.c
--- a/bin/csh/csh.c     Sat Aug 08 22:41:14 2020 +0000
+++ b/bin/csh/csh.c     Sun Aug 09 00:22:53 2020 +0000
@@ -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 @@
 #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 @@
      * 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 @@
         * Made it!
         */
        freelex(&paraml);
-       freesyn((struct command *) savet), savet = NULL;
+       freesyn(savet), savet = NULL;
     }
     resexit(osetexit);
     savet = t;
diff -r 407bdb3b0d62 -r 62880a53d495 bin/csh/dir.c
--- a/bin/csh/dir.c     Sat Aug 08 22:41:14 2020 +0000
+++ b/bin/csh/dir.c     Sun Aug 09 00:22:53 2020 +0000
@@ -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 @@
        }
     }
 
-    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 @@
     }
     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 @@
        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;
diff -r 407bdb3b0d62 -r 62880a53d495 bin/csh/func.c
--- a/bin/csh/func.c    Sat Aug 08 22:41:14 2020 +0000
+++ b/bin/csh/func.c    Sun Aug 09 00:22:53 2020 +0000
@@ -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 @@
     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 @@
        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;
diff -r 407bdb3b0d62 -r 62880a53d495 bin/csh/lex.c
--- a/bin/csh/lex.c     Sat Aug 08 22:41:14 2020 +0000
+++ b/bin/csh/lex.c     Sun Aug 09 00:22:53 2020 +0000
@@ -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 @@
 
     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 @@
     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 @@
        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;
 }
diff -r 407bdb3b0d62 -r 62880a53d495 bin/csh/parse.c
--- a/bin/csh/parse.c   Sat Aug 08 22:41:14 2020 +0000
+++ b/bin/csh/parse.c   Sun Aug 09 00:22:53 2020 +0000
@@ -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 @@
            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 @@
            }
            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 @@
        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 @@
            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 @@
            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 @@
        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 @@
        }
     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] == ')')
diff -r 407bdb3b0d62 -r 62880a53d495 bin/csh/proc.c
--- a/bin/csh/proc.c    Sat Aug 08 22:41:14 2020 +0000
+++ b/bin/csh/proc.c    Sun Aug 09 00:22:53 2020 +0000
@@ -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 @@
     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)



Home | Main Index | Thread Index | Old Index