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

Re: [libvirt] [ocaml PATCH] Cast virError* enums to int for comparisons with 0

On Fri, 2018-11-02 at 15:52 +0100, Pino Toscano wrote:
> The actual type of an enum in C is implementation defined when there are
> no negative values, and thus it can be int, or uint.  This is the case
> of the virError* enums in libvirt, as they do not have negative values.
> Hence, to avoid hitting tautological comparison errors when checking
> their rage, temporarly cast the enum values to int when checking they
> are not negative.  The check is there to ensure the value is within the
> range of the OCaml type used to represent it.
> Signed-off-by: Pino Toscano <ptoscano redhat com>
> ---
>  libvirt/libvirt_c_epilogue.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Looks sane to me.

If that's enough for you, then you can have my

  Reviewed-by: Andrea Bolognani <abologna redhat com>

and push. I just really want


to turn green :)

Andrea Bolognani / Red Hat / Virtualization

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