Re: [PATCH 10/19] virJSONValueNewArray: Use g_new0 to allocate and remove NULL checks from callers

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

 



On Fri, Jan 31, 2020 at 03:31:14PM +0100, Peter Krempa wrote:
Use the glib allocation function that never returns NULL and remove the
now dead-code checks from all callers.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
src/locking/lock_daemon.c        |  4 ++--
src/logging/log_handler.c        |  3 +--
src/network/leaseshelper.c       |  6 +-----
src/qemu/qemu_agent.c            |  6 +-----
src/qemu/qemu_backup.c           |  6 ++----
src/qemu/qemu_block.c            |  9 +++------
src/qemu/qemu_blockjob.c         |  3 +--
src/qemu/qemu_checkpoint.c       |  9 +++------
src/qemu/qemu_driver.c           |  3 +--
src/qemu/qemu_firmware.c         | 12 ++++--------
src/qemu/qemu_migration_params.c |  3 +--
src/qemu/qemu_monitor_json.c     |  3 +--
src/rpc/virnetserver.c           |  6 ++----
src/rpc/virnetserverservice.c    |  3 +--
src/util/virjson.c               | 13 ++-----------
src/util/virlockspace.c          |  6 ++----
src/util/virmacmap.c             |  8 ++++----
tests/qemublocktest.c            |  3 +--
tests/qemumonitorjsontest.c      |  5 ++---
19 files changed, 35 insertions(+), 76 deletions(-)


diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 4374235d34..7d01d21a11 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -1201,9 +1201,6 @@ qemuAgentMakeStringsArray(const char **strings, unsigned int len)
    size_t i;
    virJSONValuePtr ret = virJSONValueNewArray(), str;

Beautiful.


-    if (!ret)
-        return NULL;
-
    for (i = 0; i < len; i++) {
        str = virJSONValueNewString(strings[i]);
        if (!str)

Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature


[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