]> xenbits.xensource.com Git - libvirt.git/commit
virdbus: don't force users to pass int for bool values
authorEric Blake <eblake@redhat.com>
Tue, 18 Nov 2014 00:18:58 +0000 (17:18 -0700)
committerEric Blake <eblake@redhat.com>
Wed, 19 Nov 2014 15:20:39 +0000 (08:20 -0700)
commit2aa167cafd507730890c54dc577fff0968ee7386
treebdc767a93513eed6257523f07d8c57d3d299de27
parentbac66a6066631b60a8f3ebcc37be515980419d0d
virdbus: don't force users to pass int for bool values

Use of an 'int' to represent a 'bool' value is confusing.  Just
because dbus made the mistake of cementing their 4-byte wire
format of dbus_bool_t into their API doesn't mean we have to
repeat the mistake.  With a little bit of finesse, we can
guarantee that we provide a large-enough value to the DBus
code, while still copying only the relevant one-byte bool
to the client code, and isolate the rest of our code base from
the DBus stupidity.

* src/util/virdbus.c (GET_NEXT_VAL): Add parameter.
(virDBusMessageIterDecode): Adjust all clients.
* src/util/virpolkit.c (virPolkitCheckAuth): Use nicer type.
* tests/virdbustest.c (testMessageSimple, testMessageStruct):
Test new behavior.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/util/virdbus.c
src/util/virpolkit.c
tests/virdbustest.c