mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 23:25:24 +00:00
util: Rename variable in virStorageSourceNewFromBackingRelative
To prepare for subsequent change to use VIR_AUTOPTR logic rename the @ret to @def. Signed-off-by: John Ferlan <jferlan@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
f035e2cd26
commit
a2cdee57d2
@ -2590,14 +2590,14 @@ static virStorageSourcePtr
|
|||||||
virStorageSourceNewFromBackingRelative(virStorageSourcePtr parent,
|
virStorageSourceNewFromBackingRelative(virStorageSourcePtr parent,
|
||||||
const char *rel)
|
const char *rel)
|
||||||
{
|
{
|
||||||
virStorageSourcePtr ret;
|
virStorageSourcePtr def;
|
||||||
VIR_AUTOFREE(char *) dirname = NULL;
|
VIR_AUTOFREE(char *) dirname = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(ret) < 0)
|
if (VIR_ALLOC(def) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* store relative name */
|
/* store relative name */
|
||||||
if (VIR_STRDUP(ret->relPath, parent->backingStoreRaw) < 0)
|
if (VIR_STRDUP(def->relPath, parent->backingStoreRaw) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!(dirname = mdir_name(parent->path))) {
|
if (!(dirname = mdir_name(parent->path))) {
|
||||||
@ -2606,39 +2606,39 @@ virStorageSourceNewFromBackingRelative(virStorageSourcePtr parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (STRNEQ(dirname, "/")) {
|
if (STRNEQ(dirname, "/")) {
|
||||||
if (virAsprintf(&ret->path, "%s/%s", dirname, rel) < 0)
|
if (virAsprintf(&def->path, "%s/%s", dirname, rel) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
if (virAsprintf(&ret->path, "/%s", rel) < 0)
|
if (virAsprintf(&def->path, "/%s", rel) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virStorageSourceGetActualType(parent) == VIR_STORAGE_TYPE_NETWORK) {
|
if (virStorageSourceGetActualType(parent) == VIR_STORAGE_TYPE_NETWORK) {
|
||||||
ret->type = VIR_STORAGE_TYPE_NETWORK;
|
def->type = VIR_STORAGE_TYPE_NETWORK;
|
||||||
|
|
||||||
/* copy the host network part */
|
/* copy the host network part */
|
||||||
ret->protocol = parent->protocol;
|
def->protocol = parent->protocol;
|
||||||
if (parent->nhosts) {
|
if (parent->nhosts) {
|
||||||
if (!(ret->hosts = virStorageNetHostDefCopy(parent->nhosts,
|
if (!(def->hosts = virStorageNetHostDefCopy(parent->nhosts,
|
||||||
parent->hosts)))
|
parent->hosts)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
ret->nhosts = parent->nhosts;
|
def->nhosts = parent->nhosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_STRDUP(ret->volume, parent->volume) < 0)
|
if (VIR_STRDUP(def->volume, parent->volume) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
/* set the type to _FILE, the caller shall update it to the actual type */
|
/* set the type to _FILE, the caller shall update it to the actual type */
|
||||||
ret->type = VIR_STORAGE_TYPE_FILE;
|
def->type = VIR_STORAGE_TYPE_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
return ret;
|
return def;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
virStorageSourceFree(ret);
|
virStorageSourceFree(def);
|
||||||
ret = NULL;
|
def = NULL;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user