diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-08-20 21:49:30 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-08-20 21:49:30 +0000 |
commit | b0f86654d3982ec3e78264e7628718e6ae18e12c (patch) | |
tree | f6f1a43aea77a33e57c4446f7a79e32179fccbb7 | |
parent | a2dd9b690f0078a3e6a1fb76a97c846f4c185a06 (diff) |
All these files include <stdlib.h>, so do not need to cast
malloc/calloc/realloc* returns.
-rw-r--r-- | lib/libc/gen/getmntinfo.c | 4 | ||||
-rw-r--r-- | lib/libc/gen/scandir.c | 6 | ||||
-rw-r--r-- | lib/libc/gen/strtofflags.c | 4 | ||||
-rw-r--r-- | lib/libc/rpc/auth_none.c | 4 | ||||
-rw-r--r-- | lib/libc/rpc/clnt_raw.c | 4 | ||||
-rw-r--r-- | lib/libc/rpc/clnt_simple.c | 4 | ||||
-rw-r--r-- | lib/libc/rpc/getrpcent.c | 4 | ||||
-rw-r--r-- | lib/libc/rpc/pmap_rmt.c | 4 | ||||
-rw-r--r-- | lib/libc/rpc/svc.c | 4 | ||||
-rw-r--r-- | lib/libc/rpc/svc_raw.c | 4 | ||||
-rw-r--r-- | lib/libc/rpc/svc_simple.c | 4 | ||||
-rw-r--r-- | lib/libc/rpc/svc_udp.c | 6 | ||||
-rw-r--r-- | lib/libc/stdio/asprintf.c | 4 | ||||
-rw-r--r-- | lib/libc/stdio/vasprintf.c | 4 | ||||
-rw-r--r-- | lib/libc/stdio/vswprintf.c | 4 | ||||
-rw-r--r-- | lib/libc/stdlib/ecvt.c | 6 | ||||
-rw-r--r-- | lib/libc/stdlib/tsearch.c | 4 | ||||
-rw-r--r-- | lib/libc/yp/ypexclude.c | 4 |
18 files changed, 39 insertions, 39 deletions
diff --git a/lib/libc/gen/getmntinfo.c b/lib/libc/gen/getmntinfo.c index 6e9dd857cd7..285687e45f4 100644 --- a/lib/libc/gen/getmntinfo.c +++ b/lib/libc/gen/getmntinfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getmntinfo.c,v 1.8 2015/01/16 16:48:51 deraadt Exp $ */ +/* $OpenBSD: getmntinfo.c,v 1.9 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -50,7 +50,7 @@ getmntinfo(struct statfs **mntbufp, int flags) if (mntbuf) free(mntbuf); bufsize = (mntsize + 1) * sizeof(struct statfs); - if ((mntbuf = (struct statfs *)malloc(bufsize)) == 0) { + if ((mntbuf = malloc(bufsize)) == 0) { bufsize = 0; return (0); } diff --git a/lib/libc/gen/scandir.c b/lib/libc/gen/scandir.c index 40e9b7a8f21..c364bda6c4f 100644 --- a/lib/libc/gen/scandir.c +++ b/lib/libc/gen/scandir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scandir.c,v 1.19 2015/02/05 12:59:57 millert Exp $ */ +/* $OpenBSD: scandir.c,v 1.20 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -82,7 +82,7 @@ scandir(const char *dirname, struct dirent ***namelist, errno = ENOMEM; goto fail; } - names = (struct dirent **)calloc(arraysz, sizeof(struct dirent *)); + names = calloc(arraysz, sizeof(struct dirent *)); if (names == NULL) goto fail; @@ -114,7 +114,7 @@ scandir(const char *dirname, struct dirent ***namelist, /* * Make a minimum size copy of the data */ - p = (struct dirent *)malloc(DIRSIZ(d)); + p = malloc(DIRSIZ(d)); if (p == NULL) goto fail; diff --git a/lib/libc/gen/strtofflags.c b/lib/libc/gen/strtofflags.c index a54fd2ce843..76cc9b7d856 100644 --- a/lib/libc/gen/strtofflags.c +++ b/lib/libc/gen/strtofflags.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtofflags.c,v 1.6 2007/09/02 15:19:16 deraadt Exp $ */ +/* $OpenBSD: strtofflags.c,v 1.7 2015/08/20 21:49:29 deraadt Exp $ */ /*- * Copyright (c) 1993 @@ -82,7 +82,7 @@ fflagstostr(u_int32_t flags) u_int32_t setflags; int i; - if ((string = (char *)calloc(nmappings, longestflaglen + 1)) == NULL) + if ((string = calloc(nmappings, longestflaglen + 1)) == NULL) return (NULL); setflags = flags; diff --git a/lib/libc/rpc/auth_none.c b/lib/libc/rpc/auth_none.c index e77d4de04c6..1c4f3290829 100644 --- a/lib/libc/rpc/auth_none.c +++ b/lib/libc/rpc/auth_none.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auth_none.c,v 1.11 2010/09/01 14:43:34 millert Exp $ */ +/* $OpenBSD: auth_none.c,v 1.12 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 2010, Oracle America, Inc. @@ -75,7 +75,7 @@ authnone_create(void) XDR *xdrs; if (ap == NULL) { - ap = (struct authnone_private *)calloc(1, sizeof (*ap)); + ap = calloc(1, sizeof (*ap)); if (ap == NULL) return (NULL); authnone_private = ap; diff --git a/lib/libc/rpc/clnt_raw.c b/lib/libc/rpc/clnt_raw.c index bddc8d94641..ff9603e2615 100644 --- a/lib/libc/rpc/clnt_raw.c +++ b/lib/libc/rpc/clnt_raw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clnt_raw.c,v 1.18 2015/05/04 09:43:51 jsg Exp $ */ +/* $OpenBSD: clnt_raw.c,v 1.19 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 2010, Oracle America, Inc. @@ -89,7 +89,7 @@ clntraw_create(u_long prog, u_long vers) CLIENT *client; if (clp == NULL) { - clp = (struct clntraw_private *)calloc(1, sizeof (*clp)); + clp = calloc(1, sizeof (*clp)); if (clp == NULL) goto fail; clntraw_private = clp; diff --git a/lib/libc/rpc/clnt_simple.c b/lib/libc/rpc/clnt_simple.c index 2873befc48e..ca53644d8a7 100644 --- a/lib/libc/rpc/clnt_simple.c +++ b/lib/libc/rpc/clnt_simple.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clnt_simple.c,v 1.17 2015/01/16 16:48:51 deraadt Exp $ */ +/* $OpenBSD: clnt_simple.c,v 1.18 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 2010, Oracle America, Inc. @@ -64,7 +64,7 @@ callrpc(char *host, int prognum, int versnum, int procnum, xdrproc_t inproc, struct timeval timeout, tottimeout; if (crp == NULL) { - crp = (struct callrpc_private *)calloc(1, sizeof (*crp)); + crp = calloc(1, sizeof (*crp)); if (crp == NULL) return RPC_SYSTEMERROR; callrpc_private = crp; diff --git a/lib/libc/rpc/getrpcent.c b/lib/libc/rpc/getrpcent.c index 76b8e89a91c..b0f3e4c317d 100644 --- a/lib/libc/rpc/getrpcent.c +++ b/lib/libc/rpc/getrpcent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getrpcent.c,v 1.18 2015/04/25 21:38:22 miod Exp $ */ +/* $OpenBSD: getrpcent.c,v 1.19 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 2010, Oracle America, Inc. @@ -60,7 +60,7 @@ _rpcdata(void) struct rpcdata *d = rpcdata; if (d == NULL) { - d = (struct rpcdata *)calloc(1, sizeof (struct rpcdata)); + d = calloc(1, sizeof (struct rpcdata)); rpcdata = d; } return (d); diff --git a/lib/libc/rpc/pmap_rmt.c b/lib/libc/rpc/pmap_rmt.c index 923dcb9674c..a59bbf72542 100644 --- a/lib/libc/rpc/pmap_rmt.c +++ b/lib/libc/rpc/pmap_rmt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap_rmt.c,v 1.31 2014/11/11 04:51:49 guenther Exp $ */ +/* $OpenBSD: pmap_rmt.c,v 1.32 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 2010, Oracle America, Inc. @@ -171,7 +171,7 @@ newgetbroadcastnets(struct in_addr **addrsp) } } - addrs = (struct in_addr *)calloc(n, sizeof(*addrs)); + addrs = calloc(n, sizeof(*addrs)); if (addrs == NULL) { freeifaddrs(ifap); return 0; diff --git a/lib/libc/rpc/svc.c b/lib/libc/rpc/svc.c index c9a59907baa..0afcb4bffef 100644 --- a/lib/libc/rpc/svc.c +++ b/lib/libc/rpc/svc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svc.c,v 1.26 2014/10/08 05:29:07 deraadt Exp $ */ +/* $OpenBSD: svc.c,v 1.27 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 2010, Oracle America, Inc. @@ -103,7 +103,7 @@ __xprt_register(SVCXPRT *xprt) while (sock + 1 > size) size += FD_SETSIZE; - xp = (SVCXPRT **)calloc(size, sizeof(SVCXPRT *)); + xp = calloc(size, sizeof(SVCXPRT *)); if (xp == NULL) return (0); if (xports) { diff --git a/lib/libc/rpc/svc_raw.c b/lib/libc/rpc/svc_raw.c index d75d9ffefb9..a0a1d054515 100644 --- a/lib/libc/rpc/svc_raw.c +++ b/lib/libc/rpc/svc_raw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svc_raw.c,v 1.10 2010/09/01 14:43:34 millert Exp $ */ +/* $OpenBSD: svc_raw.c,v 1.11 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 2010, Oracle America, Inc. @@ -76,7 +76,7 @@ svcraw_create(void) struct svcraw_private *srp = svcraw_private; if (srp == NULL) { - srp = (struct svcraw_private *)calloc(1, sizeof (*srp)); + srp = calloc(1, sizeof (*srp)); if (srp == NULL) return (NULL); } diff --git a/lib/libc/rpc/svc_simple.c b/lib/libc/rpc/svc_simple.c index 5732454f5fc..22bd5352b14 100644 --- a/lib/libc/rpc/svc_simple.c +++ b/lib/libc/rpc/svc_simple.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svc_simple.c,v 1.11 2010/09/01 14:43:34 millert Exp $ */ +/* $OpenBSD: svc_simple.c,v 1.12 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 2010, Oracle America, Inc. @@ -79,7 +79,7 @@ registerrpc(int prognum, int versnum, int procnum, char *(*progname)(), prognum, versnum); return (-1); } - pl = (struct proglst *)malloc(sizeof(struct proglst)); + pl = malloc(sizeof(struct proglst)); if (pl == NULL) { (void) fprintf(stderr, "registerrpc: out of memory\n"); return (-1); diff --git a/lib/libc/rpc/svc_udp.c b/lib/libc/rpc/svc_udp.c index 6b4ddcb5dfe..4c974ff0cd9 100644 --- a/lib/libc/rpc/svc_udp.c +++ b/lib/libc/rpc/svc_udp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svc_udp.c,v 1.20 2015/05/18 13:57:34 deraadt Exp $ */ +/* $OpenBSD: svc_udp.c,v 1.21 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 2010, Oracle America, Inc. @@ -123,14 +123,14 @@ svcudp_bufcreate(int sock, u_int sendsz, u_int recvsz) (void)close(sock); return (NULL); } - xprt = (SVCXPRT *)malloc(sizeof(SVCXPRT)); + xprt = malloc(sizeof(SVCXPRT)); if (xprt == NULL) { (void)fprintf(stderr, "svcudp_create: out of memory\n"); if (madesock) (void)close(sock); return (NULL); } - su = (struct svcudp_data *)malloc(sizeof(*su)); + su = malloc(sizeof(*su)); if (su == NULL) { (void)fprintf(stderr, "svcudp_create: out of memory\n"); if (madesock) diff --git a/lib/libc/stdio/asprintf.c b/lib/libc/stdio/asprintf.c index 5424c90dc9d..861bb0a797d 100644 --- a/lib/libc/stdio/asprintf.c +++ b/lib/libc/stdio/asprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asprintf.c,v 1.19 2011/05/30 18:48:33 martynas Exp $ */ +/* $OpenBSD: asprintf.c,v 1.20 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> @@ -36,7 +36,7 @@ asprintf(char **str, const char *fmt, ...) _FILEEXT_SETUP(&f, &fext); f._file = -1; f._flags = __SWR | __SSTR | __SALC; - f._bf._base = f._p = (unsigned char *)malloc(128); + f._bf._base = f._p = malloc(128); if (f._bf._base == NULL) goto err; f._bf._size = f._w = 127; /* Leave room for the NUL */ diff --git a/lib/libc/stdio/vasprintf.c b/lib/libc/stdio/vasprintf.c index 8fe7c5bb553..2cc3c7d9356 100644 --- a/lib/libc/stdio/vasprintf.c +++ b/lib/libc/stdio/vasprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vasprintf.c,v 1.16 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: vasprintf.c,v 1.17 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> @@ -33,7 +33,7 @@ vasprintf(char **str, const char *fmt, __va_list ap) _FILEEXT_SETUP(&f, &fext); f._file = -1; f._flags = __SWR | __SSTR | __SALC; - f._bf._base = f._p = (unsigned char *)malloc(128); + f._bf._base = f._p = malloc(128); if (f._bf._base == NULL) goto err; f._bf._size = f._w = 127; /* Leave room for the NUL */ diff --git a/lib/libc/stdio/vswprintf.c b/lib/libc/stdio/vswprintf.c index da7c4deaee0..d79563f5568 100644 --- a/lib/libc/stdio/vswprintf.c +++ b/lib/libc/stdio/vswprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vswprintf.c,v 1.4 2012/12/05 23:20:01 deraadt Exp $ */ +/* $OpenBSD: vswprintf.c,v 1.5 2015/08/20 21:49:29 deraadt Exp $ */ /* $NetBSD: vswprintf.c,v 1.1 2005/05/14 23:51:02 christos Exp $ */ /* @@ -55,7 +55,7 @@ vswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt, _FILEEXT_SETUP(&f, &fext); f._file = -1; f._flags = __SWR | __SSTR | __SALC; - f._bf._base = f._p = (unsigned char *)malloc(128); + f._bf._base = f._p = malloc(128); if (f._bf._base == NULL) { errno = ENOMEM; return (-1); diff --git a/lib/libc/stdlib/ecvt.c b/lib/libc/stdlib/ecvt.c index 4562e309e8e..a0bbbec0737 100644 --- a/lib/libc/stdlib/ecvt.c +++ b/lib/libc/stdlib/ecvt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecvt.c,v 1.8 2013/11/01 19:05:11 guenther Exp $ */ +/* $OpenBSD: ecvt.c,v 1.9 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 2002, 2006 Todd C. Miller <Todd.Miller@courtesan.com> @@ -55,7 +55,7 @@ __cvt(double value, int ndigit, int *decpt, int *sign, int fmode, int pad) if (value == 0.0) { *decpt = 1 - fmode; /* 1 for 'e', 0 for 'f' */ *sign = 0; - if ((rve = s = (char *)malloc(siz)) == NULL) + if ((rve = s = malloc(siz)) == NULL) return(NULL); *rve++ = '0'; *rve = '\0'; @@ -73,7 +73,7 @@ __cvt(double value, int ndigit, int *decpt, int *sign, int fmode, int pad) /* Make a local copy and adjust rve to be in terms of s */ if (pad && fmode) siz += *decpt; - if ((s = (char *)malloc(siz)) == NULL) { + if ((s = malloc(siz)) == NULL) { __freedtoa(p); return(NULL); } diff --git a/lib/libc/stdlib/tsearch.c b/lib/libc/stdlib/tsearch.c index a141085d2b3..6a525e8bf06 100644 --- a/lib/libc/stdlib/tsearch.c +++ b/lib/libc/stdlib/tsearch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsearch.c,v 1.8 2014/03/16 18:38:30 guenther Exp $ */ +/* $OpenBSD: tsearch.c,v 1.9 2015/08/20 21:49:29 deraadt Exp $ */ /* * Tree search generalized from Knuth (6.2.2) Algorithm T just like @@ -40,7 +40,7 @@ tsearch(const void *vkey, void **vrootp, &(*rootp)->left : /* T3: follow left branch */ &(*rootp)->right; /* T4: follow right branch */ } - q = (node *) malloc(sizeof(node)); /* T5: key not found */ + q = malloc(sizeof(node)); /* T5: key not found */ if (q != (struct node_t *)0) { /* make new node */ *rootp = q; /* link new node to old */ q->key = key; /* initialize new node */ diff --git a/lib/libc/yp/ypexclude.c b/lib/libc/yp/ypexclude.c index 35f88ed533c..8a7ff87e1d3 100644 --- a/lib/libc/yp/ypexclude.c +++ b/lib/libc/yp/ypexclude.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypexclude.c,v 1.1 2009/06/03 16:02:44 schwarze Exp $ */ +/* $OpenBSD: ypexclude.c,v 1.2 2015/08/20 21:49:29 deraadt Exp $ */ /* * Copyright (c) 2008 Theo de Raadt * Copyright (c) 1995, 1996, Jason Downs. All rights reserved. @@ -40,7 +40,7 @@ __ypexclude_add(struct _ypexclude **headp, const char *name) if (name[0] == '\0') /* skip */ return (0); - new = (struct _ypexclude *)malloc(sizeof(struct _ypexclude)); + new = malloc(sizeof(struct _ypexclude)); if (new == NULL) return (1); new->name = strdup(name); |