]> xenbits.xensource.com Git - libvirt.git/commit
util: Clean up consumers of virJSONValueArraySize
authorJohn Ferlan <jferlan@redhat.com>
Thu, 19 Apr 2018 21:29:02 +0000 (17:29 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 10 May 2018 18:59:15 +0000 (14:59 -0400)
commit4a3d6ed5ee07d2cbfb6577f3870ef1d947177b67
treef5747b1fd2efc8e9f7227af8c60ac772b3641606
parent91234b05736d14d800b4e611a1f7cf3209c5be92
util: Clean up consumers of virJSONValueArraySize

Rather than have virJSONValueArraySize return a -1 when the input
is not an array and then splat an error message, let's check for
an array before calling and then change the return to be a size_t
instead of ssize_t.

That means using the helper virJSONValueIsArray as well as using a
more generic error message such as "Malformed <something> array".
In some cases we can remove stack variables and when we cannot,
those variables should be size_t not ssize_t. Alter a few references
of if (!value) to be if (value == 0) instead as well.

Some callers can already assume an array is being worked on based
on the previous call, so there's less to do.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
14 files changed:
src/locking/lock_daemon.c
src/logging/log_handler.c
src/network/bridge_driver.c
src/qemu/qemu_agent.c
src/qemu/qemu_monitor_json.c
src/rpc/virnetdaemon.c
src/rpc/virnetserver.c
src/rpc/virnetserverservice.c
src/util/virjson.c
src/util/virjson.h
src/util/virlockspace.c
src/util/virstoragefile.c
tests/testutilsqemuschema.c
tools/nss/libvirt_nss.c