[virt-tools-list] [libosinfo] loader: Don't harcode '+ 9' in tree loading
Christophe Fergeau
cfergeau at redhat.com
Tue Dec 11 13:12:38 UTC 2012
When loading <tree> elements, we want to skip the 'treeinfo-' part
of entity property names. This is currently done by using a '+ 9',
using sizeof("treeinfo-") instead will make things more obvious.
---
osinfo/osinfo_loader.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index c79304f..25385a0 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -905,22 +905,22 @@ static OsinfoTree *osinfo_loader_tree (OsinfoLoader *loader,
continue;
if (strcmp((const gchar *)nodes[i]->name,
- OSINFO_TREE_PROP_TREEINFO_FAMILY + 9) == 0)
+ OSINFO_TREE_PROP_TREEINFO_FAMILY + sizeof("treeinfo-")) == 0)
osinfo_entity_set_param(OSINFO_ENTITY(tree),
OSINFO_TREE_PROP_TREEINFO_FAMILY,
(const gchar *)nodes[i]->children->content);
else if (strcmp((const gchar *)nodes[i]->name,
- OSINFO_TREE_PROP_TREEINFO_VARIANT + 9) == 0)
+ OSINFO_TREE_PROP_TREEINFO_VARIANT + sizeof("treeinfo-")) == 0)
osinfo_entity_set_param(OSINFO_ENTITY(tree),
OSINFO_TREE_PROP_TREEINFO_VARIANT,
(const gchar *)nodes[i]->children->content);
else if (strcmp((const gchar *)nodes[i]->name,
- OSINFO_TREE_PROP_TREEINFO_VERSION + 9) == 0)
+ OSINFO_TREE_PROP_TREEINFO_VERSION + sizeof("treeinfo-")) == 0)
osinfo_entity_set_param(OSINFO_ENTITY(tree),
OSINFO_TREE_PROP_TREEINFO_VERSION,
(const gchar *)nodes[i]->children->content);
else if (strcmp((const gchar *)nodes[i]->name,
- OSINFO_TREE_PROP_TREEINFO_ARCH + 9) == 0)
+ OSINFO_TREE_PROP_TREEINFO_ARCH + sizeof("treeinfo-")) == 0)
osinfo_entity_set_param(OSINFO_ENTITY(tree),
OSINFO_TREE_PROP_TREEINFO_ARCH,
(const gchar *)nodes[i]->children->content);
--
1.8.0.1
More information about the virt-tools-list
mailing list