qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH 1/2] Introduce strtosz_suffix()


From: Jes Sorensen
Subject: [Qemu-devel] Re: [PATCH 1/2] Introduce strtosz_suffix()
Date: Thu, 09 Dec 2010 14:06:24 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Lightning/1.0b3pre Thunderbird/3.1.6

On 12/09/10 13:53, Stefan Hajnoczi wrote:
> On Thu, Dec 09, 2010 at 01:13:33PM +0100, address@hidden 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]