From 9c39f482053578cd14ef5b179253da998be17454 Mon Sep 17 00:00:00 2001 From: guenther <> Date: Wed, 21 Sep 2016 04:38:56 +0000 Subject: Delete casts to off_t and size_t that are implied by assignments or prototypes. Ditto for some of the char* and void* casts too. verified no change to instructions on ILP32 (i386) and LP64 (amd64) ok natano@ abluhm@ deraadt@ millert@ --- src/lib/libc/net/ethers.c | 4 ++-- src/lib/libc/net/freeaddrinfo.c | 4 ++-- src/lib/libc/net/inet_ntop.c | 8 ++++---- src/lib/libc/net/rthdr.c | 5 ++--- src/lib/libc/stdlib/malloc.c | 14 +++++++------- src/lib/libc/stdlib/setenv.c | 4 ++-- 6 files changed, 19 insertions(+), 20 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libc/net/ethers.c b/src/lib/libc/net/ethers.c index a7e0796c72..de68c092f8 100644 --- a/src/lib/libc/net/ethers.c +++ b/src/lib/libc/net/ethers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ethers.c,v 1.24 2015/09/14 11:01:47 guenther Exp $ */ +/* $OpenBSD: ethers.c,v 1.25 2016/09/21 04:38:56 guenther Exp $ */ /* * Copyright (c) 1998 Todd C. Miller @@ -144,7 +144,7 @@ ether_ntohost(char *hostname, struct ether_addr *e) } #endif if (ether_line(buf, &try, hostname) == 0 && - memcmp((void *)&try, (void *)e, sizeof(try)) == 0) { + memcmp(&try, e, sizeof(try)) == 0) { (void)fclose(f); return (0); } diff --git a/src/lib/libc/net/freeaddrinfo.c b/src/lib/libc/net/freeaddrinfo.c index 2ac84a31f3..154f70cd75 100644 --- a/src/lib/libc/net/freeaddrinfo.c +++ b/src/lib/libc/net/freeaddrinfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: freeaddrinfo.c,v 1.8 2015/12/28 22:08:18 mmcc Exp $ */ +/* $OpenBSD: freeaddrinfo.c,v 1.9 2016/09/21 04:38:56 guenther Exp $ */ /* * Copyright (c) 1996, 1997, 1998, 1999, Craig Metz, All rights reserved. @@ -44,7 +44,7 @@ freeaddrinfo(struct addrinfo *ai) p = ai; ai = ai->ai_next; free(p->ai_canonname); - free((void *)p); + free(p); } while (ai); } DEF_WEAK(freeaddrinfo); diff --git a/src/lib/libc/net/inet_ntop.c b/src/lib/libc/net/inet_ntop.c index f44dd08022..2bb11c2ab2 100644 --- a/src/lib/libc/net/inet_ntop.c +++ b/src/lib/libc/net/inet_ntop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet_ntop.c,v 1.12 2015/09/13 21:36:08 guenther Exp $ */ +/* $OpenBSD: inet_ntop.c,v 1.13 2016/09/21 04:38:56 guenther Exp $ */ /* Copyright (c) 1996 by Internet Software Consortium. * @@ -46,9 +46,9 @@ inet_ntop(int af, const void *src, char *dst, socklen_t size) { switch (af) { case AF_INET: - return (inet_ntop4(src, dst, (size_t)size)); + return (inet_ntop4(src, dst, size)); case AF_INET6: - return (inet_ntop6(src, dst, (size_t)size)); + return (inet_ntop6(src, dst, size)); default: errno = EAFNOSUPPORT; return (NULL); @@ -167,7 +167,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size) /* Is this address an encapsulated IPv4? */ if (i == 6 && best.base == 0 && (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { - if (!inet_ntop4(src+12, tp, (size_t)(ep - tp))) + if (!inet_ntop4(src+12, tp, ep - tp)) return (NULL); tp += strlen(tp); break; diff --git a/src/lib/libc/net/rthdr.c b/src/lib/libc/net/rthdr.c index 1a29e87de1..934a55155a 100644 --- a/src/lib/libc/net/rthdr.c +++ b/src/lib/libc/net/rthdr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rthdr.c,v 1.11 2015/09/14 11:01:47 guenther Exp $ */ +/* $OpenBSD: rthdr.c,v 1.12 2016/09/21 04:38:56 guenther Exp $ */ /* $KAME: rthdr.c,v 1.22 2006/02/09 08:18:58 keiichi Exp $ */ /* @@ -120,8 +120,7 @@ inet6_rth_reverse(const void *in, void *out) segments = rth0_in->ip6r0_len / 2; /* we can't use memcpy here, since in and out may overlap */ - memmove((void *)rth0_out, (void *)rth0_in, - ((rth0_in->ip6r0_len) + 1) << 3); + memmove(rth0_out, rth0_in, ((rth0_in->ip6r0_len) + 1) << 3); rth0_out->ip6r0_segleft = segments; /* reverse the addresses */ diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 0296985e5b..20807a25b4 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.196 2016/09/18 13:46:28 otto Exp $ */ +/* $OpenBSD: malloc.c,v 1.197 2016/09/21 04:38:56 guenther Exp $ */ /* * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek * Copyright (c) 2012 Matthew Dempsky @@ -83,14 +83,14 @@ #define SOME_JUNK 0xd0 /* as in "Duh" :-) */ #define SOME_FREEJUNK 0xdf -#define MMAP(sz) mmap(NULL, (size_t)(sz), PROT_READ | PROT_WRITE, \ - MAP_ANON | MAP_PRIVATE, -1, (off_t) 0) +#define MMAP(sz) mmap(NULL, (sz), PROT_READ | PROT_WRITE, \ + MAP_ANON | MAP_PRIVATE, -1, 0) -#define MMAPA(a,sz) mmap((a), (size_t)(sz), PROT_READ | PROT_WRITE, \ - MAP_ANON | MAP_PRIVATE, -1, (off_t) 0) +#define MMAPA(a,sz) mmap((a), (sz), PROT_READ | PROT_WRITE, \ + MAP_ANON | MAP_PRIVATE, -1, 0) -#define MQUERY(a, sz) mquery((a), (size_t)(sz), PROT_READ | PROT_WRITE, \ - MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, (off_t)0) +#define MQUERY(a, sz) mquery((a), (sz), PROT_READ | PROT_WRITE, \ + MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0) struct region_info { void *p; /* page; low bits used to mark chunks */ diff --git a/src/lib/libc/stdlib/setenv.c b/src/lib/libc/stdlib/setenv.c index 60c2cd46a6..15c550ba30 100644 --- a/src/lib/libc/stdlib/setenv.c +++ b/src/lib/libc/stdlib/setenv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setenv.c,v 1.18 2016/04/25 21:36:04 millert Exp $ */ +/* $OpenBSD: setenv.c,v 1.19 2016/09/21 04:38:56 guenther Exp $ */ /* * Copyright (c) 1987 Regents of the University of California. * All rights reserved. @@ -141,7 +141,7 @@ setenv(const char *name, const char *value, int rewrite) environ[cnt + 1] = NULL; } if (!(environ[offset] = /* name + `=' + value */ - malloc((size_t)((int)(np - name) + l_value + 2)))) + malloc((int)(np - name) + l_value + 2))) return (-1); for (C = environ[offset]; (*C = *name++) && *C != '='; ++C) ; -- cgit v1.2.3-55-g6feb