summaryrefslogtreecommitdiff
path: root/sys/netinet/in_var.h
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2008-11-08 12:54:59 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2008-11-08 12:54:59 +0000
commit8082b519e8eb7d4b72eb0bbea42ac126c4ce8d8c (patch)
tree1db91e3f2a917fe69d1b56dd56852adb9458e7a0 /sys/netinet/in_var.h
parent7b3a9f02e74287ece0a22b140146ed8e4ace729d (diff)
fix macros up so they use the do { } while (/* CONSTCOND */ 0) idiom
ok deraadt@ otto@
Diffstat (limited to 'sys/netinet/in_var.h')
-rw-r--r--sys/netinet/in_var.h122
1 files changed, 61 insertions, 61 deletions
diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
index c1cd6412ede..8ebf216cb61 100644
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_var.h,v 1.10 2007/07/20 19:00:35 claudio Exp $ */
+/* $OpenBSD: in_var.h,v 1.11 2008/11/08 12:54:58 dlg Exp $ */
/* $NetBSD: in_var.h,v 1.16 1996/02/13 23:42:15 christos Exp $ */
/*
@@ -89,32 +89,32 @@ void in_socktrim(struct sockaddr_in *);
* Macro for finding the interface (ifnet structure) corresponding to one
* of our IP addresses.
*/
-#define INADDR_TO_IFP(addr, ifp) \
- /* struct in_addr addr; */ \
- /* struct ifnet *ifp; */ \
-{ \
- struct in_ifaddr *ia; \
-\
+#define INADDR_TO_IFP(addr, ifp) \
+ /* struct in_addr addr; */ \
+ /* struct ifnet *ifp; */ \
+do { \
+ struct in_ifaddr *ia; \
+ \
for (ia = TAILQ_FIRST(&in_ifaddr); ia != TAILQ_END(&in_ifaddr) && \
- ia->ia_addr.sin_addr.s_addr != (addr).s_addr; \
- ia = TAILQ_NEXT(ia, ia_list)) \
- continue; \
- (ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \
-}
+ ia->ia_addr.sin_addr.s_addr != (addr).s_addr; \
+ ia = TAILQ_NEXT(ia, ia_list)) \
+ continue; \
+ (ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \
+} while (/* CONSTCOND */ 0)
/*
* Macro for finding the internet address structure (in_ifaddr) corresponding
* to a given interface (ifnet structure).
*/
-#define IFP_TO_IA(ifp, ia) \
- /* struct ifnet *ifp; */ \
- /* struct in_ifaddr *ia; */ \
-{ \
- for ((ia) = TAILQ_FIRST(&in_ifaddr); \
- (ia) != TAILQ_END(&in_ifaddr) && (ia)->ia_ifp != (ifp); \
- (ia) = TAILQ_NEXT((ia), ia_list)) \
- continue; \
-}
+#define IFP_TO_IA(ifp, ia) \
+ /* struct ifnet *ifp; */ \
+ /* struct in_ifaddr *ia; */ \
+do { \
+ for ((ia) = TAILQ_FIRST(&in_ifaddr); \
+ (ia) != TAILQ_END(&in_ifaddr) && (ia)->ia_ifp != (ifp); \
+ (ia) = TAILQ_NEXT((ia), ia_list)) \
+ continue; \
+} while (/* CONSTCOND */ 0)
#endif
/*
@@ -157,23 +157,23 @@ struct in_multistep {
* Macro for looking up the in_multi record for a given IP multicast address
* on a given interface. If no matching record is found, "inm" returns NULL.
*/
-#define IN_LOOKUP_MULTI(addr, ifp, inm) \
- /* struct in_addr addr; */ \
- /* struct ifnet *ifp; */ \
- /* struct in_multi *inm; */ \
-{ \
- struct in_ifaddr *ia; \
-\
- IFP_TO_IA((ifp), ia); \
- if (ia == NULL) \
- (inm) = NULL; \
- else \
- for ((inm) = LIST_FIRST(&ia->ia_multiaddrs); \
- (inm) != LIST_END(&ia->ia_multiaddrs) && \
- (inm)->inm_addr.s_addr != (addr).s_addr; \
- (inm) = LIST_NEXT(inm, inm_list)) \
- continue; \
-}
+#define IN_LOOKUP_MULTI(addr, ifp, inm) \
+ /* struct in_addr addr; */ \
+ /* struct ifnet *ifp; */ \
+ /* struct in_multi *inm; */ \
+do { \
+ struct in_ifaddr *ia; \
+ \
+ IFP_TO_IA((ifp), ia); \
+ if (ia == NULL) \
+ (inm) = NULL; \
+ else \
+ for ((inm) = LIST_FIRST(&ia->ia_multiaddrs); \
+ (inm) != LIST_END(&ia->ia_multiaddrs) && \
+ (inm)->inm_addr.s_addr != (addr).s_addr; \
+ (inm) = LIST_NEXT(inm, inm_list)) \
+ continue; \
+} while (/* CONSTCOND */ 0)
/*
* Macro to step through all of the in_multi records, one at a time.
@@ -182,31 +182,31 @@ struct in_multistep {
* and get the first record. Both macros return a NULL "inm" when there
* are no remaining records.
*/
-#define IN_NEXT_MULTI(step, inm) \
- /* struct in_multistep step; */ \
- /* struct in_multi *inm; */ \
-{ \
- if (((inm) = (step).i_inm) != NULL) \
- (step).i_inm = LIST_NEXT((inm), inm_list); \
- else \
- while ((step).i_ia != NULL) { \
+#define IN_NEXT_MULTI(step, inm) \
+ /* struct in_multistep step; */ \
+ /* struct in_multi *inm; */ \
+do { \
+ if (((inm) = (step).i_inm) != NULL) \
+ (step).i_inm = LIST_NEXT((inm), inm_list); \
+ else \
+ while ((step).i_ia != NULL) { \
(inm) = LIST_FIRST(&(step).i_ia->ia_multiaddrs); \
- (step).i_ia = TAILQ_NEXT((step).i_ia, ia_list); \
- if ((inm) != NULL) { \
+ (step).i_ia = TAILQ_NEXT((step).i_ia, ia_list); \
+ if ((inm) != NULL) { \
(step).i_inm = LIST_NEXT((inm), inm_list); \
- break; \
- } \
- } \
-}
-
-#define IN_FIRST_MULTI(step, inm) \
- /* struct in_multistep step; */ \
- /* struct in_multi *inm; */ \
-{ \
- (step).i_ia = TAILQ_FIRST(&in_ifaddr); \
- (step).i_inm = NULL; \
- IN_NEXT_MULTI((step), (inm)); \
-}
+ break; \
+ } \
+ } \
+} while (/* CONSTCOND */ 0)
+
+#define IN_FIRST_MULTI(step, inm) \
+ /* struct in_multistep step; */ \
+ /* struct in_multi *inm; */ \
+do { \
+ (step).i_ia = TAILQ_FIRST(&in_ifaddr); \
+ (step).i_inm = NULL; \
+ IN_NEXT_MULTI((step), (inm)); \
+} while (/* CONSTCOND */ 0)
int in_ifinit(struct ifnet *,
struct in_ifaddr *, struct sockaddr_in *, int);