gvir_config_object_get_attribute_boolean() currently only accepts yes/no
as boolean attribute values. Let's also accept on/off as valid values
too.
This will come handy in a following patch that adds 'hostdev' handling
API.
---
libvirt-gconfig/libvirt-gconfig-object.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c
b/libvirt-gconfig/libvirt-gconfig-object.c
index 6225de2..f44cc4c 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -690,9 +690,9 @@ gvir_config_object_get_attribute_boolean(GVirConfigObject *object,
const char *str;
str = gvir_config_object_get_attribute(object, node_name, attr_name);
- if (g_strcmp0(str, "yes") == 0) {
+ if (g_strcmp0(str, "yes") == 0 || g_strcmp0(str, "on") == 0) {
return TRUE;
- } else if (g_strcmp0(str, "no") == 0) {
+ } else if (g_strcmp0(str, "no") == 0 || g_strcmp0(str, "off") ==
0) {
return FALSE;
} else {
return default_value;
--
2.5.5