[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH v2 2/3] util/cutils: Move ctype macro
From: |
Cornelia Huck |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH v2 2/3] util/cutils: Move ctype macros to "cutils.h" |
Date: |
Tue, 8 Jan 2019 13:56:49 +0100 |
On Fri, 4 Jan 2019 14:15:49 -0600
Eric Blake <address@hidden> wrote:
> On 1/4/19 12:12 PM, Philippe Mathieu-Daudé wrote:
> > Introduced in cd390083ad1, these macros don't need to be in
> > a generic header.
> > Add documentation to justify their use.
> >
> > Reviewed-by: Stefano Garzarella <address@hidden>
> > Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> > ---
>
> > +++ 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 would also mention that these macros are ONLY intended for use with
> char arguments (as they CANNOT handle EOF); if you are doing int c =
> getchar() or similar, you still want to call the original ctype macro.
>
> Otherwise, the move and added comments makes sense to me.
>
Agreed on both counts.
pgpo1d5vY48wf.pgp
Description: OpenPGP digital signature
- [Qemu-ppc] [PATCH v2 0/3] cutils: Cleanup, improve documentation, Philippe Mathieu-Daudé, 2019/01/04
- [Qemu-ppc] [PATCH v2 1/3] util/cutils: Move size_to_str() from "qemu-common.h" to "cutils.h", Philippe Mathieu-Daudé, 2019/01/04
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v2 1/3] util/cutils: Move size_to_str() from "qemu-common.h" to "cutils.h", Eric Blake, 2019/01/04
- Re: [Qemu-ppc] [PATCH v2 1/3] util/cutils: Move size_to_str() from "qemu-common.h" to "cutils.h", David Gibson, 2019/01/06
- Re: [Qemu-ppc] [PATCH v2 1/3] util/cutils: Move size_to_str() from "qemu-common.h" to "cutils.h", Stefano Garzarella, 2019/01/07
- Re: [Qemu-ppc] [PATCH v2 1/3] util/cutils: Move size_to_str() from "qemu-common.h" to "cutils.h", Cornelia Huck, 2019/01/08
- Re: [Qemu-ppc] [Qemu-trivial] [PATCH v2 1/3] util/cutils: Move size_to_str() from "qemu-common.h" to "cutils.h", Laurent Vivier, 2019/01/30
- [Qemu-ppc] [PATCH v2 2/3] util/cutils: Move ctype macros to "cutils.h", Philippe Mathieu-Daudé, 2019/01/04
- [Qemu-ppc] [PATCH v2 3/3] util/cutils: Move function documentations to the header, Philippe Mathieu-Daudé, 2019/01/04