OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 3/3] Use BUILD_BUG_ON in net/core/flowi.c
[PATCH 3/3] Use BUILD_BUG_ON in net/core/flowi.c [message #22156] Mon, 22 October 2007 15:28 Go to next message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
Instead of ugly extern not-existing function.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/core/flow.c b/net/core/flow.c
index 0ab5234..3ed2b4b 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -142,8 +142,6 @@ typedef u64 flow_compare_t;
 typedef u32 flow_compare_t;
 #endif
 
-extern void flowi_is_missized(void);
-
 /* I hear what you're saying, use memcmp.  But memcmp cannot make
  * important assumptions that we can here, such as alignment and
  * constant size.
@@ -153,8 +151,7 @@ static int flow_key_compare(struct flowi *key1, struct flowi *key2)
 	flow_compare_t *k1, *k1_lim, *k2;
 	const int n_elem = sizeof(struct flowi) / sizeof(flow_compare_t);
 
-	if (sizeof(struct flowi) % sizeof(flow_compare_t))
-		flowi_is_missized();
+	BUILD_BUG_ON(sizeof(struct flowi) % sizeof(flow_compare_t));
 
 	k1 = (flow_compare_t *) key1;
 	k1_lim = k1 + n_elem;
-- 
1.5.3.4
Re: [PATCH 3/3] Use BUILD_BUG_ON in net/core/flowi.c [message #22242 is a reply to message #22156] Wed, 24 October 2007 04:15 Go to previous message
davem is currently offline  davem
Messages: 463
Registered: February 2006
Senior Member
From: Pavel Emelyanov <xemul@openvz.org>
Date: Mon, 22 Oct 2007 19:28:22 +0400

> Instead of ugly extern not-existing function.

I can take credit for this turd.  Hey, it was the accepted way to do
compile time assertions at the time :-)

> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Applied!
Previous Topic: [PATCH 2/3] Remove in-code externs for some functions from net/core/dev.c
Next Topic: [PATCH] Explicitly call fib_get_table() in fib_frontend.c
Goto Forum:
  


Current Time: Sat May 25 01:46:44 GMT 2024

Total time taken to generate the page: 0.01694 seconds