Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove useless casts from calloc

  • Loading branch information...
commit 8d38c71332758e6ec38ff345412857ab73d99d09 1 parent 230cebf
@msantos authored
View
6 ds/ds.c
@@ -122,7 +122,7 @@ main (int argc, char *argv[])
int ch = 0;
- IS_NULL(ds = (DS_STATE *)calloc(1, sizeof(DS_STATE)));
+ IS_NULL(ds = calloc(1, sizeof(DS_STATE)));
ds->queryhost = HOSTNAME;
ds->port.remote = 53;
@@ -202,7 +202,7 @@ ds_writer(DS_STATE *ds)
struct in_addr ia;
- IS_NULL(buf = (u_char *)calloc(1, NS_PACKETSZ));
+ IS_NULL(buf = calloc(1, NS_PACKETSZ));
if (res_mkquery(ns_o_query, HOSTNAME, ns_c_in, ns_t_a, NULL, 0, NULL, buf, NS_PACKETSZ) < 0)
errx(EXIT_FAILURE, "%s", hstrerror(h_errno));
@@ -230,7 +230,7 @@ ds_reader(DS_STATE *ds)
char *status = NULL;
char *rerr = NULL;
- IS_NULL(buf = (u_char *)calloc(1, NS_PACKETSZ));
+ IS_NULL(buf = calloc(1, NS_PACKETSZ));
for ( ; ; ) {
if (woken > 0) return;
View
6 sdt/sdt.c
@@ -42,7 +42,7 @@ main(int argc, char *argv[])
int ch = 0;
int di = 0;
- IS_NULL(ss = (SDT_STATE *)calloc(1, sizeof(SDT_STATE)));
+ IS_NULL(ss = calloc(1, sizeof(SDT_STATE)));
sdt_rand_init();
(void)sdt_dns_init();
@@ -163,7 +163,7 @@ main(int argc, char *argv[])
usage(ss);
ss->dname_max = argc;
- IS_NULL(ss->dname = (char **)calloc(argc, sizeof(char *)));
+ IS_NULL(ss->dname = calloc(argc, sizeof(char *)));
for ( di = 0; di < argc; di++) {
if (strlen(argv[di]) > NS_MAXCDNAME - 1)
usage(ss);
@@ -343,7 +343,7 @@ sdt_loop_A(SDT_STATE *ss)
flags |= O_NONBLOCK;
(void)fcntl(ss->fd_in, F_SETFL, flags);
- IS_NULL(buf = (char *)calloc(ss->bufsz, 1));
+ IS_NULL(buf = calloc(ss->bufsz, 1));
while ( (n = sdt_read(ss, buf, ss->bufsz)) > 0) {
VERBOSE(3, "Sending A record: %d of %u bytes\n", (int32_t)n, (u_int32_t)ss->bufsz);
View
2  sdt/sdt_dns.c
@@ -322,7 +322,7 @@ sdt_dns_dec_CNAME(SDT_STATE *ss, u_char *data, u_int16_t *n)
char *buf = NULL;
char b32[NS_PACKETSZ];
- IS_NULL(buf = (char *)calloc(NS_PACKETSZ, 1));
+ IS_NULL(buf = calloc(NS_PACKETSZ, 1));
if (dn_expand( (const u_char *)data, (const u_char *)data + *n,
(const u_char *)data, b32, NS_PACKETSZ) < 0) {
View
8 sods/sods.c
@@ -41,7 +41,7 @@ main (int argc, char *argv[])
int ch = 0;
int di = 0;
- IS_NULL(ss = (SDS_STATE *)calloc(1, sizeof(SDS_STATE)));
+ IS_NULL(ss = calloc(1, sizeof(SDS_STATE)));
(void)memset(&ss->local, 0, sizeof(struct sockaddr_in));
ss->local.sin_family = AF_INET;
@@ -107,7 +107,7 @@ main (int argc, char *argv[])
usage(ss);
ss->dn_max = argc;
- IS_NULL(ss->dn = (char **)calloc(argc, sizeof(char *)));
+ IS_NULL(ss->dn = calloc(argc, sizeof(char *)));
for ( di = 0; di < argc; di++) {
if (strlen(argv[di]) > NS_MAXCDNAME - 1)
usage(ss);
@@ -150,9 +150,9 @@ sds_parse_forward(SDS_STATE *ss, char *buf)
}
if (ss->fwd == NULL)
- IS_NULL(ss->fwd = (SDS_FWD *)calloc(1, sizeof(SDS_FWD)));
+ IS_NULL(ss->fwd = calloc(1, sizeof(SDS_FWD)));
else
- IS_NULL(ss->fwd = (SDS_FWD *)realloc(ss->fwd, sizeof(SDS_FWD) * (ss->fwds + 1)));
+ IS_NULL(ss->fwd = realloc(ss->fwd, sizeof(SDS_FWD) * (ss->fwds + 1)));
fw = ss->fwd + ss->fwds;
View
6 sods/sods_dns.c
@@ -109,7 +109,7 @@ sds_dns_query_A(void *state, void *packet)
int rv = -1;
IS_NULL(b32 = strdup(pkt->buf));
- IS_NULL(domain = (char *)calloc(NS_MAXDNAME, 1));
+ IS_NULL(domain = calloc(NS_MAXDNAME, 1));
/*%s.%u-%u.id-%d.up.%s */
/* parse out the base32 encoded data */
@@ -160,7 +160,7 @@ sds_dns_query_TXT(void *state, void *packet)
char *domain = NULL;
int rv = -1;
- IS_NULL(domain = (char *)calloc(NS_MAXDNAME, 1));
+ IS_NULL(domain = calloc(NS_MAXDNAME, 1));
if (sscanf(pkt->buf, "%u-%u.id-%u.down.%32s", (u_int32_t *)&pkt->sum,
&nonce, &pkt->sess.id, domain) != 4)
@@ -282,7 +282,7 @@ sds_dns_enc_CNAME(void *state, void *packet)
NULL_RESPONSE(pkt);
- IS_NULL(buf = (char *)calloc(sizeof(pkt->buf), 1));
+ IS_NULL(buf = calloc(sizeof(pkt->buf), 1));
n = base32_encode_length(pkt->buflen); /* len includes NULL */
if (n + (n/NS_MAXLABEL + 1) + 1 >= sizeof(pkt->buf)) {
View
2  sods/sods_io.c
@@ -189,7 +189,7 @@ sds_io_alloc(SDS_STATE *ss, SDS_PKT *pkt)
if (sds_q_init() < 0)
errx(1, "sds_q_init");
- IS_NULL(sc = (SDS_CONN *)calloc(1, sizeof(SDS_CONN)));
+ IS_NULL(sc = calloc(1, sizeof(SDS_CONN)));
sc->id = pkt->sess.f.id;
sc->lastseen = time(NULL);
View
2  sods/sods_sock.c
@@ -50,7 +50,7 @@ sds_sock_loop(void *vp)
SDS_STATE *ss = (SDS_STATE *)vp;
SDS_PKT *pkt = NULL;
- IS_NULL(pkt = (SDS_PKT *)calloc(1, sizeof(SDS_PKT)));
+ IS_NULL(pkt = calloc(1, sizeof(SDS_PKT)));
(void)sds_sock_init(ss);
Please sign in to comment.
Something went wrong with that request. Please try again.