Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: junkio@cox.net
Cc: git@vger.kernel.org
Subject: [PATCH] quote.c: silence compiler warnings from EMIT macro
Date: Wed, 28 Jun 2006 01:59:23 -0400	[thread overview]
Message-ID: <20060628055923.GA6071@coredump.intra.peff.net> (raw)

Signed-off-by: Jeff King <peff@peff.net>
---
This allows compiling with gcc -Wall -Werror, which makes finding useful
warnings easier. I also think the 'if' is easier to read than the
short-circuit.

 quote.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/quote.c b/quote.c
index dcc2326..1910d00 100644
--- a/quote.c
+++ b/quote.c
@@ -13,7 +13,7 @@ #include "quote.h"
  *  a!b      ==> a'\!'b    ==> 'a'\!'b'
  */
 #undef EMIT
-#define EMIT(x) ( (++len < n) && (*bp++ = (x)) )
+#define EMIT(x) do { if (++len < n) *bp++ = (x); } while(0)
 
 static inline int need_bs_quote(char c)
 {
-- 
1.4.1.rc1.g29f4a-dirty

             reply	other threads:[~2006-06-28  5:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-28  5:59 Jeff King [this message]
2006-06-28 10:01 ` [PATCH] quote.c: silence compiler warnings from EMIT macro Junio C Hamano

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=20060628055923.GA6071@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox