Received: from [140.186.70.92] (port=36642 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQgEf-0003GT-LP for qemu-devel@nongnu.org; Thu, 09 Dec 2010 08:08:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQg0W-0002Vi-Ec for qemu-devel@nongnu.org; Thu, 09 Dec 2010 07:54:02 -0500 Received: from mtagate3.uk.ibm.com ([194.196.100.163]:33804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQg0W-0002VT-2q for qemu-devel@nongnu.org; Thu, 09 Dec 2010 07:54:00 -0500 Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate3.uk.ibm.com (8.13.1/8.13.1) with ESMTP id oB9Crwui028849 for ; Thu, 9 Dec 2010 12:53:58 GMT Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oB9CrxUA3014798 for ; Thu, 9 Dec 2010 12:53:59 GMT Received: from d06av12.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oB9CrvUn015898 for ; Thu, 9 Dec 2010 05:53:57 -0700 Date: Thu, 9 Dec 2010 12:53:58 +0000 From: Stefan Hajnoczi Message-ID: <20101209125357.GA3617@stefanha-thinkpad.localdomain> References: <1291896814-3554-1-git-send-email-Jes.Sorensen@redhat.com> <1291896814-3554-2-git-send-email-Jes.Sorensen@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1291896814-3554-2-git-send-email-Jes.Sorensen@redhat.com> Subject: [Qemu-devel] Re: [PATCH 1/2] Introduce strtosz_suffix() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes.Sorensen@redhat.com Cc: kwolf@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org On Thu, Dec 09, 2010 at 01:13:33PM +0100, Jes.Sorensen@redhat.com wrote: > @@ -371,3 +377,8 @@ fail: > > return retval; > } > + > +ssize_t strtosz(const char *nptr, char **end) > +{ > + return strtosz_suffix(nptr, end, 0); This obscures what the default is, please use STRTOSZ_DEFSUFFIX_MB. 0 isn't very meaningful and requires the reader to dig into strtosz(). > diff --git a/qemu-common.h b/qemu-common.h > index de82c2e..dc44cd6 100644 > --- a/qemu-common.h > +++ b/qemu-common.h > @@ -149,7 +149,14 @@ time_t mktimegm(struct tm *tm); > int qemu_fls(int i); > int qemu_fdatasync(int fd); > int fcntl_setfl(int fd, int flag); > + > +#define STRTOSZ_DEFSUFFIX_TB 'T' > +#define STRTOSZ_DEFSUFFIX_GB 'G' > +#define STRTOSZ_DEFSUFFIX_MB 'M' > +#define STRTOSZ_DEFSUFFIX_KB 'K' > +#define STRTOSZ_DEFSUFFIX_B 'B' > ssize_t strtosz(const char *nptr, char **end); > +ssize_t strtosz_suffix(const char *nptr, char **end, const char); An argument name would be nice: const char unit? Stefan