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. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature