Skip to contentSkip to conversation

libceph: re-phrase ceph_decode_need()

PATCH New Alex Elder 1 participant 1 message Jul 11, 2012 Ceph common code (libceph)

lore
Share & tools
lore

Alex Elder

author
#0 lore raw

PATCH 1/1 libceph: re-phrase ceph_decode_need()

For some reason, the way ceph_decode_need() is written throws me off whenever I look at it:

	if (!likely(ceph_has_room(p, end, n)))

I read it as "not likely ceph has room," which is not what it really means. Despite being a double-negative, which I normally avoid, I like this better:

	if (unlikely(!ceph_has_room(p, end, n)))

What do you think?

---
 include/linux/ceph/decode.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/linux/ceph/decode.h +4 -4
Index: b/include/linux/ceph/decode.h
===================================================================
@@ -51,10 +51,10 @@ static inline int ceph_has_room(void **p
 	return end >= *p && n <= end - *p;
 }
 
-#define ceph_decode_need(p, end, n, bad)		\
-	do {						\
-		if (!likely(ceph_has_room(p, end, n)))	\
-			goto bad;			\
+#define ceph_decode_need(p, end, n, bad)			\
+	do {							\
+		if (unlikely(!ceph_has_room(p, end, n)))	\
+			goto bad;				\
 	} while (0)
 
 #define ceph_decode_64_safe(p, end, v, bad)			\