mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Replace virStringListLength by g_strv_length
The glib implementation doesn't tolerate NULL but in most cases we check before anyways. The rest of the callers adds a NULL check. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
@@ -394,7 +394,7 @@ static int testConfParseStringList(const void *opaque G_GNUC_UNUSED)
|
||||
if (virConfGetValueStringList(conf, "string_list", false, &str) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virStringListLength((const char *const*)str) != 2) {
|
||||
if (!str || g_strv_length(str) != 2) {
|
||||
fprintf(stderr, "expected a 2 element list\n");
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -418,7 +418,7 @@ static int testConfParseStringList(const void *opaque G_GNUC_UNUSED)
|
||||
if (virConfGetValueStringList(conf, "string", true, &str) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virStringListLength((const char *const*)str) != 1) {
|
||||
if (!str || g_strv_length(str) != 1) {
|
||||
fprintf(stderr, "expected a 1 element list\n");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -243,10 +243,10 @@ testStringSearch(const void *opaque)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virStringListLength((const char * const *)matches) != nmatches) {
|
||||
fprintf(stderr, "expected %zu matches on %s but got %zd matches\n",
|
||||
if (g_strv_length(matches) != nmatches) {
|
||||
fprintf(stderr, "expected %zu matches on %s but got %u matches\n",
|
||||
data->expectNMatches, data->str,
|
||||
virStringListLength((const char * const *)matches));
|
||||
g_strv_length(matches));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user