summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguenther <>2016-09-21 04:38:56 +0000
committerguenther <>2016-09-21 04:38:56 +0000
commit9c39f482053578cd14ef5b179253da998be17454 (patch)
tree3bb42615ccded37cb263d99efa2577aacafc250f
parent6d139a2f685581fa5f221bba4bc860f16b4af925 (diff)
downloadopenbsd-9c39f482053578cd14ef5b179253da998be17454.tar.gz
openbsd-9c39f482053578cd14ef5b179253da998be17454.tar.bz2
openbsd-9c39f482053578cd14ef5b179253da998be17454.zip
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@
-rw-r--r--src/lib/libc/net/ethers.c4
-rw-r--r--src/lib/libc/net/freeaddrinfo.c4
-rw-r--r--src/lib/libc/net/inet_ntop.c8
-rw-r--r--src/lib/libc/net/rthdr.c5
-rw-r--r--src/lib/libc/stdlib/malloc.c14
-rw-r--r--src/lib/libc/stdlib/setenv.c4
6 files changed, 19 insertions, 20 deletions
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 @@
1/* $OpenBSD: ethers.c,v 1.24 2015/09/14 11:01:47 guenther Exp $ */ 1/* $OpenBSD: ethers.c,v 1.25 2016/09/21 04:38:56 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -144,7 +144,7 @@ ether_ntohost(char *hostname, struct ether_addr *e)
144 } 144 }
145#endif 145#endif
146 if (ether_line(buf, &try, hostname) == 0 && 146 if (ether_line(buf, &try, hostname) == 0 &&
147 memcmp((void *)&try, (void *)e, sizeof(try)) == 0) { 147 memcmp(&try, e, sizeof(try)) == 0) {
148 (void)fclose(f); 148 (void)fclose(f);
149 return (0); 149 return (0);
150 } 150 }
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 @@
1/* $OpenBSD: freeaddrinfo.c,v 1.8 2015/12/28 22:08:18 mmcc Exp $ */ 1/* $OpenBSD: freeaddrinfo.c,v 1.9 2016/09/21 04:38:56 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, 1997, 1998, 1999, Craig Metz, All rights reserved. 4 * Copyright (c) 1996, 1997, 1998, 1999, Craig Metz, All rights reserved.
@@ -44,7 +44,7 @@ freeaddrinfo(struct addrinfo *ai)
44 p = ai; 44 p = ai;
45 ai = ai->ai_next; 45 ai = ai->ai_next;
46 free(p->ai_canonname); 46 free(p->ai_canonname);
47 free((void *)p); 47 free(p);
48 } while (ai); 48 } while (ai);
49} 49}
50DEF_WEAK(freeaddrinfo); 50DEF_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 @@
1/* $OpenBSD: inet_ntop.c,v 1.12 2015/09/13 21:36:08 guenther Exp $ */ 1/* $OpenBSD: inet_ntop.c,v 1.13 2016/09/21 04:38:56 guenther Exp $ */
2 2
3/* Copyright (c) 1996 by Internet Software Consortium. 3/* Copyright (c) 1996 by Internet Software Consortium.
4 * 4 *
@@ -46,9 +46,9 @@ inet_ntop(int af, const void *src, char *dst, socklen_t size)
46{ 46{
47 switch (af) { 47 switch (af) {
48 case AF_INET: 48 case AF_INET:
49 return (inet_ntop4(src, dst, (size_t)size)); 49 return (inet_ntop4(src, dst, size));
50 case AF_INET6: 50 case AF_INET6:
51 return (inet_ntop6(src, dst, (size_t)size)); 51 return (inet_ntop6(src, dst, size));
52 default: 52 default:
53 errno = EAFNOSUPPORT; 53 errno = EAFNOSUPPORT;
54 return (NULL); 54 return (NULL);
@@ -167,7 +167,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size)
167 /* Is this address an encapsulated IPv4? */ 167 /* Is this address an encapsulated IPv4? */
168 if (i == 6 && best.base == 0 && 168 if (i == 6 && best.base == 0 &&
169 (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { 169 (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
170 if (!inet_ntop4(src+12, tp, (size_t)(ep - tp))) 170 if (!inet_ntop4(src+12, tp, ep - tp))
171 return (NULL); 171 return (NULL);
172 tp += strlen(tp); 172 tp += strlen(tp);
173 break; 173 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 @@
1/* $OpenBSD: rthdr.c,v 1.11 2015/09/14 11:01:47 guenther Exp $ */ 1/* $OpenBSD: rthdr.c,v 1.12 2016/09/21 04:38:56 guenther Exp $ */
2/* $KAME: rthdr.c,v 1.22 2006/02/09 08:18:58 keiichi Exp $ */ 2/* $KAME: rthdr.c,v 1.22 2006/02/09 08:18:58 keiichi Exp $ */
3 3
4/* 4/*
@@ -120,8 +120,7 @@ inet6_rth_reverse(const void *in, void *out)
120 segments = rth0_in->ip6r0_len / 2; 120 segments = rth0_in->ip6r0_len / 2;
121 121
122 /* we can't use memcpy here, since in and out may overlap */ 122 /* we can't use memcpy here, since in and out may overlap */
123 memmove((void *)rth0_out, (void *)rth0_in, 123 memmove(rth0_out, rth0_in, ((rth0_in->ip6r0_len) + 1) << 3);
124 ((rth0_in->ip6r0_len) + 1) << 3);
125 rth0_out->ip6r0_segleft = segments; 124 rth0_out->ip6r0_segleft = segments;
126 125
127 /* reverse the addresses */ 126 /* 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 @@
1/* $OpenBSD: malloc.c,v 1.196 2016/09/18 13:46:28 otto Exp $ */ 1/* $OpenBSD: malloc.c,v 1.197 2016/09/21 04:38:56 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net> 3 * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net>
4 * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> 4 * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@@ -83,14 +83,14 @@
83#define SOME_JUNK 0xd0 /* as in "Duh" :-) */ 83#define SOME_JUNK 0xd0 /* as in "Duh" :-) */
84#define SOME_FREEJUNK 0xdf 84#define SOME_FREEJUNK 0xdf
85 85
86#define MMAP(sz) mmap(NULL, (size_t)(sz), PROT_READ | PROT_WRITE, \ 86#define MMAP(sz) mmap(NULL, (sz), PROT_READ | PROT_WRITE, \
87 MAP_ANON | MAP_PRIVATE, -1, (off_t) 0) 87 MAP_ANON | MAP_PRIVATE, -1, 0)
88 88
89#define MMAPA(a,sz) mmap((a), (size_t)(sz), PROT_READ | PROT_WRITE, \ 89#define MMAPA(a,sz) mmap((a), (sz), PROT_READ | PROT_WRITE, \
90 MAP_ANON | MAP_PRIVATE, -1, (off_t) 0) 90 MAP_ANON | MAP_PRIVATE, -1, 0)
91 91
92#define MQUERY(a, sz) mquery((a), (size_t)(sz), PROT_READ | PROT_WRITE, \ 92#define MQUERY(a, sz) mquery((a), (sz), PROT_READ | PROT_WRITE, \
93 MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, (off_t)0) 93 MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0)
94 94
95struct region_info { 95struct region_info {
96 void *p; /* page; low bits used to mark chunks */ 96 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 @@
1/* $OpenBSD: setenv.c,v 1.18 2016/04/25 21:36:04 millert Exp $ */ 1/* $OpenBSD: setenv.c,v 1.19 2016/09/21 04:38:56 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 1987 Regents of the University of California. 3 * Copyright (c) 1987 Regents of the University of California.
4 * All rights reserved. 4 * All rights reserved.
@@ -141,7 +141,7 @@ setenv(const char *name, const char *value, int rewrite)
141 environ[cnt + 1] = NULL; 141 environ[cnt + 1] = NULL;
142 } 142 }
143 if (!(environ[offset] = /* name + `=' + value */ 143 if (!(environ[offset] = /* name + `=' + value */
144 malloc((size_t)((int)(np - name) + l_value + 2)))) 144 malloc((int)(np - name) + l_value + 2)))
145 return (-1); 145 return (-1);
146 for (C = environ[offset]; (*C = *name++) && *C != '='; ++C) 146 for (C = environ[offset]; (*C = *name++) && *C != '='; ++C)
147 ; 147 ;