Received: from eggs.gnu.org ([2001:4830:134:3::10]:33460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsxR8-0003jS-0C for qemu-devel@nongnu.org; Fri, 06 Jun 2014 12:56:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsxR0-000355-HD for qemu-devel@nongnu.org; Fri, 06 Jun 2014 12:56:13 -0400 Received: from oxygen.pond.sub.org ([144.76.244.19]:56933) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsxR0-00034z-BQ for qemu-devel@nongnu.org; Fri, 06 Jun 2014 12:56:06 -0400 From: Markus Armbruster References: <1402072513-7001-1-git-send-email-armbru@redhat.com> <5391EFAA.6020602@redhat.com> Date: Fri, 06 Jun 2014 18:56:04 +0200 In-Reply-To: <5391EFAA.6020602@redhat.com> (Eric Blake's message of "Fri, 06 Jun 2014 10:43:22 -0600") Message-ID: <87lhtadljv.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] audio: Drop superfluous conditionals around g_free() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: av1474@comtv.ru, qemu-devel@nongnu.org, kraxel@redhat.com Eric Blake writes: > On 06/06/2014 10:35 AM, Markus Armbruster wrote: >> Signed-off-by: Markus Armbruster >> --- >> 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. All files are equal in coding style, but some files are more equal than others. Specifically, audio/ and hw/audio/. >> +++ 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. I meant to stick to the audio style, but fingers overruled brain here. > At any rate, whitespace is trivial, so either way: > > Reviewed-by: Eric Blake Gerd, should patches for audio/ conform to the usual style now, or are they still special?