qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [Qemu-devel] [PATCH v2 2/3] util/cutils: Move ctype m


From: Eric Blake
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH v2 2/3] util/cutils: Move ctype macros to "cutils.h"
Date: Fri, 4 Jan 2019 14:15:49 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1

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.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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