All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>,  qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org
Subject: Re: [Qemu-trivial] [PATCH v1 1/1] hexdump: Add null guard on output file.
Date: Sat, 02 Aug 2014 17:26:13 +0400	[thread overview]
Message-ID: <53DCE6F5.7010809@msgid.tls.msk.ru> (raw)
In-Reply-To: <fcfc06335c0f3eaecacd2ac8396c232142ff4774.1406707320.git.peter.crosthwaite@xilinx.com>

31.07.2014 04:31, Peter Crosthwaite wrote:
> To avoid callsites with optional output having to NULL guard.

Isn't it a bit backwards?  If we don't need output, maybe we should
not call hexdump in the first place?

Thanks,

/mjt

> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
> Noting in-tree is affected by this yet, but I though I'd get this
> out of the way straight-up rather than elongate other series.
> 
>  util/hexdump.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/util/hexdump.c b/util/hexdump.c
> index 969b340..b607236 100644
> --- a/util/hexdump.c
> +++ b/util/hexdump.c
> @@ -19,6 +19,9 @@ void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t size)
>  {
>      unsigned int b;
>  
> +    if (!fp) {
> +        return;
> +    }
>      for (b = 0; b < size; b++) {
>          if ((b % 16) == 0) {
>              fprintf(fp, "%s: %04x:", prefix, b);
> 



WARNING: multiple messages have this Message-ID (diff)
From: Michael Tokarev <mjt@tls.msk.ru>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH v1 1/1] hexdump: Add null guard on output file.
Date: Sat, 02 Aug 2014 17:26:13 +0400	[thread overview]
Message-ID: <53DCE6F5.7010809@msgid.tls.msk.ru> (raw)
In-Reply-To: <fcfc06335c0f3eaecacd2ac8396c232142ff4774.1406707320.git.peter.crosthwaite@xilinx.com>

31.07.2014 04:31, Peter Crosthwaite wrote:
> To avoid callsites with optional output having to NULL guard.

Isn't it a bit backwards?  If we don't need output, maybe we should
not call hexdump in the first place?

Thanks,

/mjt

> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
> Noting in-tree is affected by this yet, but I though I'd get this
> out of the way straight-up rather than elongate other series.
> 
>  util/hexdump.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/util/hexdump.c b/util/hexdump.c
> index 969b340..b607236 100644
> --- a/util/hexdump.c
> +++ b/util/hexdump.c
> @@ -19,6 +19,9 @@ void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t size)
>  {
>      unsigned int b;
>  
> +    if (!fp) {
> +        return;
> +    }
>      for (b = 0; b < size; b++) {
>          if ((b % 16) == 0) {
>              fprintf(fp, "%s: %04x:", prefix, b);
> 

  reply	other threads:[~2014-08-02 13:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-31  0:31 [Qemu-trivial] [PATCH v1 1/1] hexdump: Add null guard on output file Peter Crosthwaite
2014-07-31  0:31 ` [Qemu-devel] " Peter Crosthwaite
2014-08-02 13:26 ` Michael Tokarev [this message]
2014-08-02 13:26   ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-08-03  1:14   ` [Qemu-trivial] [Qemu-devel] " Peter Crosthwaite
2014-08-03  1:14     ` [Qemu-devel] [Qemu-trivial] " Peter Crosthwaite
2014-08-03  1:15     ` [Qemu-trivial] [Qemu-devel] " Peter Crosthwaite
2014-08-03  1:15       ` [Qemu-devel] [Qemu-trivial] " Peter Crosthwaite
2014-08-03  1:17     ` [Qemu-trivial] [Qemu-devel] " Peter Crosthwaite
2014-08-03  1:17       ` [Qemu-devel] [Qemu-trivial] " Peter Crosthwaite
2014-08-03 13:11       ` [Qemu-trivial] [Qemu-devel] " Peter Maydell
2014-08-03 13:11         ` [Qemu-devel] [Qemu-trivial] " Peter Maydell

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=53DCE6F5.7010809@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.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.