From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: av1474@comtv.ru, kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH] audio: Drop superfluous conditionals around g_free()
Date: Fri, 06 Jun 2014 10:43:22 -0600 [thread overview]
Message-ID: <5391EFAA.6020602@redhat.com> (raw)
In-Reply-To: <1402072513-7001-1-git-send-email-armbru@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1985 bytes --]
On 06/06/2014 10:35 AM, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> audio/alsaaudio.c | 12 ++++--------
> audio/audio_template.h | 15 ++++-----------
> audio/ossaudio.c | 6 ++----
> hw/audio/adlib.c | 4 +---
> 4 files changed, 11 insertions(+), 26 deletions(-)
>
> +++ b/audio/audio_template.h
> @@ -71,10 +71,7 @@ static void glue (audio_init_nb_voices_, TYPE) (struct audio_driver *drv)
>
> static void glue (audio_pcm_hw_free_resources_, TYPE) (HW *hw)
> {
> - if (HWBUF) {
> - g_free (HWBUF);
> - }
> -
> + g_free (HWBUF);
While touching this, you may want to drop the space.
> @@ -92,9 +89,7 @@ static int glue (audio_pcm_hw_alloc_resources_, TYPE) (HW *hw)
>
> static void glue (audio_pcm_sw_free_resources_, TYPE) (SW *sw)
> {
> - if (sw->buf) {
> - g_free (sw->buf);
> - }
> + g_free (sw->buf);
here too.
> @@ -172,10 +167,8 @@ static int glue (audio_pcm_sw_init_, TYPE) (
> static void glue (audio_pcm_sw_fini_, TYPE) (SW *sw)
> {
> glue (audio_pcm_sw_free_resources_, TYPE) (sw);
> - if (sw->name) {
> - g_free (sw->name);
> - sw->name = NULL;
> - }
> + g_free (sw->name);
> + sw->name = NULL;
hmm, it looks like that style is pervasive in this file.
> +++ b/audio/ossaudio.c
> @@ -736,10 +736,8 @@ static void oss_fini_in (HWVoiceIn *hw)
>
> oss_anal_close (&oss->fd);
>
> - if (oss->pcm_buf) {
> - g_free (oss->pcm_buf);
> - oss->pcm_buf = NULL;
> - }
> + g_free(oss->pcm_buf);
> + oss->pcm_buf = NULL;
Here, you DID trim the space. Be consistent - either preserve the
original spacing, or clean it up everywhere.
At any rate, whitespace is trivial, so either way:
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 --]
next prev parent reply other threads:[~2014-06-06 16:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-06 16:35 [Qemu-devel] [PATCH] audio: Drop superfluous conditionals around g_free() Markus Armbruster
2014-06-06 16:43 ` Eric Blake [this message]
2014-06-06 16:56 ` Markus Armbruster
2014-06-10 8:00 ` Gerd Hoffmann
2014-06-12 11:42 ` Gerd Hoffmann
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=5391EFAA.6020602@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=av1474@comtv.ru \
--cc=kraxel@redhat.com \
--cc=qemu-devel@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 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).