]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virdnsmasq: Join dnsmasqCapsNewEmpty() and dnsmasqCapsNewFromBinary()
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 12 Jan 2022 04:58:39 +0000 (05:58 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 18 Jan 2022 15:18:57 +0000 (16:18 +0100)
After previous cleanups, there's just one caller of
dnsmasqCapsNewEmpty() and it is dnsmasqCapsNewFromBinary().
And the former is pretty short. Therefore, it is not necessary
for the code to live in two separate functions. Dissolve the
former in the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/util/virdnsmasq.c

index f5029d2fdc3a2600fe89bcb9845650f6c5ba6271..57b24c9f6a3e8f35f42850f21a740c7cec533586 100644 (file)
@@ -661,13 +661,14 @@ dnsmasqCapsRefreshInternal(dnsmasqCaps *caps)
     return dnsmasqCapsSetFromBuffer(caps, version);
 }
 
-static dnsmasqCaps *
-dnsmasqCapsNewEmpty(void)
+dnsmasqCaps *
+dnsmasqCapsNewFromBinary(void)
 {
     g_autoptr(dnsmasqCaps) caps = NULL;
 
     if (dnsmasqCapsInitialize() < 0)
         return NULL;
+
     if (!(caps = virObjectNew(dnsmasqCapsClass)))
         return NULL;
 
@@ -677,17 +678,6 @@ dnsmasqCapsNewEmpty(void)
         return NULL;
     }
 
-    return g_steal_pointer(&caps);
-}
-
-dnsmasqCaps *
-dnsmasqCapsNewFromBinary(void)
-{
-    g_autoptr(dnsmasqCaps) caps = dnsmasqCapsNewEmpty();
-
-    if (!caps)
-        return NULL;
-
     if (dnsmasqCapsRefreshInternal(caps) < 0)
         return NULL;