mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
tests: esxutils: reduce variable scope in testEscapeDatastoreItem
Also use g_auto. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
4b4b44d82c
commit
ac1a9a5e8b
@ -161,23 +161,19 @@ static int
|
||||
testEscapeDatastoreItem(const void *data G_GNUC_UNUSED)
|
||||
{
|
||||
size_t i;
|
||||
char *escaped = NULL;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS(datastoreItems); ++i) {
|
||||
VIR_FREE(escaped);
|
||||
g_autofree char *escaped = NULL;
|
||||
|
||||
escaped = esxUtil_EscapeDatastoreItem(datastoreItems[i].string);
|
||||
|
||||
if (escaped == NULL)
|
||||
return -1;
|
||||
|
||||
if (STRNEQ(datastoreItems[i].escaped, escaped)) {
|
||||
VIR_FREE(escaped);
|
||||
if (STRNEQ(datastoreItems[i].escaped, escaped))
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
VIR_FREE(escaped);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user