diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-08-20 22:46:33 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-08-20 22:46:33 +0000 |
commit | d67cfd281f05bc48f6a8f1a2b3ebecc840f6c447 (patch) | |
tree | 0750ec06443aca68f749a46b0d060db00564b1e6 /usr.sbin | |
parent | aa0cb4643fc13729e7874a5eb16e9eecd90c1ced (diff) |
stdlib.h is in scope; do not cast malloc/calloc/realloc*
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/amd/amd/nfs_start.c | 4 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/common.c | 6 | ||||
-rw-r--r-- | usr.sbin/lpr/common_source/displayq.c | 4 | ||||
-rw-r--r-- | usr.sbin/lpr/lpd/printjob.c | 4 | ||||
-rw-r--r-- | usr.sbin/lpr/pac/pac.c | 8 | ||||
-rw-r--r-- | usr.sbin/npppd/common/addr_range.c | 7 | ||||
-rw-r--r-- | usr.sbin/npppd/common/hash.c | 4 | ||||
-rw-r--r-- | usr.sbin/pppd/chat/chat.c | 4 |
8 files changed, 20 insertions, 21 deletions
diff --git a/usr.sbin/amd/amd/nfs_start.c b/usr.sbin/amd/amd/nfs_start.c index 96054c0c9c0..0af7260169c 100644 --- a/usr.sbin/amd/amd/nfs_start.c +++ b/usr.sbin/amd/amd/nfs_start.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)nfs_start.c 8.1 (Berkeley) 6/6/93 - * $Id: nfs_start.c,v 1.19 2015/01/21 09:50:25 guenther Exp $ + * $Id: nfs_start.c,v 1.20 2015/08/20 22:46:32 deraadt Exp $ */ #include "am.h" @@ -159,7 +159,7 @@ rpc_pending_now(void) int fdsn; fdsn = howmany(max_fds+1, NFDBITS) * sizeof(fd_mask); - if ((fdsp = (fd_set *)malloc(fdsn)) == NULL) + if ((fdsp = malloc(fdsn)) == NULL) return(0); memset(fdsp, 0, fdsn); FD_SET(fwd_sock, fdsp); diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c index e2d4a063545..9d47ffd9094 100644 --- a/usr.sbin/lpr/common_source/common.c +++ b/usr.sbin/lpr/common_source/common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: common.c,v 1.38 2015/01/16 06:40:17 deraadt Exp $ */ +/* $OpenBSD: common.c,v 1.39 2015/08/20 22:46:32 deraadt Exp $ */ /* $NetBSD: common.c,v 1.21 2000/08/09 14:28:50 itojun Exp $ */ /* @@ -245,7 +245,7 @@ getq(struct queue ***namelist) * and dividing it by a multiple of the minimum size entry. */ arraysz = (stbuf.st_size / 24); - queue = (struct queue **)calloc(arraysz, sizeof(struct queue *)); + queue = calloc(arraysz, sizeof(struct queue *)); if (queue == NULL) goto errdone; @@ -258,7 +258,7 @@ getq(struct queue ***namelist) continue; /* Doesn't exist */ } PRIV_END; - q = (struct queue *)malloc(sizeof(struct queue)); + q = malloc(sizeof(struct queue)); if (q == NULL) goto errdone; q->q_time = stbuf.st_mtime; diff --git a/usr.sbin/lpr/common_source/displayq.c b/usr.sbin/lpr/common_source/displayq.c index 0d401b7a7b5..947d1903c2e 100644 --- a/usr.sbin/lpr/common_source/displayq.c +++ b/usr.sbin/lpr/common_source/displayq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: displayq.c,v 1.36 2015/01/16 06:40:17 deraadt Exp $ */ +/* $OpenBSD: displayq.c,v 1.37 2015/08/20 22:46:32 deraadt Exp $ */ /* $NetBSD: displayq.c,v 1.21 2001/08/30 00:51:50 itojun Exp $ */ /* @@ -285,7 +285,7 @@ displayq(int format) nsa.sa_flags = 0; (void)sigaction(SIGALRM, &nsa, &osa); alarm(wait_time); - if ((visline = (char *)malloc(4 * sizeof(line) + 1)) == NULL) + if ((visline = malloc(4 * sizeof(line) + 1)) == NULL) fatal("Out of memory"); while ((i = read(fd, line, sizeof(line))) > 0) { n = strvisx(visline, line, i, VIS_SAFE|VIS_NOSLASH); diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c index 5445a50ad6b..ec8edd73069 100644 --- a/usr.sbin/lpr/lpd/printjob.c +++ b/usr.sbin/lpr/lpd/printjob.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printjob.c,v 1.54 2015/01/16 06:40:18 deraadt Exp $ */ +/* $OpenBSD: printjob.c,v 1.55 2015/08/20 22:46:32 deraadt Exp $ */ /* $NetBSD: printjob.c,v 1.31 2002/01/21 14:42:30 wiz Exp $ */ /* @@ -1572,7 +1572,7 @@ setty(void) syslog(LOG_INFO, "%s: ioctl(TIOCGWINSZ): %m", printer); - argv = (char **)calloc(256, sizeof(char *)); + argv = calloc(256, sizeof(char *)); if (argv == NULL) { syslog(LOG_ERR, "%s: malloc: %m", printer); exit(1); diff --git a/usr.sbin/lpr/pac/pac.c b/usr.sbin/lpr/pac/pac.c index 1309a997c75..a5d811bcd4f 100644 --- a/usr.sbin/lpr/pac/pac.c +++ b/usr.sbin/lpr/pac/pac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pac.c,v 1.24 2015/02/09 23:00:14 deraadt Exp $ */ +/* $OpenBSD: pac.c,v 1.25 2015/08/20 22:46:32 deraadt Exp $ */ /* $NetBSD: pac.c,v 1.14 2000/04/27 13:40:18 msaitoh Exp $ */ /* @@ -271,7 +271,7 @@ dumpit(void) hp = hashtab[0]; hno = 1; - base = (struct hent **) calloc(hcount, sizeof(hp)); + base = calloc(hcount, sizeof(hp)); if (base == NULL) err(1, NULL); for (ap = base, c = hcount; c--; ap++) { @@ -353,7 +353,7 @@ enter(const char *name) return(hp); h = hash(name); hcount++; - hp = (struct hent *) malloc(sizeof *hp); + hp = malloc(sizeof *hp); if (hp == NULL) err(1, NULL); hp->h_name = strdup(name); @@ -444,7 +444,7 @@ chkprinter(const char *s) if (!pflag && (cgetnum(bp, "pc", &price100) == 0)) price = price100/10000.0; len = strlen(acctfile) + 5; - sumfile = (char *) malloc(len); + sumfile = malloc(len); if (sumfile == NULL) err(1, "pac"); strlcpy(sumfile, acctfile, len); diff --git a/usr.sbin/npppd/common/addr_range.c b/usr.sbin/npppd/common/addr_range.c index 5d259b90996..4eddf20c514 100644 --- a/usr.sbin/npppd/common/addr_range.c +++ b/usr.sbin/npppd/common/addr_range.c @@ -1,4 +1,4 @@ -/* $OpenBSD: addr_range.c,v 1.3 2012/05/08 13:15:11 yasuoka Exp $ */ +/* $OpenBSD: addr_range.c,v 1.4 2015/08/20 22:46:32 deraadt Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. * All rights reserved. @@ -56,7 +56,7 @@ * Author: * Yasuoka Masahiko <yasuoka@iij.ad.jp> * - * $Id: addr_range.c,v 1.3 2012/05/08 13:15:11 yasuoka Exp $ + * $Id: addr_range.c,v 1.4 2015/08/20 22:46:32 deraadt Exp $ */ #ifdef ADDR_RANGE_DEBUG #define IIJDEBUG @@ -89,8 +89,7 @@ struct in_addr_range * in_addr_range_create() { struct in_addr_range *_this; - if ((_this = (struct in_addr_range *)malloc( - sizeof(struct in_addr_range))) == NULL) + if ((_this = malloc(sizeof(struct in_addr_range))) == NULL) return NULL; memset(_this, 0xff, sizeof(struct in_addr_range)); _this->next = NULL; diff --git a/usr.sbin/npppd/common/hash.c b/usr.sbin/npppd/common/hash.c index 6217ef5f78b..8ad248a1caf 100644 --- a/usr.sbin/npppd/common/hash.c +++ b/usr.sbin/npppd/common/hash.c @@ -42,7 +42,7 @@ hash_create(cmp_func, hash_func, hsz) { hash_table *htbl; - htbl = (hash_table *)malloc(sizeof(hash_table)); + htbl = malloc(sizeof(hash_table)); if (htbl == NULL) return NULL; @@ -135,7 +135,7 @@ hash_insert(htbl, k, i) if (htbl == NULL || k == NULL) return -1; - if ((n = (hash_link *)malloc(sizeof(hash_link))) == NULL) { + if ((n = malloc(sizeof(hash_link))) == NULL) { return -1; } diff --git a/usr.sbin/pppd/chat/chat.c b/usr.sbin/pppd/chat/chat.c index bdacd72ac68..081290564f5 100644 --- a/usr.sbin/pppd/chat/chat.c +++ b/usr.sbin/pppd/chat/chat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: chat.c,v 1.31 2015/02/09 23:00:14 deraadt Exp $ */ +/* $OpenBSD: chat.c,v 1.32 2015/08/20 22:46:32 deraadt Exp $ */ /* * Chat -- a program for automatic session establishment (i.e. dial @@ -654,7 +654,7 @@ int sending; /* set to 1 when sending (putting) this string. */ new_length += 3; /* \r and two nuls */ - ret = (char *)malloc(new_length); + ret = malloc(new_length); if (ret == NULL) fatal(2, "cannot allocate memory"); |