From 7cc473aed830db1395ed0d0701791889a6e96e4f Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Mon, 17 Jun 2013 09:36:38 +0200 Subject: Kill a ton of useless casts to char * all over the code. Signed-off-by: Ralf Baechle --- ax25ipd/config.c | 2 +- ax25ipd/io.c | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'ax25ipd') diff --git a/ax25ipd/config.c b/ax25ipd/config.c index 315a243..8d9405b 100644 --- a/ax25ipd/config.c +++ b/ax25ipd/config.c @@ -312,7 +312,7 @@ int parse_line(char *buf) j = inet_addr(q); if (j == -1) return -5; /* if -1, bad deal! */ - memcpy(tip, (char *) &j, 4); + memcpy(tip, &j, 4); } if (my_udp) diff --git a/ax25ipd/io.c b/ax25ipd/io.c index 356ebdc..4277612 100644 --- a/ax25ipd/io.c +++ b/ax25ipd/io.c @@ -126,13 +126,13 @@ void io_init(void) * address structure. Since both to and from are static, they are * already clear. */ - bzero((char *) &to, sizeof(struct sockaddr)); + bzero(&to, sizeof(struct sockaddr)); to.sin_family = AF_INET; - bzero((char *) &from, sizeof(struct sockaddr)); + bzero(&from, sizeof(struct sockaddr)); from.sin_family = AF_INET; - bzero((char *) &udpbind, sizeof(struct sockaddr)); + bzero(&udpbind, sizeof(struct sockaddr)); udpbind.sin_family = AF_INET; } @@ -415,7 +415,9 @@ out_ttyfd: n = recvfrom(udpsock, buf, MAX_FRAME, 0, (struct sockaddr *) &from, &fromlen); } while (io_error(n, buf, n, READ_MSG, UDP_MODE, __LINE__)); - LOGL4("udpdata from=%s port=%d l=%d\n", (char *) inet_ntoa(from. sin_addr), ntohs(from. sin_port), n); + LOGL4("udpdata from=%s port=%d l=%d\n", + inet_ntoa(from. sin_addr), + ntohs(from. sin_port), n); stats.udp_in++; if (n > 0) from_ip(buf, n); @@ -431,7 +433,8 @@ out_ttyfd: while (io_error(n, buf, n, READ_MSG, IP_MODE, __LINE__)); ipptr = (struct iphdr *) buf; hdr_len = 4 * ipptr-> ihl; - LOGL4("ipdata from=%s l=%d, hl=%d\n", (char *) inet_ntoa(from. sin_addr), n, hdr_len); + LOGL4("ipdata from=%s l=%d, hl=%d\n", + inet_ntoa(from. sin_addr), n, hdr_len); stats.ip_in++; if (n > hdr_len) from_ip(buf + hdr_len, n - hdr_len); @@ -445,7 +448,8 @@ out_ttyfd: while (io_error(n, buf, n, READ_MSG, ICMP_MODE, __LINE__)); ipptr = (struct iphdr *) buf; hdr_len = 4 * ipptr-> ihl; - LOGL4("icmpdata from=%s l=%d, hl=%d\n", (char *) inet_ntoa(from. sin_addr), n, hdr_len); + LOGL4("icmpdata from=%s l=%d, hl=%d\n", + inet_ntoa(from. sin_addr), n, hdr_len); } #endif } @@ -461,11 +465,10 @@ void send_ip(unsigned char *buf, int l, unsigned char *targetip) if (l <= 0) return; - memcpy((char *) &to.sin_addr, - targetip, 4); - memcpy((char *) &to.sin_port, - &targetip[4], 2); - LOGL4("sendipdata to=%s %s %d l=%d\n", (char *) inet_ntoa(to. sin_addr), to.sin_port ? "udp" : "ip", ntohs(to.sin_port), l); + memcpy(&to.sin_addr, targetip, 4); + memcpy(&to.sin_port, &targetip[4], 2); + LOGL4("sendipdata to=%s %s %d l=%d\n", inet_ntoa(to. sin_addr), + to.sin_port ? "udp" : "ip", ntohs(to.sin_port), l); if (to.sin_port) { if (udp_mode) { stats.udp_out++; -- cgit v1.2.3