提交 20f0cd4c 编写于 作者: J Ján Tomko

Introduce virStoragePoolSourceDeviceClear

Open-coding one VIR_FREE in the test suite just doesn't seem right.
上级 cc8bc54b
......@@ -356,6 +356,13 @@ virStoragePoolSourceAdapterClear(virStoragePoolSourceAdapter adapter)
}
}
void
virStoragePoolSourceDeviceClear(virStoragePoolSourceDevicePtr dev)
{
VIR_FREE(dev->freeExtents);
VIR_FREE(dev->path);
}
void
virStoragePoolSourceClear(virStoragePoolSourcePtr source)
{
......@@ -369,10 +376,8 @@ virStoragePoolSourceClear(virStoragePoolSourcePtr source)
}
VIR_FREE(source->hosts);
for (i = 0; i < source->ndevice; i++) {
VIR_FREE(source->devices[i].freeExtents);
VIR_FREE(source->devices[i].path);
}
for (i = 0; i < source->ndevice; i++)
virStoragePoolSourceDeviceClear(&source->devices[i]);
VIR_FREE(source->devices);
VIR_FREE(source->dir);
VIR_FREE(source->name);
......
......@@ -432,6 +432,7 @@ int virStoragePoolObjDeleteDef(virStoragePoolObjPtr pool);
void virStorageVolDefFree(virStorageVolDefPtr def);
void virStoragePoolSourceClear(virStoragePoolSourcePtr source);
void virStoragePoolSourceDeviceClear(virStoragePoolSourceDevicePtr dev);
void virStoragePoolSourceFree(virStoragePoolSourcePtr source);
void virStoragePoolDefFree(virStoragePoolDefPtr def);
void virStoragePoolObjFree(virStoragePoolObjPtr pool);
......
......@@ -710,6 +710,7 @@ virStoragePoolObjUnlock;
virStoragePoolSourceAdapterTypeTypeFromString;
virStoragePoolSourceAdapterTypeTypeToString;
virStoragePoolSourceClear;
virStoragePoolSourceDeviceClear;
virStoragePoolSourceFindDuplicate;
virStoragePoolSourceFindDuplicateDevices;
virStoragePoolSourceFree;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册