[PATCH v2 1/9] include: error: Add enum sentinel for virErrorNumber enum

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

 



We do have one for the error domain but not for the error number itself.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux