mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
event: use bool in more places
No need to use an int that only ever stores 0 and 1. * src/conf/object_event_private.h (_virObjectEventCallback): Change deleted to bool. * src/conf/object_event.c (virObjectEventDispatchMatchCallback): Switch return type to bool. (virObjectEventCallbackListMarkDeleteID): Update client. * src/conf/domain_event.c (virDomainEventCallbackListMarkDelete): Likewise.
This commit is contained in:
parent
ec128e69f1
commit
22e82aa596
@ -424,7 +424,7 @@ virDomainEventCallbackListMarkDelete(virConnectPtr conn,
|
||||
if (cbList->callbacks[i]->cb == VIR_OBJECT_EVENT_CALLBACK(callback) &&
|
||||
cbList->callbacks[i]->eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE &&
|
||||
cbList->callbacks[i]->conn == conn) {
|
||||
cbList->callbacks[i]->deleted = 1;
|
||||
cbList->callbacks[i]->deleted = true;
|
||||
for (i = 0; i < cbList->count; i++) {
|
||||
if (!cbList->callbacks[i]->deleted)
|
||||
ret++;
|
||||
|
@ -171,7 +171,7 @@ virObjectEventCallbackListMarkDeleteID(virConnectPtr conn,
|
||||
for (i = 0; i < cbList->count; i++) {
|
||||
if (cbList->callbacks[i]->callbackID == callbackID &&
|
||||
cbList->callbacks[i]->conn == conn) {
|
||||
cbList->callbacks[i]->deleted = 1;
|
||||
cbList->callbacks[i]->deleted = true;
|
||||
for (i = 0; i < cbList->count; i++) {
|
||||
if (!cbList->callbacks[i]->deleted)
|
||||
ret++;
|
||||
@ -577,18 +577,18 @@ virObjectEventQueuePush(virObjectEventQueuePtr evtQueue,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static bool
|
||||
virObjectEventDispatchMatchCallback(virObjectEventPtr event,
|
||||
virObjectEventCallbackPtr cb)
|
||||
{
|
||||
if (!cb)
|
||||
return 0;
|
||||
return false;
|
||||
if (cb->deleted)
|
||||
return 0;
|
||||
return false;
|
||||
if (!virObjectIsClass(event, cb->klass))
|
||||
return 0;
|
||||
return false;
|
||||
if (cb->eventID != event->eventID)
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
if (cb->meta) {
|
||||
/* Deliberately ignoring 'id' for matching, since that
|
||||
@ -597,13 +597,9 @@ virObjectEventDispatchMatchCallback(virObjectEventPtr event,
|
||||
* Xen sometimes renames guests during migration, thus
|
||||
* leaving 'uuid' as the only truly reliable ID we can use. */
|
||||
|
||||
if (memcmp(event->meta.uuid, cb->meta->uuid, VIR_UUID_BUFLEN) == 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
return memcmp(event->meta.uuid, cb->meta->uuid, VIR_UUID_BUFLEN) == 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ struct _virObjectEventCallback {
|
||||
virConnectObjectEventGenericCallback cb;
|
||||
void *opaque;
|
||||
virFreeCallback freecb;
|
||||
int deleted;
|
||||
bool deleted;
|
||||
};
|
||||
|
||||
typedef void
|
||||
|
Loading…
Reference in New Issue
Block a user