]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: agent: use virHashNew
authorJán Tomko <jtomko@redhat.com>
Mon, 5 Oct 2020 19:34:52 +0000 (21:34 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 8 Oct 2020 09:16:08 +0000 (11:16 +0200)
We're passing 'ifaces_count' to virHashCreate as the initial
hash table size just after we've initialized it to zero.
This translates to a default of 256 inside virHashCreateFull.

Instead of this obfuscation, use virHashNew (default of 32),
to make it obvious we don't care about the initial hash size.

Also remove the error handling, since neither of the functions
return any errors after switching to g_new0.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
src/qemu/qemu_agent.c

index b11f8afde7db7d8b33e95851610718c4e50bc657..a09fb4da2ab45c9c07805a6ac599fd1c1a184c47 100644 (file)
@@ -2129,10 +2129,7 @@ qemuAgentGetInterfaces(qemuAgentPtr agent,
     virHashTablePtr ifaces_store = NULL;
 
     /* Hash table to handle the interface alias */
-    if (!(ifaces_store = virHashCreate(ifaces_count, NULL))) {
-        virHashFree(ifaces_store);
-        return -1;
-    }
+    ifaces_store = virHashNew(NULL);
 
     if (!(cmd = qemuAgentMakeCommand("guest-network-get-interfaces", NULL)))
         goto cleanup;