mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
storage: Use VIR_DELETE_ELEMENT instead of open coding
Replace the open coded array element deletion by our new helper.
This commit is contained in:
parent
94a26c7e88
commit
cad3cf9a95
@ -1565,17 +1565,8 @@ storageVolDelete(virStorageVolPtr obj,
|
|||||||
VIR_INFO("Deleting volume '%s' from storage pool '%s'",
|
VIR_INFO("Deleting volume '%s' from storage pool '%s'",
|
||||||
vol->name, pool->def->name);
|
vol->name, pool->def->name);
|
||||||
virStorageVolDefFree(vol);
|
virStorageVolDefFree(vol);
|
||||||
vol = NULL;
|
|
||||||
|
|
||||||
if (i < (pool->volumes.count - 1))
|
|
||||||
memmove(pool->volumes.objs + i, pool->volumes.objs + i + 1,
|
|
||||||
sizeof(*(pool->volumes.objs)) * (pool->volumes.count - (i + 1)));
|
|
||||||
|
|
||||||
if (VIR_REALLOC_N(pool->volumes.objs, pool->volumes.count - 1) < 0) {
|
|
||||||
; /* Failure to reduce memory allocation isn't fatal */
|
|
||||||
}
|
|
||||||
pool->volumes.count--;
|
|
||||||
|
|
||||||
|
VIR_DELETE_ELEMENT(pool->volumes.objs, pool->volumes.count, i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user