qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org,
	qemu-riscv@nongnu.org, Stefano Garzarella <sgarzare@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	Halil Pasic <pasic@linux.ibm.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Richard Henderson <rth@twiddle.net>,
	David Hildenbrand <david@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>,
	Markus Armbruster <armbru@redhat.com>,
	Michael Roth <mdroth@linux.vnet.ibm.com>,
	Michael Clark <mjc@sifive.com>,
	Palmer Dabbelt <palmer@sifive.com>,
	Alistair Francis <Alistair.Francis@wdc.com>,
	Sagar Karandikar <sagark@eecs.berkeley.edu>,
	Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
	Gerd Hoffmann <kraxel@redhat.com>,
	"open list:S390 Virtio-ccw" <qemu-s390x@nongnu.org>,
	qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 2/3] util/cutils: Move ctype macros to "cutils.h"
Date: Tue, 5 Feb 2019 11:32:19 +0100	[thread overview]
Message-ID: <20190205113219.0c1311e0.cohuck@redhat.com> (raw)
In-Reply-To: <20190204211204.27321-3-philmd@redhat.com>

On Mon,  4 Feb 2019 22:12:03 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> Introduced in cd390083ad1, these macros don't need to be in
> a generic header.
> Add documentation to justify their use.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> v2: Fixed checkpatch warnings (tabs)
> ---
>  hw/core/bus.c              |  2 +-
>  hw/core/qdev-properties.c  |  1 +
>  hw/s390x/s390-virtio-ccw.c |  1 +
>  hw/scsi/scsi-generic.c     |  2 +-
>  include/qemu-common.h      | 16 ----------------
>  include/qemu/cutils.h      | 25 +++++++++++++++++++++++++
>  qapi/qapi-util.c           |  2 +-
>  qobject/json-parser.c      |  1 -
>  target/ppc/monitor.c       |  1 +
>  target/riscv/cpu.c         |  1 +
>  ui/keymaps.c               |  1 +
>  util/id.c                  |  2 +-
>  util/readline.c            |  1 -
>  13 files changed, 34 insertions(+), 22 deletions(-)

> diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h
> index 9ee40470e3..644f2d75bd 100644
> --- a/include/qemu/cutils.h
> +++ b/include/qemu/cutils.h
> @@ -3,6 +3,31 @@
>  
>  #include "qemu/fprintf-fn.h"
>  
> +/**
> + * unsigned ctype macros:
> + *
> + * The standards require that the argument for these functions
> + * is either EOF or a value that is representable in the type
> + * unsigned char. If the argument is of type char, it must be
> + * cast to unsigned char. This is what these macros do,
> + * avoiding 'signed to unsigned' conversion warnings.

I'd add

"Note that these macros are intended for use with char arguments only,
they cannot handle EOF."

> + */
> +#define qemu_isalnum(c)     isalnum((unsigned char)(c))
> +#define qemu_isalpha(c)     isalpha((unsigned char)(c))
> +#define qemu_iscntrl(c)     iscntrl((unsigned char)(c))
> +#define qemu_isdigit(c)     isdigit((unsigned char)(c))
> +#define qemu_isgraph(c)     isgraph((unsigned char)(c))
> +#define qemu_islower(c)     islower((unsigned char)(c))
> +#define qemu_isprint(c)     isprint((unsigned char)(c))
> +#define qemu_ispunct(c)     ispunct((unsigned char)(c))
> +#define qemu_isspace(c)     isspace((unsigned char)(c))
> +#define qemu_isupper(c)     isupper((unsigned char)(c))
> +#define qemu_isxdigit(c)    isxdigit((unsigned char)(c))
> +#define qemu_tolower(c)     tolower((unsigned char)(c))
> +#define qemu_toupper(c)     toupper((unsigned char)(c))
> +#define qemu_isascii(c)     isascii((unsigned char)(c))
> +#define qemu_toascii(c)     toascii((unsigned char)(c))
> +
>  /**
>   * pstrcpy:
>   * @buf: buffer to copy string into

With that added,

Reviewed-by: Cornelia Huck <cohuck@redhat.com>

  reply	other threads:[~2019-02-05 10:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-04 21:12 [Qemu-devel] [PATCH v3 0/3] cutils: Cleanup, improve documentation Philippe Mathieu-Daudé
2019-02-04 21:12 ` [Qemu-devel] [PATCH v3 1/3] util/cutils: Move size_to_str() from "qemu-common.h" to "cutils.h" Philippe Mathieu-Daudé
2019-02-04 21:12 ` [Qemu-devel] [PATCH v3 2/3] util/cutils: Move ctype macros " Philippe Mathieu-Daudé
2019-02-05 10:32   ` Cornelia Huck [this message]
2019-02-05 10:49     ` Daniel P. Berrangé
2019-02-04 21:12 ` [Qemu-devel] [PATCH v3 3/3] util/cutils: Move function documentations to the header Philippe Mathieu-Daudé
2019-02-05  6:42   ` Markus Armbruster
2019-02-05 10:56     ` Peter Maydell
2019-02-05 11:04       ` Daniel P. Berrangé
2019-02-05 12:30         ` Markus Armbruster

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=20190205113219.0c1311e0.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=Alistair.Francis@wdc.com \
    --cc=armbru@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=fam@euphon.net \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=kraxel@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mjc@sifive.com \
    --cc=palmer@sifive.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=sagark@eecs.berkeley.edu \
    --cc=sgarzare@redhat.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).