From 590cc60de53be60ecab1b6b76936106bd0c6704e Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 12 Nov 2018 13:17:21 +0100 Subject: [PATCH] include: error: Add enum sentinel for virErrorNumber enum We do have one for the error domain but not for the error number itself. Signed-off-by: Peter Krempa Reviewed-by: Erik Skultety --- include/libvirt/virterror.h | 5 +++++ src/util/virerror.c | 1 + 2 files changed, 6 insertions(+) diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h index 44292c7021..f41afcd0a7 100644 --- a/include/libvirt/virterror.h +++ b/include/libvirt/virterror.h @@ -321,6 +321,11 @@ typedef enum { VIR_ERR_DEVICE_MISSING = 99, /* fail to find the desired device */ VIR_ERR_INVALID_NWFILTER_BINDING = 100, /* invalid nwfilter binding */ VIR_ERR_NO_NWFILTER_BINDING = 101, /* no nwfilter binding */ + +# ifdef VIR_ENUM_SENTINELS + VIR_ERR_NUMBER_LAST +# endif + } virErrorNumber; /** diff --git a/src/util/virerror.c b/src/util/virerror.c index 736c92fd02..88e6ecef82 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -914,6 +914,7 @@ virErrorMsg(virErrorNumber error, const char *info) const char *errmsg = NULL; switch (error) { + case VIR_ERR_NUMBER_LAST: case VIR_ERR_OK: return NULL; case VIR_ERR_INTERNAL_ERROR: