qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: Jes.Sorensen@redhat.com
Cc: kwolf@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 1/2] Introduce strtosz_suffix()
Date: Thu, 9 Dec 2010 12:53:58 +0000	[thread overview]
Message-ID: <20101209125357.GA3617@stefanha-thinkpad.localdomain> (raw)
In-Reply-To: <1291896814-3554-2-git-send-email-Jes.Sorensen@redhat.com>

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

  reply	other threads:[~2010-12-09 13:08 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   ` Stefan Hajnoczi [this message]
2010-12-09 13:06     ` [Qemu-devel] " Jes Sorensen
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=20101209125357.GA3617@stefanha-thinkpad.localdomain \
    --to=stefanha@linux.vnet.ibm.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).