Module Name:    src
Committed By:   matt
Date:           Tue May 11 21:01:24 UTC 2010

Modified Files:
        src/lib/libc/net [matt-nb5-mips64]: getifaddrs.c

Log Message:
Use RT_ROUNDUP which will always do the right thing for alignment now.


To generate a diff of this commit:
cvs rdiff -u -r1.11.20.1 -r1.11.20.2 src/lib/libc/net/getifaddrs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/net/getifaddrs.c
diff -u src/lib/libc/net/getifaddrs.c:1.11.20.1 src/lib/libc/net/getifaddrs.c:1.11.20.2
--- src/lib/libc/net/getifaddrs.c:1.11.20.1	Wed Apr 21 05:28:09 2010
+++ src/lib/libc/net/getifaddrs.c	Tue May 11 21:01:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: getifaddrs.c,v 1.11.20.1 2010/04/21 05:28:09 matt Exp $	*/
+/*	$NetBSD: getifaddrs.c,v 1.11.20.2 2010/05/11 21:01:23 matt Exp $	*/
 
 /*
  * Copyright (c) 1995, 1999
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getifaddrs.c,v 1.11.20.1 2010/04/21 05:28:09 matt Exp $");
+__RCSID("$NetBSD: getifaddrs.c,v 1.11.20.2 2010/05/11 21:01:23 matt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -51,8 +51,7 @@
 __weak_alias(freeifaddrs,_freeifaddrs)
 #endif
 
-#define	SALIGN	(sizeof(long) - 1)
-#define	SA_RLEN(sa)	((sa)->sa_len ? (((sa)->sa_len + SALIGN) & ~SALIGN) : (SALIGN + 1))
+#define	SA_RLEN(sa)	RT_ROUNDUP((sa)->sa_len)
 
 int
 getifaddrs(struct ifaddrs **pif)
@@ -107,8 +106,7 @@
 				idx = ifm->ifm_index;
 				++icnt;
 				dl = (struct sockaddr_dl *)(void *)(ifm + 1);
-				dcnt += SA_RLEN((const struct sockaddr *)(const void *)dl) +
-				    ALIGNBYTES;
+				dcnt += SA_RLEN((const struct sockaddr *)(const void *)dl);
 				dcnt += sizeof(ifm->ifm_data);
 				ncnt += dl->sdl_nlen + 1;
 			} else

Reply via email to