mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
virJSONValueObjectDeflattenWorker: use g_strsplit instead of virStringSplitCount
The presence of the second element can be checked by looking at it directly. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
129590d511
commit
e49eb0aaa7
@ -1964,7 +1964,6 @@ virJSONValueObjectDeflattenWorker(const char *key,
|
||||
g_autoptr(virJSONValue) newval = NULL;
|
||||
virJSONValuePtr existobj;
|
||||
g_auto(GStrv) tokens = NULL;
|
||||
size_t ntokens = 0;
|
||||
|
||||
/* non-nested keys only need to be copied */
|
||||
if (!strchr(key, '.')) {
|
||||
@ -1989,10 +1988,10 @@ virJSONValueObjectDeflattenWorker(const char *key,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(tokens = virStringSplitCount(key, ".", 2, &ntokens)))
|
||||
if (!(tokens = g_strsplit(key, ".", 2)))
|
||||
return -1;
|
||||
|
||||
if (ntokens != 2) {
|
||||
if (!tokens[0] || !tokens[1]) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("invalid nested value key '%s'"), key);
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user