summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-11-07 17:31:25 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-11-07 17:31:25 +0000
commite374d113d8c95a862d57eb44496cca61e2b47114 (patch)
tree3fcbb9b1b6ccac932d01ed34e97447b04872db33 /sys
parent275a0d6ac99ee3fe9c395c8b29dd0df365922824 (diff)
use do { } while (/* CONSTCOND */ 0) loops for all multi-line macros
ok dlg otto claudio
Diffstat (limited to 'sys')
-rw-r--r--sys/sys/mbuf.h35
-rw-r--r--sys/sys/socketvar.h61
2 files changed, 48 insertions, 48 deletions
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 0026492ca38..1afb246d6b2 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbuf.h,v 1.106 2008/11/02 10:37:29 claudio Exp $ */
+/* $OpenBSD: mbuf.h,v 1.107 2008/11/07 17:31:24 deraadt Exp $ */
/* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */
/*
@@ -203,7 +203,7 @@ struct mbuf {
int ms = splvm(); \
{ code } \
splx(ms); \
-} while(/* CONSTCOND */ 0)
+} while (/* CONSTCOND */ 0)
/*
* mbuf allocation/deallocation macros:
@@ -301,8 +301,7 @@ struct mbuf {
/*
* Reset the data pointer on an mbuf.
*/
-#define MRESETDATA(m) \
-do { \
+#define MRESETDATA(m) do { \
if ((m)->m_flags & M_EXT) \
(m)->m_data = (m)->m_ext.ext_buf; \
else if ((m)->m_flags & M_PKTHDR) \
@@ -322,53 +321,53 @@ do { \
* Move just m_pkthdr from from to to,
* remove M_PKTHDR and clean the tag for from.
*/
-#define M_MOVE_HDR(to, from) { \
+#define M_MOVE_HDR(to, from) do { \
(to)->m_pkthdr = (from)->m_pkthdr; \
(from)->m_flags &= ~M_PKTHDR; \
SLIST_INIT(&(from)->m_pkthdr.tags); \
-}
+} while (/* CONSTCOND */ 0)
/*
* Duplicate just m_pkthdr from from to to.
*/
-#define M_DUP_HDR(to, from) { \
+#define M_DUP_HDR(to, from) do { \
(to)->m_pkthdr = (from)->m_pkthdr; \
SLIST_INIT(&(to)->m_pkthdr.tags); \
m_tag_copy_chain((to), (from)); \
-}
+} while (/* CONSTCOND */ 0)
/*
* Duplicate mbuf pkthdr from from to to.
* from must have M_PKTHDR set, and to must be empty.
*/
-#define M_DUP_PKTHDR(to, from) { \
+#define M_DUP_PKTHDR(to, from) do { \
(to)->m_flags = (from)->m_flags & M_COPYFLAGS; \
M_DUP_HDR((to), (from)); \
(to)->m_data = (to)->m_pktdat; \
-}
+} while (/* CONSTCOND */ 0)
/*
* MOVE mbuf pkthdr from from to to.
* from must have M_PKTHDR set, and to must be empty.
*/
-#define M_MOVE_PKTHDR(to, from) { \
+#define M_MOVE_PKTHDR(to, from) do { \
(to)->m_flags = (from)->m_flags & M_COPYFLAGS; \
M_MOVE_HDR((to), (from)); \
(to)->m_data = (to)->m_pktdat; \
-}
+} while (/* CONSTCOND */ 0)
/*
* Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place
* an object of the specified size at the end of the mbuf, longword aligned.
*/
#define M_ALIGN(m, len) \
- { (m)->m_data += (MLEN - (len)) &~ (sizeof(long) - 1); }
+ (m)->m_data += (MLEN - (len)) &~ (sizeof(long) - 1)
/*
* As above, for mbufs allocated with m_gethdr/MGETHDR
* or initialized by M_MOVE_PKTHDR.
*/
#define MH_ALIGN(m, len) \
- { (m)->m_data += (MHLEN - (len)) &~ (sizeof(long) - 1); }
+ (m)->m_data += (MHLEN - (len)) &~ (sizeof(long) - 1)
/*
* Determine if an mbuf's data area is read-only. This is true for
@@ -397,7 +396,7 @@ do { \
* If how is M_DONTWAIT and allocation fails, the original mbuf chain
* is freed and m is set to NULL.
*/
-#define M_PREPEND(m, plen, how) { \
+#define M_PREPEND(m, plen, how) do { \
if (M_LEADINGSPACE(m) >= (plen)) { \
(m)->m_data -= (plen); \
(m)->m_len += (plen); \
@@ -405,16 +404,16 @@ do { \
(m) = m_prepend((m), (plen), (how)); \
if ((m) && (m)->m_flags & M_PKTHDR) \
(m)->m_pkthdr.len += (plen); \
-}
+} while (/* CONSTCOND */ 0)
/* change mbuf to new type */
-#define MCHTYPE(m, t) { \
+#define MCHTYPE(m, t) do { \
MBUFLOCK( \
mbstat.m_mtypes[(m)->m_type]--; \
mbstat.m_mtypes[t]++; \
); \
(m)->m_type = t; \
-}
+} while (/* CONSTCOND */ 0)
/* length to m_copy to copy all */
#define M_COPYALL 1000000000
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index 632e15beb4e..8a17f0d6763 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: socketvar.h,v 1.42 2008/10/09 16:00:07 deraadt Exp $ */
+/* $OpenBSD: socketvar.h,v 1.43 2008/11/07 17:31:24 deraadt Exp $ */
/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
/*-
@@ -110,8 +110,7 @@ struct socket {
pid_t so_cpid; /* pid of process that opened socket */
};
-#define SB_EMPTY_FIXUP(sb) \
-do { \
+#define SB_EMPTY_FIXUP(sb) do { \
if ((sb)->sb_mb == NULL) { \
(sb)->sb_mbtail = NULL; \
(sb)->sb_lastrecord = NULL; \
@@ -178,24 +177,24 @@ do { \
((so)->so_state & SS_CANTSENDMORE) || (so)->so_error)
/* adjust counters in sb reflecting allocation of m */
-#define sballoc(sb, m) { \
- (sb)->sb_cc += (m)->m_len; \
- if ((m)->m_type != MT_CONTROL && (m)->m_type != MT_SONAME) \
- (sb)->sb_datacc += (m)->m_len; \
- (sb)->sb_mbcnt += MSIZE; \
- if ((m)->m_flags & M_EXT) \
- (sb)->sb_mbcnt += (m)->m_ext.ext_size; \
-}
+#define sballoc(sb, m) do { \
+ (sb)->sb_cc += (m)->m_len; \
+ if ((m)->m_type != MT_CONTROL && (m)->m_type != MT_SONAME) \
+ (sb)->sb_datacc += (m)->m_len; \
+ (sb)->sb_mbcnt += MSIZE; \
+ if ((m)->m_flags & M_EXT) \
+ (sb)->sb_mbcnt += (m)->m_ext.ext_size; \
+} while (/* CONSTCOND */ 0)
/* adjust counters in sb reflecting freeing of m */
-#define sbfree(sb, m) { \
- (sb)->sb_cc -= (m)->m_len; \
- if ((m)->m_type != MT_CONTROL && (m)->m_type != MT_SONAME) \
- (sb)->sb_datacc -= (m)->m_len; \
- (sb)->sb_mbcnt -= MSIZE; \
- if ((m)->m_flags & M_EXT) \
- (sb)->sb_mbcnt -= (m)->m_ext.ext_size; \
-}
+#define sbfree(sb, m) do { \
+ (sb)->sb_cc -= (m)->m_len; \
+ if ((m)->m_type != MT_CONTROL && (m)->m_type != MT_SONAME) \
+ (sb)->sb_datacc -= (m)->m_len; \
+ (sb)->sb_mbcnt -= MSIZE; \
+ if ((m)->m_flags & M_EXT) \
+ (sb)->sb_mbcnt -= (m)->m_ext.ext_size; \
+} while (/* CONSTCOND */ 0)
/*
* Set lock on sockbuf sb; sleep if lock is already held.
@@ -207,18 +206,20 @@ do { \
((sb)->sb_flags |= SB_LOCK, 0))
/* release lock on sockbuf sb */
-#define sbunlock(sb) { \
- (sb)->sb_flags &= ~SB_LOCK; \
- if ((sb)->sb_flags & SB_WANT) { \
- (sb)->sb_flags &= ~SB_WANT; \
- wakeup((caddr_t)&(sb)->sb_flags); \
- } \
-}
+#define sbunlock(sb) do { \
+ (sb)->sb_flags &= ~SB_LOCK; \
+ if ((sb)->sb_flags & SB_WANT) { \
+ (sb)->sb_flags &= ~SB_WANT; \
+ wakeup((caddr_t)&(sb)->sb_flags); \
+ } \
+} while (/* CONSTCOND */ 0)
-#define sorwakeup(so) { sowakeup((so), &(so)->so_rcv); \
- if ((so)->so_upcall) \
- (*((so)->so_upcall))((so), (so)->so_upcallarg, M_DONTWAIT); \
- }
+#define sorwakeup(so) do { \
+ sowakeup((so), &(so)->so_rcv); \
+ if ((so)->so_upcall) \
+ (*((so)->so_upcall))((so), (so)->so_upcallarg, \
+ M_DONTWAIT); \
+} while (/* CONSTCOND */ 0)
#define sowwakeup(so) sowakeup((so), &(so)->so_snd)