mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 07:42:56 +00:00
domain_conf: drop unused ref-count in snapshot object
The ref count was assigned to 1 at creation, then never modified again until it was decremented just before freeing the object. * src/conf/domain_conf.h (_virDomainSnapshotObj): Delete unused field. (virDomainSnapshotObjUnref): Delete unused prototype. * src/libvirt_private.syms: Likewise. * src/conf/domain_conf.c (virDomainSnapshotObjNew) (virDomainSnapshotObjListDataFree): Update users. (virDomainSnapshotObjUnref): Delete.
This commit is contained in:
parent
206fc979b1
commit
e904ce3c47
@ -8722,8 +8722,6 @@ static virDomainSnapshotObjPtr virDomainSnapshotObjNew(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
snapshot->refs = 1;
|
|
||||||
|
|
||||||
VIR_DEBUG("obj=%p", snapshot);
|
VIR_DEBUG("obj=%p", snapshot);
|
||||||
|
|
||||||
return snapshot;
|
return snapshot;
|
||||||
@ -8740,17 +8738,6 @@ static void virDomainSnapshotObjFree(virDomainSnapshotObjPtr snapshot)
|
|||||||
VIR_FREE(snapshot);
|
VIR_FREE(snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
int virDomainSnapshotObjUnref(virDomainSnapshotObjPtr snapshot)
|
|
||||||
{
|
|
||||||
snapshot->refs--;
|
|
||||||
VIR_DEBUG("obj=%p refs=%d", snapshot, snapshot->refs);
|
|
||||||
if (snapshot->refs == 0) {
|
|
||||||
virDomainSnapshotObjFree(snapshot);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return snapshot->refs;
|
|
||||||
}
|
|
||||||
|
|
||||||
virDomainSnapshotObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr snapshots,
|
virDomainSnapshotObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr snapshots,
|
||||||
const virDomainSnapshotDefPtr def)
|
const virDomainSnapshotDefPtr def)
|
||||||
{
|
{
|
||||||
@ -8782,7 +8769,7 @@ virDomainSnapshotObjListDataFree(void *payload,
|
|||||||
{
|
{
|
||||||
virDomainSnapshotObjPtr obj = payload;
|
virDomainSnapshotObjPtr obj = payload;
|
||||||
|
|
||||||
virDomainSnapshotObjUnref(obj);
|
virDomainSnapshotObjFree(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
int virDomainSnapshotObjListInit(virDomainSnapshotObjListPtr snapshots)
|
int virDomainSnapshotObjListInit(virDomainSnapshotObjListPtr snapshots)
|
||||||
|
@ -998,8 +998,6 @@ struct _virDomainSnapshotDef {
|
|||||||
typedef struct _virDomainSnapshotObj virDomainSnapshotObj;
|
typedef struct _virDomainSnapshotObj virDomainSnapshotObj;
|
||||||
typedef virDomainSnapshotObj *virDomainSnapshotObjPtr;
|
typedef virDomainSnapshotObj *virDomainSnapshotObjPtr;
|
||||||
struct _virDomainSnapshotObj {
|
struct _virDomainSnapshotObj {
|
||||||
int refs;
|
|
||||||
|
|
||||||
virDomainSnapshotDefPtr def;
|
virDomainSnapshotDefPtr def;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1028,7 +1026,6 @@ virDomainSnapshotObjPtr virDomainSnapshotFindByName(const virDomainSnapshotObjLi
|
|||||||
const char *name);
|
const char *name);
|
||||||
void virDomainSnapshotObjListRemove(virDomainSnapshotObjListPtr snapshots,
|
void virDomainSnapshotObjListRemove(virDomainSnapshotObjListPtr snapshots,
|
||||||
virDomainSnapshotObjPtr snapshot);
|
virDomainSnapshotObjPtr snapshot);
|
||||||
int virDomainSnapshotObjUnref(virDomainSnapshotObjPtr snapshot);
|
|
||||||
int virDomainSnapshotHasChildren(virDomainSnapshotObjPtr snap,
|
int virDomainSnapshotHasChildren(virDomainSnapshotObjPtr snap,
|
||||||
virDomainSnapshotObjListPtr snapshots);
|
virDomainSnapshotObjListPtr snapshots);
|
||||||
|
|
||||||
|
@ -305,7 +305,6 @@ virDomainSnapshotHasChildren;
|
|||||||
virDomainSnapshotObjListGetNames;
|
virDomainSnapshotObjListGetNames;
|
||||||
virDomainSnapshotObjListNum;
|
virDomainSnapshotObjListNum;
|
||||||
virDomainSnapshotObjListRemove;
|
virDomainSnapshotObjListRemove;
|
||||||
virDomainSnapshotObjUnref;
|
|
||||||
virDomainSoundDefFree;
|
virDomainSoundDefFree;
|
||||||
virDomainSoundModelTypeFromString;
|
virDomainSoundModelTypeFromString;
|
||||||
virDomainSoundModelTypeToString;
|
virDomainSoundModelTypeToString;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user