[libosinfo] loader: Don't harcode '+ 9' in tree loading

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

 



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

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list


[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux