From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XD3k3-0005Pg-2M for qemu-devel@nongnu.org; Thu, 31 Jul 2014 23:42:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XD3jx-0006vN-5G for qemu-devel@nongnu.org; Thu, 31 Jul 2014 23:42:50 -0400 Received: from cantor2.suse.de ([195.135.220.15]:54122 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XD3jw-0006ue-Ud for qemu-devel@nongnu.org; Thu, 31 Jul 2014 23:42:45 -0400 Message-ID: <53DB0CB1.9040207@suse.de> Date: Fri, 01 Aug 2014 05:42:41 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1406860365-5516-1-git-send-email-arei.gonglei@huawei.com> <1406860365-5516-3-git-send-email-arei.gonglei@huawei.com> <53DB0499.2010505@redhat.com> <33183CC9F5247A488A2544077AF1902086C1E41E@SZXEMA503-MBS.china.huawei.com> In-Reply-To: <33183CC9F5247A488A2544077AF1902086C1E41E@SZXEMA503-MBS.china.huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 2/8] usb: a trivial code change for more idiomatic writing style List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Gonglei (Arei)" , Eric Blake , "qemu-devel@nongnu.org" Cc: "peter.maydell@linaro.org" , "peter.crosthwaite@xilinx.com" , "Huangweidong (C)" , "stefanha@redhat.com" , "mst@redhat.com" , "marcel.a@redhat.com" , Luonengjun , "armbru@redhat.com" , "lcapitulino@redhat.com" , "av1474@comtv.ru" , "kraxel@redhat.com" , "aliguori@amazon.com" , "imammedo@redhat.com" , "dmitry@daynix.com" , "pbonzini@redhat.com" , "Huangpeng (Peter)" , "dgilbert@redhat.com" Am 01.08.2014 05:32, schrieb Gonglei (Arei): > Hi, >=20 >> Subject: Re: [PATCH v2 2/8] usb: a trivial code change for more idioma= tic writing >> style >> >> On 07/31/2014 08:32 PM, arei.gonglei@huawei.com wrote: >>> From: Gonglei >>> >>> Signed-off-by: Gonglei >>> --- >>> hw/usb/dev-audio.c | 2 +- >>> hw/usb/dev-mtp.c | 4 ++-- >>> hw/usb/hcd-ehci.c | 2 +- >>> 3 files changed, 4 insertions(+), 4 deletions(-) >>> >>> diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c >>> index bfebfe9..988f6cc 100644 >>> --- a/hw/usb/dev-audio.c >>> +++ b/hw/usb/dev-audio.c >>> @@ -371,7 +371,7 @@ static void output_callback(void *opaque, int ava= il) >>> return; >>> } >>> data =3D streambuf_get(&s->out.buf); >>> - if (NULL =3D=3D data) { >>> + if (data =3D=3D NULL) { >> >> Wouldn't it be even more idiomatic as: >> >> if (!data) { >> >> Probably applies throughout your series. >> > OK, will do. Thanks! Not so quick! You are free to use that in your patches, but please don't change all code that way without the author's consent. Just like "equals null" is a natural English way of reading, compared to "null equals something", "not null" reads like a boolean expression to me, and even worse while all valid C, "not strcmp" leads to mind-boggling inverted logic... Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg