From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGtJD-0006qH-VG for qemu-devel@nongnu.org; Sun, 19 Jul 2015 14:27:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZGtJA-0005r4-Pe for qemu-devel@nongnu.org; Sun, 19 Jul 2015 14:27:31 -0400 Received: from mail-ob0-x234.google.com ([2607:f8b0:4003:c01::234]:33026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGtJA-0005r0-L9 for qemu-devel@nongnu.org; Sun, 19 Jul 2015 14:27:28 -0400 Received: by obbgp5 with SMTP id gp5so90848510obb.0 for ; Sun, 19 Jul 2015 11:27:28 -0700 (PDT) Date: Sun, 19 Jul 2015 13:27:26 -0500 From: "Carlos L. Torres" Message-ID: <20150719182726.GA12754@carl6796-MacBookPro> References: <5b903011386171258cca188ac2b35ae320cdb340.1437263259.git.carlos.torres@rackspace.com> <55ABE384.2040905@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55ABE384.2040905@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 5/5] qmp: Add example usage of strto*l() qemu wrapper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, stefanha@redhat.com On Sun, Jul 19, 2015 at 07:51:00PM +0200, Paolo Bonzini wrote: > > > On 19/07/2015 01:52, Carlos L. Torres wrote: > > + int err; > > > > info->qemu = g_new0(VersionTriple, 1); > > - info->qemu->major = strtol(version, &tmp, 10); > > + err = qemu_strtol(version, &tmp, 10, &(info->qemu->major)); > > There are usually no parentheses around the argument of the & operator. > > > + if (err) { > > + error_setg(errp, "There was a problem retrieving QEMU major version."); > > + } > > I think it's okay to just assert that err is zero. Otherwise, this > simple example is okay. Thanks! > > Paolo > > > tmp++; > > - info->qemu->minor = strtol(tmp, &tmp, 10); > > + > > + err = qemu_strtol(tmp, &tmp, 10, &(info->qemu->minor)); > > + if (err) { > > + error_setg(errp, "There was a problem retrieving QEMU minor version."); > > + } > > tmp++; > > - info->qemu->micro = strtol(tmp, &tmp, 10); > > + > > + err = qemu_strtol(tmp, &tmp, 10, &(info->qemu->micro)); > > + if (err) { > > + error_setg(errp, "There was a problem retrieving QEMU micro version."); > > + } Hi Paolo, Thanks for taking the time to review the patch. I'll make those small changes, and post v3 version of the patch. Thanks, -- Carlos Torres