[libvirt] [ocaml PATCH] Cast virError* enums to int for comparisons with 0
Andrea Bolognani
abologna at redhat.com
Wed Nov 14 16:12:31 UTC 2018
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 at 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 at redhat.com>
and push. I just really want
https://ci.centos.org/view/libvirt/job/libvirt-ocaml-build/
to turn green :)
--
Andrea Bolognani / Red Hat / Virtualization
More information about the libvir-list
mailing list