mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
storage: zfs: Use g_strsplit instead of virStringSplitCount
Both instances just check the length once. Replicate that faithfully. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
01f7251457
commit
d9da007525
@ -96,7 +96,6 @@ virStorageBackendZFSParseVol(virStoragePoolObjPtr pool,
|
|||||||
const char *volume_string)
|
const char *volume_string)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
size_t count;
|
|
||||||
char *vol_name;
|
char *vol_name;
|
||||||
bool is_new_vol = false;
|
bool is_new_vol = false;
|
||||||
virStorageVolDefPtr volume = NULL;
|
virStorageVolDefPtr volume = NULL;
|
||||||
@ -104,10 +103,10 @@ virStorageBackendZFSParseVol(virStoragePoolObjPtr pool,
|
|||||||
g_auto(GStrv) tokens = NULL;
|
g_auto(GStrv) tokens = NULL;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
if (!(tokens = virStringSplitCount(volume_string, "\t", 0, &count)))
|
if (!(tokens = g_strsplit(volume_string, "\t", 0)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (count != 3)
|
if (g_strv_length(tokens) != 3)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
vol_name = tokens[0];
|
vol_name = tokens[0];
|
||||||
@ -246,16 +245,15 @@ virStorageBackendZFSRefreshPool(virStoragePoolObjPtr pool G_GNUC_UNUSED)
|
|||||||
|
|
||||||
for (i = 0; lines[i]; i++) {
|
for (i = 0; lines[i]; i++) {
|
||||||
g_auto(GStrv) tokens = NULL;
|
g_auto(GStrv) tokens = NULL;
|
||||||
size_t count;
|
|
||||||
char *prop_name;
|
char *prop_name;
|
||||||
|
|
||||||
if (STREQ(lines[i], ""))
|
if (STREQ(lines[i], ""))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(tokens = virStringSplitCount(lines[i], "\t", 0, &count)))
|
if (!(tokens = g_strsplit(lines[i], "\t", 0)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (count != 4)
|
if (g_strv_length(tokens) != 4)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
prop_name = tokens[1];
|
prop_name = tokens[1];
|
||||||
|
Loading…
Reference in New Issue
Block a user