mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
misc: Drop useless checks from *Dispose() functions
Due to the way that our virObjectUnref() is written it's not possible that a NULL is passed into *Dispose() function. However, some functions check for that regardless. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
69a8c64f4b
commit
ce0037442f
@ -2602,9 +2602,6 @@ virDomainChrSourceDefDispose(void *obj)
|
|||||||
virDomainChrSourceDefPtr def = obj;
|
virDomainChrSourceDefPtr def = obj;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (!def)
|
|
||||||
return;
|
|
||||||
|
|
||||||
virDomainChrSourceDefClear(def);
|
virDomainChrSourceDefClear(def);
|
||||||
virObjectUnref(def->privateData);
|
virObjectUnref(def->privateData);
|
||||||
|
|
||||||
|
@ -156,9 +156,6 @@ virStorageVolObjDispose(void *opaque)
|
|||||||
{
|
{
|
||||||
virStorageVolObjPtr obj = opaque;
|
virStorageVolObjPtr obj = opaque;
|
||||||
|
|
||||||
if (!obj)
|
|
||||||
return;
|
|
||||||
|
|
||||||
virStorageVolDefFree(obj->voldef);
|
virStorageVolDefFree(obj->voldef);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,9 +187,6 @@ virStorageVolObjListDispose(void *opaque)
|
|||||||
{
|
{
|
||||||
virStorageVolObjListPtr vols = opaque;
|
virStorageVolObjListPtr vols = opaque;
|
||||||
|
|
||||||
if (!vols)
|
|
||||||
return;
|
|
||||||
|
|
||||||
virHashFree(vols->objsKey);
|
virHashFree(vols->objsKey);
|
||||||
virHashFree(vols->objsName);
|
virHashFree(vols->objsName);
|
||||||
virHashFree(vols->objsPath);
|
virHashFree(vols->objsPath);
|
||||||
@ -362,9 +356,6 @@ virStoragePoolObjDispose(void *opaque)
|
|||||||
{
|
{
|
||||||
virStoragePoolObjPtr obj = opaque;
|
virStoragePoolObjPtr obj = opaque;
|
||||||
|
|
||||||
if (!obj)
|
|
||||||
return;
|
|
||||||
|
|
||||||
virStoragePoolObjClearVols(obj);
|
virStoragePoolObjClearVols(obj);
|
||||||
virObjectUnref(obj->volumes);
|
virObjectUnref(obj->volumes);
|
||||||
|
|
||||||
|
@ -135,9 +135,6 @@ virNetSSHSessionDispose(void *obj)
|
|||||||
virNetSSHSessionPtr sess = obj;
|
virNetSSHSessionPtr sess = obj;
|
||||||
VIR_DEBUG("sess=0x%p", sess);
|
VIR_DEBUG("sess=0x%p", sess);
|
||||||
|
|
||||||
if (!sess)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (sess->channel) {
|
if (sess->channel) {
|
||||||
libssh2_channel_send_eof(sess->channel);
|
libssh2_channel_send_eof(sess->channel);
|
||||||
libssh2_channel_close(sess->channel);
|
libssh2_channel_close(sess->channel);
|
||||||
|
@ -131,9 +131,6 @@ virHostdevManagerDispose(void *obj)
|
|||||||
{
|
{
|
||||||
virHostdevManagerPtr hostdevMgr = obj;
|
virHostdevManagerPtr hostdevMgr = obj;
|
||||||
|
|
||||||
if (!hostdevMgr)
|
|
||||||
return;
|
|
||||||
|
|
||||||
virObjectUnref(hostdevMgr->activePCIHostdevs);
|
virObjectUnref(hostdevMgr->activePCIHostdevs);
|
||||||
virObjectUnref(hostdevMgr->inactivePCIHostdevs);
|
virObjectUnref(hostdevMgr->inactivePCIHostdevs);
|
||||||
virObjectUnref(hostdevMgr->activeUSBHostdevs);
|
virObjectUnref(hostdevMgr->activeUSBHostdevs);
|
||||||
|
Loading…
Reference in New Issue
Block a user