From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH] libceph: re-phrase ceph_decode_need()
Date: Wed, 11 Jul 2012 17:00:42 -0500 [thread overview]
Message-ID: <4FFDF78A.7050606@inktank.com> (raw)
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) \
reply other threads:[~2012-07-11 22:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FFDF78A.7050606@inktank.com \
--to=elder@inktank.com \
--cc=ceph-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.