diff options
author | Alexander Yurchenko <grange@cvs.openbsd.org> | 2009-01-31 21:23:35 +0000 |
---|---|---|
committer | Alexander Yurchenko <grange@cvs.openbsd.org> | 2009-01-31 21:23:35 +0000 |
commit | fb8520075e527e0a5a87ff01c0d7ae71c65894b9 (patch) | |
tree | 2321a48a35afdaee81947d8785aa33c40e15117a /sys | |
parent | 7516642a6f9860096330abadede99682ab0239b9 (diff) |
No need to invent another _offset, just use the one from param.h.
As a bonus it eliminates casting from pointer to int.
ok miod@ tedu@ millert@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index ca0a8d2388a..0e225c5e01d 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.186 2009/01/09 04:41:02 david Exp $ */ +/* $OpenBSD: if.c,v 1.187 2009/01/31 21:23:34 grange Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -321,8 +321,7 @@ if_alloc_sadl(struct ifnet *ifp) if_free_sadl(ifp); namelen = strlen(ifp->if_xname); -#define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m)) - masklen = _offsetof(struct sockaddr_dl, sdl_data[0]) + namelen; + masklen = offsetof(struct sockaddr_dl, sdl_data[0]) + namelen; socksize = masklen + ifp->if_addrlen; #define ROUNDUP(a) (1 + (((a) - 1) | (sizeof(long) - 1))) if (socksize < sizeof(*sdl)) |