All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libceph: re-phrase ceph_decode_need()
@ 2012-07-11 22:00 Alex Elder
  0 siblings, 0 replies; only message in thread
From: Alex Elder @ 2012-07-11 22:00 UTC (permalink / raw)
  To: ceph-devel

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?

Signed-off-by: Alex Elder <elder@inktank.com>
---
 include/linux/ceph/decode.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: b/include/linux/ceph/decode.h
===================================================================
--- a/include/linux/ceph/decode.h
+++ 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)			\

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-11 22:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-11 22:00 [PATCH] libceph: re-phrase ceph_decode_need() Alex Elder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.