[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 1/2] Introduce strtosz_suffix()
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] Re: [PATCH 1/2] Introduce strtosz_suffix() |
Date: |
Thu, 9 Dec 2010 12:53:58 +0000 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
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().
> 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