On Fri, 4 Jan 2019 14:15:49 -0600
Eric Blake <ebl...@redhat.com> 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 <sgarz...@redhat.com>
> > Signed-off-by: Philippe Mathieu-Daudé <phi...@redhat.com>
> > ---  
> 
> > +++ 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: pgp3NiTL_EVr8.pgp
Description: OpenPGP digital signature

Reply via email to