g_strcmp0 is convenient when comparing potentially NULL strings. Use this in gvir_config_xml_get_attribute_content instead of explicitly checking for NULL. --- libvirt-gconfig/libvirt-gconfig-helpers.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/libvirt-gconfig/libvirt-gconfig-helpers.c b/libvirt-gconfig/libvirt-gconfig-helpers.c index 3790cab..ba54590 100644 --- a/libvirt-gconfig/libvirt-gconfig-helpers.c +++ b/libvirt-gconfig/libvirt-gconfig-helpers.c @@ -249,13 +249,9 @@ gvir_config_xml_get_attribute_content(xmlNodePtr node, const char *attr_name) { xmlAttr *attr; - for (attr = node->properties; attr; attr = attr->next) { - if (attr->name == NULL) - continue; - - if (strcmp (attr_name, (char *)attr->name) == 0) + for (attr = node->properties; attr; attr = attr->next) + if (g_strcmp0 (attr_name, (char *)attr->name) == 0) return attr->children->content; - } return NULL; } -- 1.7.7.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list