From: Jes Sorensen <Jes.Sorensen@redhat.com>
To: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: kwolf@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 1/2] Introduce strtosz_suffix()
Date: Thu, 09 Dec 2010 14:06:24 +0100 [thread overview]
Message-ID: <4D00D450.4060904@redhat.com> (raw)
In-Reply-To: <20101209125357.GA3617@stefanha-thinkpad.localdomain>
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
next prev parent reply other threads:[~2010-12-09 13:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-09 12:13 [Qemu-devel] [PATCH v4 0/2] Clean up img_create() and introduce strtosz_suffix() Jes.Sorensen
2010-12-09 12:13 ` [Qemu-devel] [PATCH 1/2] Introduce strtosz_suffix() Jes.Sorensen
2010-12-09 12:53 ` [Qemu-devel] " Stefan Hajnoczi
2010-12-09 13:06 ` Jes Sorensen [this message]
2010-12-09 12:13 ` [Qemu-devel] [PATCH 2/2] qemu-img.c: Clean up handling of image size in img_create() Jes.Sorensen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D00D450.4060904@redhat.com \
--to=jes.sorensen@redhat.com \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).