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

Re: [virt-tools-list] [PATCH 2/2] entity: Fix osinfo_entity_get_param_value_int64_with_default



On Thu, Nov 22, 2012 at 4:32 PM, Christophe Fergeau <cfergeau redhat com> wrote:
> The way it's currently implemented,
> osinfo_entity_get_param_value_int64_with_default will return the
> default value if the value which is being parsed is negative.
> This happens because it tries to reuse osinfo_entity_get_param_value_int64
> to do the parsing, which returns -1 when the value could not be found.
> However, we have no way of knowing if the -1 means that the value could
> not be found, or if this means the value was found and its value is -1.
> This is made worse by the fact that we return the default value as
> soon as osinfo_entity_get_param_value_int64 returns a negative value,
> not just -1.
>
> By implementing osinfo_entity_get_param_value_int64 by calling
> osinfo_entity_get_param_value_int64_with_default rather than doing the
> contrary, we can avoid this issue.

ACK

-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124


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