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(a)redhat.com>
---
src/ch/ch_conf.c | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c
index 706e5f0ba4..dfebc8525a 100644
--- a/src/ch/ch_conf.c
+++ b/src/ch/ch_conf.c
@@ -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;
-}
--
2.31.1