On Sat, May 05, 2018 at 01:04:21PM +0100, ramyelkest wrote:
Replaced instances where we called virGetLastError just to
either get the code or to check if an error exists with
virGetLastErrorCode to avoid a validity pre-check.
Signed-off-by: Ramy Elkest <ramyelkest(a)gmail.com>
---
src/locking/lock_driver_lockd.c | 3 +--
src/lxc/lxc_controller.c | 4 +---
src/qemu/qemu_agent.c | 3 +--
src/qemu/qemu_conf.c | 3 +--
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 12 ++++++------
src/qemu/qemu_hotplug.c | 2 +-
src/qemu/qemu_migration.c | 4 ++--
src/qemu/qemu_monitor.c | 5 ++---
src/qemu/qemu_monitor_json.c | 2 +-
src/qemu/qemu_process.c | 4 ++--
src/remote/remote_driver.c | 3 +--
src/rpc/virnetclient.c | 2 +-
src/rpc/virnetlibsshsession.c | 4 +---
src/util/virmodule.c | 3 +--
src/util/virxml.c | 4 ++--
tests/commandtest.c | 2 +-
tests/testutils.c | 6 ++----
tests/virhostcputest.c | 2 +-
tests/virstoragetest.c | 8 ++++----
tools/virsh-domain-monitor.c | 7 +++----
tools/virsh-domain.c | 4 +---
tools/virsh-util.c | 3 +--
tools/vsh.c | 2 +-
24 files changed, 39 insertions(+), 55 deletions(-)
...
- err = virGetLastError();
- if (!err || err->code == VIR_ERR_OK)
+ if (!virGetLastErrorCode())
rc = wantReboot ? 1 : 0;
Again, just a tiny detail, the convention we use in libvirt with unary '!' is
that we only use it with pointers, but explicitly compare against an int
otherwise, so ^this would become == VIR_ERR_OK (yes, we don't mention this in
our hacking guidelines...). So hopefully I didn't miss anything in the
attached diff which I'd squash in before pushing, feel free to check again.
The replacement itself is fine, so
Reviewed-by: Erik Skultety <eskultet(a)redhat.com>