Acked-by: Christophe Fergeau <[email protected]> (and since "treeinfo-" is a compile-time constant, gcc should be able to replace this with 9 at compile-time).
On Sun, Dec 02, 2018 at 04:37:57PM +0100, Fabiano Fidêncio wrote:
> treeinfo attributes haven't been loaded properly due to the change done
> in ab2ab35f, changing the hardcoded 9 to sizeof("treeinfo-").
>
> The problem here is that size("treeinfo-") is 10, causing that any
> comparison to fail.
>
> Let's change the sizeof("treeinfo-") to strlen("treeinfo-").
>
> Signed-off-by: Fabiano Fidêncio <[email protected]>
> ---
> 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 030062b..b6b6bd2 100644
> --- a/osinfo/osinfo_loader.c
> +++ b/osinfo/osinfo_loader.c
> @@ -1222,22 +1222,22 @@ static OsinfoTree *osinfo_loader_tree(OsinfoLoader
> *loader,
> continue;
>
> if (g_str_equal((const gchar *)nodes[i]->name,
> - OSINFO_TREE_PROP_TREEINFO_FAMILY +
> sizeof("treeinfo-")))
> + OSINFO_TREE_PROP_TREEINFO_FAMILY +
> strlen("treeinfo-")))
> osinfo_entity_set_param(OSINFO_ENTITY(tree),
> OSINFO_TREE_PROP_TREEINFO_FAMILY,
> (const gchar
> *)nodes[i]->children->content);
> else if (g_str_equal((const gchar *)nodes[i]->name,
> - OSINFO_TREE_PROP_TREEINFO_VARIANT +
> sizeof("treeinfo-")))
> + OSINFO_TREE_PROP_TREEINFO_VARIANT +
> strlen("treeinfo-")))
> osinfo_entity_set_param(OSINFO_ENTITY(tree),
> OSINFO_TREE_PROP_TREEINFO_VARIANT,
> (const gchar
> *)nodes[i]->children->content);
> else if (g_str_equal((const gchar *)nodes[i]->name,
> - OSINFO_TREE_PROP_TREEINFO_VERSION +
> sizeof("treeinfo-")))
> + OSINFO_TREE_PROP_TREEINFO_VERSION +
> strlen("treeinfo-")))
> osinfo_entity_set_param(OSINFO_ENTITY(tree),
> OSINFO_TREE_PROP_TREEINFO_VERSION,
> (const gchar
> *)nodes[i]->children->content);
> else if (g_str_equal((const gchar *)nodes[i]->name,
> - OSINFO_TREE_PROP_TREEINFO_ARCH +
> sizeof("treeinfo-")))
> + OSINFO_TREE_PROP_TREEINFO_ARCH +
> strlen("treeinfo-")))
> osinfo_entity_set_param(OSINFO_ENTITY(tree),
> OSINFO_TREE_PROP_TREEINFO_ARCH,
> (const gchar
> *)nodes[i]->children->content);
> --
> 1.8.3.1
>
> _______________________________________________
> Libosinfo mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/libosinfo
signature.asc
Description: PGP signature
_______________________________________________ Libosinfo mailing list [email protected] https://www.redhat.com/mailman/listinfo/libosinfo
