The glib variant doesn't accept NULL list, but there's just one caller
where it wasn't checked explicitly, thus there's no need for our own
wrapper.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/lxc/lxc_native.c | 4 ++--
src/qemu/qemu_capabilities.c | 8 ++++----
src/qemu/qemu_process.c | 4 ++--
tests/qemumonitorjsontest.c | 6 +++---
tools/virsh-completer.c | 3 ++-
5 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index 58b9db8f08..e68977dd99 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -304,7 +304,7 @@ lxcAddFstabLine(virDomainDefPtr def, lxcFstabPtr fstab)
type = VIR_DOMAIN_FS_TYPE_BLOCK;
/* Do we have ro in options? */
- readonly = virStringListHasString((const char **)options, "ro");
+ readonly = g_strv_contains((const char **)options, "ro");
if (lxcAddFSDef(def, type, src, dst, readonly, usage) < 0)
goto cleanup;
@@ -1108,7 +1108,7 @@ lxcSetCapDrop(virDomainDefPtr def, virConfPtr properties)
for (i = 0; i < VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST; i++) {
capString = virDomainProcessCapsFeatureTypeToString(i);
if (toDrop != NULL &&
- virStringListHasString((const char **)toDrop, capString))
+ g_strv_contains((const char **)toDrop, capString))
def->caps_features[i] = VIR_TRISTATE_SWITCH_OFF;
}
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index d41b4a4753..8f60ddeb7d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2185,10 +2185,10 @@ virQEMUCapsCPUDefsToModels(qemuMonitorCPUDefsPtr defs,
for (i = 0; i < defs->ncpus; i++) {
qemuMonitorCPUDefInfoPtr cpu = defs->cpus + i;
- if (modelAllowed && !virStringListHasString(modelAllowed, cpu->name))
+ if (modelAllowed && !g_strv_contains(modelAllowed, cpu->name))
continue;
- if (modelForbidden && virStringListHasString(modelForbidden,
cpu->name))
+ if (modelForbidden && g_strv_contains(modelForbidden, cpu->name))
continue;
if (virDomainCapsCPUModelsAdd(cpuModels, cpu->name, cpu->usable,
@@ -3193,7 +3193,7 @@ virQEMUCapsProbeQMPTPM(virQEMUCapsPtr qemuCaps,
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsTPMModelsToCaps); i++) {
const char *needle = virDomainTPMModelTypeToString(
virQEMUCapsTPMModelsToCaps[i].type);
- if (virStringListHasString((const char **)entries, needle))
+ if (g_strv_contains((const char **)entries, needle))
virQEMUCapsSet(qemuCaps,
virQEMUCapsTPMModelsToCaps[i].caps);
}
@@ -3207,7 +3207,7 @@ virQEMUCapsProbeQMPTPM(virQEMUCapsPtr qemuCaps,
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsTPMTypesToCaps); i++) {
const char *needle = virDomainTPMBackendTypeToString(
virQEMUCapsTPMTypesToCaps[i].type);
- if (virStringListHasString((const char **)entries, needle))
+ if (g_strv_contains((const char **)entries, needle))
virQEMUCapsSet(qemuCaps, virQEMUCapsTPMTypesToCaps[i].caps);
}
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 1fd3230e97..d24ef789ab 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3808,7 +3808,7 @@ qemuProcessUpdateDevices(virQEMUDriverPtr driver,
return 0;
for (tmp = old; *tmp; tmp++) {
- if (!virStringListHasString((const char **) priv->qemuDevices, *tmp)
&&
+ if (!g_strv_contains((const char **) priv->qemuDevices, *tmp) &&
virDomainDefFindDevice(vm->def, *tmp, &dev, false) == 0 &&
qemuDomainRemoveDevice(driver, vm, &dev))
return -1;
@@ -6098,7 +6098,7 @@ qemuProcessDropUnknownCPUFeatures(const char *name,
policy != VIR_CPU_FEATURE_FORBID)
return true;
- if (virStringListHasString(features, name))
+ if (g_strv_contains(features, name))
return true;
/* Features unknown to QEMU are implicitly disabled, we can just drop them
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 956423f10f..5a5976dbe4 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1057,13 +1057,13 @@ testQemuMonitorJSONGetDeviceAliases(const void *opaque)
ret = 0;
for (alias = (const char **) aliases; *alias; alias++) {
- if (!virStringListHasString(expected, *alias)) {
+ if (!g_strv_contains(expected, *alias)) {
fprintf(stderr, "got unexpected device alias '%s'\n",
*alias);
ret = -1;
}
}
for (alias = expected; *alias; alias++) {
- if (!virStringListHasString((const char **) aliases, *alias)) {
+ if (!g_strv_contains((const char **) aliases, *alias)) {
fprintf(stderr, "missing expected alias '%s'\n", *alias);
ret = -1;
}
@@ -2079,7 +2079,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCapabilities(const
void *opaque)
return -1;
cap = qemuMigrationCapabilityTypeToString(QEMU_MIGRATION_CAP_XBZRLE);
- if (!virStringListHasString((const char **) caps, cap)) {
+ if (!g_strv_contains((const char **) caps, cap)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Expected capability %s is missing", cap);
return -1;
diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
index c7aed7c779..fb42358bd0 100644
--- a/tools/virsh-completer.c
+++ b/tools/virsh-completer.c
@@ -114,7 +114,8 @@ virshCommaStringListComplete(const char *input,
ret = g_new0(char *, optionsLen + 1);
for (i = 0; i < optionsLen; i++) {
- if (virStringListHasString((const char **)inputList, options[i]))
+ if (inputList &&
+ g_strv_contains((const char **)inputList, options[i]))
continue;
if (inputCopy)
--
2.29.2