From: "Benoît Canet" <benoit.canet@irqsave.net>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] smbios: use g_free directly on NULL pointers
Date: Thu, 5 Jun 2014 17:40:00 +0200 [thread overview]
Message-ID: <20140605153959.GA6798@irqsave.net> (raw)
In-Reply-To: <1401897628-13422-1-git-send-email-pbonzini@redhat.com>
The Wednesday 04 Jun 2014 à 18:00:28 (+0200), Paolo Bonzini wrote :
> No need to wrap it with an if.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> hw/i386/smbios.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c
> index 7660718..ab89420 100644
> --- a/hw/i386/smbios.c
> +++ b/hw/i386/smbios.c
> @@ -740,11 +740,6 @@ void smbios_set_cpuid(uint32_t version, uint32_t features)
> field = value; \
> }
>
> -#define G_FREE_UNLESS_NULL(ptr) \
> - if (ptr != NULL) { \
> - g_free(ptr); \
> - }
> -
> void smbios_set_defaults(const char *manufacturer, const char *product,
> const char *version, bool legacy_mode)
> {
> @@ -753,7 +748,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
>
> /* drop unwanted version of command-line file blob(s) */
> if (smbios_legacy) {
> - G_FREE_UNLESS_NULL(smbios_tables);
> + g_free(smbios_tables);
> /* in legacy mode, also complain if fields were given for types > 1 */
> if (find_next_bit(have_fields_bitmap,
> SMBIOS_MAX_TYPE+1, 2) < SMBIOS_MAX_TYPE+1) {
> @@ -762,7 +757,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
> exit(1);
> }
> } else {
> - G_FREE_UNLESS_NULL(smbios_entries);
> + g_free(smbios_entries);
> }
>
> SMBIOS_SET_DEFAULT(type1.manufacturer, manufacturer);
> --
> 1.8.3.1
>
>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
WARNING: multiple messages have this Message-ID (diff)
From: "Benoît Canet" <benoit.canet@irqsave.net>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] smbios: use g_free directly on NULL pointers
Date: Thu, 5 Jun 2014 17:40:00 +0200 [thread overview]
Message-ID: <20140605153959.GA6798@irqsave.net> (raw)
In-Reply-To: <1401897628-13422-1-git-send-email-pbonzini@redhat.com>
The Wednesday 04 Jun 2014 à 18:00:28 (+0200), Paolo Bonzini wrote :
> No need to wrap it with an if.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> hw/i386/smbios.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c
> index 7660718..ab89420 100644
> --- a/hw/i386/smbios.c
> +++ b/hw/i386/smbios.c
> @@ -740,11 +740,6 @@ void smbios_set_cpuid(uint32_t version, uint32_t features)
> field = value; \
> }
>
> -#define G_FREE_UNLESS_NULL(ptr) \
> - if (ptr != NULL) { \
> - g_free(ptr); \
> - }
> -
> void smbios_set_defaults(const char *manufacturer, const char *product,
> const char *version, bool legacy_mode)
> {
> @@ -753,7 +748,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
>
> /* drop unwanted version of command-line file blob(s) */
> if (smbios_legacy) {
> - G_FREE_UNLESS_NULL(smbios_tables);
> + g_free(smbios_tables);
> /* in legacy mode, also complain if fields were given for types > 1 */
> if (find_next_bit(have_fields_bitmap,
> SMBIOS_MAX_TYPE+1, 2) < SMBIOS_MAX_TYPE+1) {
> @@ -762,7 +757,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
> exit(1);
> }
> } else {
> - G_FREE_UNLESS_NULL(smbios_entries);
> + g_free(smbios_entries);
> }
>
> SMBIOS_SET_DEFAULT(type1.manufacturer, manufacturer);
> --
> 1.8.3.1
>
>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
next prev parent reply other threads:[~2014-06-05 15:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-04 16:00 [Qemu-trivial] [PATCH] smbios: use g_free directly on NULL pointers Paolo Bonzini
2014-06-04 16:00 ` [Qemu-devel] " Paolo Bonzini
2014-06-05 15:40 ` Benoît Canet [this message]
2014-06-05 15:40 ` Benoît Canet
2014-06-08 13:16 ` [Qemu-trivial] " Michael Tokarev
2014-06-08 13:16 ` [Qemu-devel] " Michael Tokarev
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=20140605153959.GA6798@irqsave.net \
--to=benoit.canet@irqsave.net \
--cc=pbonzini@redhat.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.