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

[libvirt] [PATCH 01/10] 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 <pkrempa redhat com>
---
 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 57aadb8d16..9867c05450 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -323,6 +323,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 683e51aa19..eca6ddf7d1 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -916,6 +916,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:
-- 
2.19.2


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