From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCp05-0004pV-Ig for qemu-devel@nongnu.org; Wed, 08 Jul 2015 09:03:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCp00-00044M-H1 for qemu-devel@nongnu.org; Wed, 08 Jul 2015 09:02:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35836) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCp00-000442-CD for qemu-devel@nongnu.org; Wed, 08 Jul 2015 09:02:52 -0400 References: From: Paolo Bonzini Message-ID: <559D1F78.9090206@redhat.com> Date: Wed, 8 Jul 2015 15:02:48 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/4] cutils: Add qemu_strto*l() wrappers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Carlos L. Torres" , qemu-devel@nongnu.org Cc: stefanha@redhat.com On 08/07/2015 03:09, Carlos L. Torres wrote: > From: "Carlos L. Torres" > > Introduce qemu_ wrappers for strtol/strtoul/strtoll/strtoull > C functions, ensure that errno is checked, and if NULL is > passed as the endptr argument, then whole string has to be > a valid number on the given base, otherwise return appropriate > error. > > Different from the C strto*l() functions, these wrappers > return through the 'result' out parameter. > > Include unit-tests for each wrapper function. > > Signed-off-by: Carlos L. Torres > > > Carlos L. Torres (4): > cutils: Add qemu_strtol() wrapper > cutils: Add qemu_strtoul() wrapper > cutils: Add qemu_strtoll() wrapper > cutils: Add qemu_strtoull() wrapper > > include/qemu-common.h | 8 + > tests/test-cutils.c | 1172 +++++++++++++++++++++++++++++++++++++++++++++++++ > util/cutils.c | 131 ++++++ > 3 files changed, 1311 insertions(+) > This looks pretty much okay. Of course, you would include at least one conversion from strto* to qemu_strto* (not necessarily one per function, though one signed case and one unsigned case would be great). Paolo