Re: [PATCH] virjson: Change virJSONValueObjectHasKey() signature

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

 



On Thu, Jul 28, 2022 at 15:33:33 +0200, Michal Privoznik wrote:
> Currently, virJSONValueObjectHasKey() can return one of three
> values:
> 
>   -1 if passed object type is not VIR_JSON_TYPE_OBJECT,
>    0 if the key is not present, and finally
>    1 if the key is present.
> 
> But, neither of callers is interested in the -1 case. In fact,
> some callers call this function treating -1 and 1 cases the same.
> Therefore, make the function return just true/false and fix few
> callers that explicitly checked for == 1 case.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/qemu/qemu_agent.c        |  8 ++++----
>  src/qemu/qemu_monitor_json.c | 10 +++++-----
>  src/util/virjson.c           |  8 ++++----
>  src/util/virjson.h           |  2 +-
>  4 files changed, 14 insertions(+), 14 deletions(-)

You forgot to fix one instance in testQEMUSchemaValidateObjectMandatoryMember
which uses '!= 1' instead of '== 1'.

With that fixed:

Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux