Received: from eggs.gnu.org ([2001:4830:134:3::10]:46392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aduRV-0004Le-Rx for qemu-devel@nongnu.org; Thu, 10 Mar 2016 01:51:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aduRR-0000aL-SH for qemu-devel@nongnu.org; Thu, 10 Mar 2016 01:51:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45573) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aduRR-0000aH-Mb for qemu-devel@nongnu.org; Thu, 10 Mar 2016 01:51:25 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 3CDE3C0A5174 for ; Thu, 10 Mar 2016 06:51:25 +0000 (UTC) From: Markus Armbruster References: <1457503813-31631-1-git-send-email-peterx@redhat.com> <1457503813-31631-3-git-send-email-peterx@redhat.com> <20160310015647.GG23632@ad.usersys.redhat.com> Date: Thu, 10 Mar 2016 07:51:23 +0100 In-Reply-To: <20160310015647.GG23632@ad.usersys.redhat.com> (Fam Zheng's message of "Thu, 10 Mar 2016 09:56:47 +0800") Message-ID: <877fhax1uc.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 2/2] usb: trivial cleanup for usb_mtp_add_str List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, Peter Xu , kraxel@redhat.com Fam Zheng writes: > On Wed, 03/09 14:10, Peter Xu wrote: >> Remove useless var "ret". >> >> Signed-off-by: Peter Xu >> --- >> hw/usb/dev-mtp.c | 4 +--- >> 1 file changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c >> index cf63fd0..38cc4fc 100644 >> --- a/hw/usb/dev-mtp.c >> +++ b/hw/usb/dev-mtp.c >> @@ -719,10 +719,8 @@ static void usb_mtp_add_str(MTPData *data, const char *str) >> { >> uint32_t len = strlen(str)+1; >> wchar_t *wstr = g_malloc(sizeof(wchar_t) * len); >> - size_t ret; >> >> - ret = mbstowcs(wstr, str, len); >> - if (ret == -1) { >> + if (mbstowcs(wstr, str, len) == -1) { >> usb_mtp_add_wstr(data, L"Oops"); >> } else { >> usb_mtp_add_wstr(data, wstr); >> -- >> 2.4.3 >> >> > > The old way has no problem, no need to clean up, IMO. It's a very small readability improvement, but it's an improvement. If I was the maintainer, I'd take it.