qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Zhou Jie <zhoujie2011@cn.fujitsu.com>, qemu-devel@nongnu.org
Cc: jcody@redhat.com, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] block: always compile-check debug prints
Date: Thu, 28 Apr 2016 20:24:18 -0600	[thread overview]
Message-ID: <5722C5D2.1080609@redhat.com> (raw)
In-Reply-To: <1461894245-22798-1-git-send-email-zhoujie2011@cn.fujitsu.com>

[-- Attachment #1: Type: text/plain, Size: 1552 bytes --]

On 04/28/2016 07:44 PM, Zhou Jie wrote:
> Files with conditional debug statements should ensure that the printf is
> always compiled.
> This prevents bitrot of the format string of the debug statement.

The commit message needs to mention...

> 
> Signed-off-by: Zhou Jie <zhoujie2011@cn.fujitsu.com>
> ---

Right here would be a good place to list how v2 differs from v1.

>  block/curl.c     | 10 ++++++++--
>  block/sheepdog.c | 13 ++++++++-----
>  2 files changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/block/curl.c b/block/curl.c
> index 5a8f8b6..da9f5e8 100644
> --- a/block/curl.c
> +++ b/block/curl.c
> @@ -36,10 +36,16 @@
>  // #define DEBUG_VERBOSE
>  
>  #ifdef DEBUG_CURL
> -#define DPRINTF(fmt, ...) do { printf(fmt, ## __VA_ARGS__); } while (0)
> +#define DEBUG_CURL_PRINT 1
>  #else
> -#define DPRINTF(fmt, ...) do { } while (0)
> +#define DEBUG_CURL_PRINT 0
>  #endif
> +#define DPRINTF(fmt, ...)                                            \
> +    do {                                                             \
> +        if (DEBUG_CURL_PRINT) {                                      \
> +            fprintf(stderr, fmt, ## __VA_ARGS__);                    \

...that you are intentionally switching debug output to stderr.

The code changes themselves look fine to me now, so with a better commit
message, you could add:
Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

      reply	other threads:[~2016-04-29  2:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29  1:44 [Qemu-devel] [PATCH v2] block: always compile-check debug prints Zhou Jie
2016-04-29  2:24 ` Eric Blake [this message]

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=5722C5D2.1080609@redhat.com \
    --to=eblake@redhat.com \
    --cc=jcody@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=zhoujie2011@cn.fujitsu.com \
    /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;
as well as URLs for NNTP newsgroup(s).