From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=58311 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQgCb-0002eH-25 for qemu-devel@nongnu.org; Thu, 09 Dec 2010 08:06:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQgCZ-00051F-Q2 for qemu-devel@nongnu.org; Thu, 09 Dec 2010 08:06:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQgCZ-000517-JB for qemu-devel@nongnu.org; Thu, 09 Dec 2010 08:06:27 -0500 Message-ID: <4D00D450.4060904@redhat.com> Date: Thu, 09 Dec 2010 14:06:24 +0100 From: Jes Sorensen MIME-Version: 1.0 References: <1291896814-3554-1-git-send-email-Jes.Sorensen@redhat.com> <1291896814-3554-2-git-send-email-Jes.Sorensen@redhat.com> <20101209125357.GA3617@stefanha-thinkpad.localdomain> In-Reply-To: <20101209125357.GA3617@stefanha-thinkpad.localdomain> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: Stefan Hajnoczi Cc: kwolf@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org On 12/09/10 13:53, Stefan Hajnoczi wrote: > 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(). It doesn't make much different to me, but ok, that is easy to fix. >> 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? I'll add that in the same round. Cheers, Jes