On Fri, Apr 15, 2016 at 02:38:21PM +0100, Zeeshan Ali (Khattak) wrote: > 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. As said in 4/6, I prefer to have the "on"/"off" check in the getter rather than here. Christophe > > 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 > > -- > libvir-list mailing list > libvir-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/libvir-list
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list