Received: from eggs.gnu.org ([208.118.235.92]:34582) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvXCA-0002de-73 for qemu-devel@nongnu.org; Wed, 16 Jan 2013 12:54:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvXC9-00075H-5G for qemu-devel@nongnu.org; Wed, 16 Jan 2013 12:54:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvXC8-000755-UE for qemu-devel@nongnu.org; Wed, 16 Jan 2013 12:54:37 -0500 Date: Wed, 16 Jan 2013 15:56:11 -0200 From: Eduardo Habkost Message-ID: <20130116175611.GF10683@otherpad.lan.raisama.net> References: <1358349851-20960-1-git-send-email-ehabkost@redhat.com> <1358349851-20960-2-git-send-email-ehabkost@redhat.com> <50F6DF12.8030703@redhat.com> <20130116173336.GC10683@otherpad.lan.raisama.net> <50F6E85A.2040705@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50F6E85A.2040705@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/8] cutils: unsigned int parsing functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Laszlo Ersek , Chegu Vinod , qemu-devel@nongnu.org, Anthony Liguori On Wed, Jan 16, 2013 at 10:50:18AM -0700, Eric Blake wrote: > On 01/16/2013 10:33 AM, Eduardo Habkost wrote: > > On Wed, Jan 16, 2013 at 10:10:42AM -0700, Eric Blake wrote: > >> On 01/16/2013 08:24 AM, Eduardo Habkost wrote: > >>> There are lots of duplicate parsing code using strto*() in QEMU, and > >>> most of that code is broken in one way or another. Even the visitors > >>> code have duplicate integer parsing code[1]. This introduces functions > >>> to help parsing unsigned int values: parse_uint() and parse_uint_full(). > >>> > >> > >> Your test case lacks test of octal or hexadecimal input strings; is that > >> worth adding? > > > > I believe I trust strtoll() enough to not require tests for those cases. > > But see my comments in 8/8 about whether it makes sense to add a 'base' > parameter to let the caller choose whether they want to allow octal or > require strict decimal parsing. In that case, I will add at least a test cases to check if "010" gives the expected result depending on the 'base' parameter. > > >>> + r = -errno; > >> > >> Why two spaces? > > > > Typo. I will send a fixed version (keeping your Reviewed-by, if you > > don't mind). > > No problem - I wouldn't have left a reviewed-by if I didn't think the > changes couldn't be trivially fixed. On the other hand, you may have a > non-trivial fix in the form of adding a base parameter... I was planning to keep the reviewed-by line only if fixing the trivial whitespace issue above. I won't keep it when adding the 'base' parameter, don't worry. :-) -- Eduardo