diff options
author | brooks <brooks@FreeBSD.org> | 2004-01-27 03:15:09 +0000 |
---|---|---|
committer | brooks <brooks@FreeBSD.org> | 2004-01-27 03:15:09 +0000 |
commit | ee9752cd12de59e0da274c35f5eb64ecc0ba7e0d (patch) | |
tree | 05b4dff7e4189367ade4c4b69a7fe4f3b7485542 /sys/net | |
parent | 6d190d0786b3e0ad094d575e18ef2d1bd927d293 (diff) | |
download | FreeBSD-src-ee9752cd12de59e0da274c35f5eb64ecc0ba7e0d.zip FreeBSD-src-ee9752cd12de59e0da274c35f5eb64ecc0ba7e0d.tar.gz |
Clean up macro usage in if_attach():
- Use the system offsetof macro rather then making out own.
- undef ROUND after we use it rather then polluting the whole file.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 6fed45c..c0a3e04 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -410,13 +410,13 @@ if_attach(struct ifnet *ifp) * create a Link Level name for this device */ 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)) socksize = sizeof(*sdl); socksize = ROUNDUP(socksize); +#undef ROUNDUP ifasize = sizeof(*ifa) + 2 * socksize; ifa = (struct ifaddr *)malloc(ifasize, M_IFADDR, M_WAITOK | M_ZERO); if (ifa) { |