qemu-ppc
[Top][All Lists]
Advanced

[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.

Attachment: pgpo1d5vY48wf.pgp
Description: OpenPGP digital signature


reply via email to

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