1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

bhyveParsePCIFbuf: Use g_strsplit instead of virStringSplitCount

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-03-22 18:10:54 +01:00
parent d7e2bca9b7
commit ad80bba90a

View File

@ -558,10 +558,8 @@ bhyveParsePCIFbuf(virDomainDefPtr def,
virDomainVideoDefPtr video = NULL; virDomainVideoDefPtr video = NULL;
virDomainGraphicsDefPtr graphics = NULL; virDomainGraphicsDefPtr graphics = NULL;
char **params = NULL; g_auto(GStrv) **params = NULL;
char *param = NULL, *separator = NULL; GStrv next;
size_t nparams = 0;
size_t i = 0;
if (!(video = virDomainVideoDefNew(xmlopt))) if (!(video = virDomainVideoDefNew(xmlopt)))
goto cleanup; goto cleanup;
@ -579,11 +577,11 @@ bhyveParsePCIFbuf(virDomainDefPtr def,
if (!config) if (!config)
goto error; goto error;
if (!(params = virStringSplitCount(config, ",", 0, &nparams))) if (!(params = g_strsplit(config, ",", 0)))
goto error; goto error;
for (i = 0; i < nparams; i++) { for (next = params; *next; next++) {
param = params[i]; char *param = *next;
if (!video->driver) if (!video->driver)
video->driver = g_new0(virDomainVideoDriverDef, 1); video->driver = g_new0(virDomainVideoDriverDef, 1);
@ -649,13 +647,11 @@ bhyveParsePCIFbuf(virDomainDefPtr def,
if (VIR_APPEND_ELEMENT(def->graphics, def->ngraphics, graphics) < 0) if (VIR_APPEND_ELEMENT(def->graphics, def->ngraphics, graphics) < 0)
goto error; goto error;
g_strfreev(params);
return 0; return 0;
error: error:
virDomainVideoDefFree(video); virDomainVideoDefFree(video);
virDomainGraphicsDefFree(graphics); virDomainGraphicsDefFree(graphics);
g_strfreev(params);
return -1; return -1;
} }