]> git.ipfire.org Git - thirdparty/libvirt.git/commit
lib: Don't check for retval for virCommandNew*()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 23 Aug 2022 12:35:47 +0000 (14:35 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 23 Aug 2022 14:14:05 +0000 (16:14 +0200)
commitda255ce831c0b352ece7a59de6873e8fb25af8d0
tree39ca51970d6821ca1438da45a014f604219e3a96
parent21ad635fc3535acc884356b3c80403f58730f65b
lib: Don't check for retval for virCommandNew*()

The virCommand module is specifically designed so that no caller
has to check for retval of individual virCommand*() APIs except
for virCommandRun() where the actual error is reported. Moreover,
virCommandNew*() use g_new0() to allocate memory and thus it's
not really possible for those APIs to return NULL. Which is why
they are even marked as ATTRIBUTE_NONNULL. But there are few
places where we do check the retval which is a dead code
effectively. Drop those checks.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
src/qemu/qemu_slirp.c
src/qemu/qemu_tpm.c
src/qemu/qemu_vhost_user_gpu.c
src/qemu/qemu_virtiofs.c
src/util/virtpm.c
tests/virshtest.c