]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ch_conf: Dissolve chExtractVersionInfo() in chExtractVersion()
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 4 Jun 2021 12:21:40 +0000 (14:21 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 4 Jun 2021 14:39:00 +0000 (16:39 +0200)
After previous patches, there's not much value in
chExtractVersion(). Rename chExtractVersionInfo() to
chExtractVersion() and have it use virCHDriver directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/ch/ch_conf.c

index 706e5f0ba4ae644a814f8305e4e4972b437abe17..dfebc8525a792b0adae49bcc8bb7affe9e92057d 100644 (file)
@@ -191,8 +191,8 @@ virCHDriverConfigDispose(void *obj)
 
 #define MIN_VERSION ((15 * 1000000) + (0 * 1000) + (0))
 
-static int
-chExtractVersionInfo(int *retversion)
+int
+chExtractVersion(virCHDriver *driver)
 {
     int ret = -1;
     unsigned long version;
@@ -201,8 +201,6 @@ chExtractVersionInfo(int *retversion)
     g_autofree char *ch_cmd = g_find_program_in_path(CH_CMD);
     virCommand *cmd = virCommandNewArgList(ch_cmd, "--version", NULL);
 
-    *retversion = 0;
-
     virCommandAddEnvString(cmd, "LC_ALL=C");
     virCommandSetOutputBuffer(cmd, &help);
 
@@ -230,22 +228,10 @@ chExtractVersionInfo(int *retversion)
         goto cleanup;
     }
 
-    *retversion = version;
+    driver->version = version;
     ret = 0;
 
  cleanup:
     virCommandFree(cmd);
-
     return ret;
 }
-
-int chExtractVersion(virCHDriver *driver)
-{
-    if (driver->version > 0)
-        return 0;
-
-    if (chExtractVersionInfo(&driver->version) < 0)
-        return -1;
-
-    return 0;
-}