mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
objecteventtest: Drop lifecycleEventCounter_reset()
The sole purpose of the lifecycleEventCounter_reset() function is to zero out given lifecycleEventCounter struct. Well, we can let the compiler zero it out when declaring a variable and just remove the function. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
91f3944935
commit
5ae12eba7f
@ -82,17 +82,6 @@ typedef struct {
|
|||||||
int deletedEvents;
|
int deletedEvents;
|
||||||
} lifecycleEventCounter;
|
} lifecycleEventCounter;
|
||||||
|
|
||||||
static void
|
|
||||||
lifecycleEventCounter_reset(lifecycleEventCounter *counter)
|
|
||||||
{
|
|
||||||
counter->startEvents = 0;
|
|
||||||
counter->stopEvents = 0;
|
|
||||||
counter->defineEvents = 0;
|
|
||||||
counter->undefineEvents = 0;
|
|
||||||
counter->unexpectedEvents = 0;
|
|
||||||
counter->createdEvents = 0;
|
|
||||||
counter->deletedEvents = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
virConnectPtr conn;
|
virConnectPtr conn;
|
||||||
@ -202,13 +191,11 @@ static int
|
|||||||
testDomainCreateXMLOld(const void *data)
|
testDomainCreateXMLOld(const void *data)
|
||||||
{
|
{
|
||||||
const objecteventTest *test = data;
|
const objecteventTest *test = data;
|
||||||
lifecycleEventCounter counter;
|
lifecycleEventCounter counter = { 0 };
|
||||||
virDomainPtr dom = NULL;
|
virDomainPtr dom = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
bool registered = false;
|
bool registered = false;
|
||||||
|
|
||||||
lifecycleEventCounter_reset(&counter);
|
|
||||||
|
|
||||||
if (virConnectDomainEventRegister(test->conn,
|
if (virConnectDomainEventRegister(test->conn,
|
||||||
domainLifecycleCb,
|
domainLifecycleCb,
|
||||||
&counter, NULL) != 0)
|
&counter, NULL) != 0)
|
||||||
@ -242,14 +229,12 @@ static int
|
|||||||
testDomainCreateXMLNew(const void *data)
|
testDomainCreateXMLNew(const void *data)
|
||||||
{
|
{
|
||||||
const objecteventTest *test = data;
|
const objecteventTest *test = data;
|
||||||
lifecycleEventCounter counter;
|
lifecycleEventCounter counter = { 0 };
|
||||||
int eventId = VIR_DOMAIN_EVENT_ID_LIFECYCLE;
|
int eventId = VIR_DOMAIN_EVENT_ID_LIFECYCLE;
|
||||||
virDomainPtr dom = NULL;
|
virDomainPtr dom = NULL;
|
||||||
int id;
|
int id;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
lifecycleEventCounter_reset(&counter);
|
|
||||||
|
|
||||||
id = virConnectDomainEventRegisterAny(test->conn, NULL, eventId,
|
id = virConnectDomainEventRegisterAny(test->conn, NULL, eventId,
|
||||||
VIR_DOMAIN_EVENT_CALLBACK(&domainLifecycleCb),
|
VIR_DOMAIN_EVENT_CALLBACK(&domainLifecycleCb),
|
||||||
&counter, NULL);
|
&counter, NULL);
|
||||||
@ -283,15 +268,13 @@ static int
|
|||||||
testDomainCreateXMLMixed(const void *data)
|
testDomainCreateXMLMixed(const void *data)
|
||||||
{
|
{
|
||||||
const objecteventTest *test = data;
|
const objecteventTest *test = data;
|
||||||
lifecycleEventCounter counter;
|
lifecycleEventCounter counter = { 0 };
|
||||||
virDomainPtr dom;
|
virDomainPtr dom;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int id1 = -1;
|
int id1 = -1;
|
||||||
int id2 = -1;
|
int id2 = -1;
|
||||||
bool registered = false;
|
bool registered = false;
|
||||||
|
|
||||||
lifecycleEventCounter_reset(&counter);
|
|
||||||
|
|
||||||
/* Fun with mixing old and new API, also with global and
|
/* Fun with mixing old and new API, also with global and
|
||||||
* per-domain. Handler should be fired three times, once for each
|
* per-domain. Handler should be fired three times, once for each
|
||||||
* registration. */
|
* registration. */
|
||||||
@ -360,14 +343,12 @@ static int
|
|||||||
testDomainDefine(const void *data)
|
testDomainDefine(const void *data)
|
||||||
{
|
{
|
||||||
const objecteventTest *test = data;
|
const objecteventTest *test = data;
|
||||||
lifecycleEventCounter counter;
|
lifecycleEventCounter counter = { 0 };
|
||||||
int eventId = VIR_DOMAIN_EVENT_ID_LIFECYCLE;
|
int eventId = VIR_DOMAIN_EVENT_ID_LIFECYCLE;
|
||||||
virDomainPtr dom = NULL;
|
virDomainPtr dom = NULL;
|
||||||
int id;
|
int id;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
lifecycleEventCounter_reset(&counter);
|
|
||||||
|
|
||||||
id = virConnectDomainEventRegisterAny(test->conn, NULL, eventId,
|
id = virConnectDomainEventRegisterAny(test->conn, NULL, eventId,
|
||||||
VIR_DOMAIN_EVENT_CALLBACK(&domainLifecycleCb),
|
VIR_DOMAIN_EVENT_CALLBACK(&domainLifecycleCb),
|
||||||
&counter, NULL);
|
&counter, NULL);
|
||||||
@ -411,7 +392,7 @@ static int
|
|||||||
testDomainStartStopEvent(const void *data)
|
testDomainStartStopEvent(const void *data)
|
||||||
{
|
{
|
||||||
const objecteventTest *test = data;
|
const objecteventTest *test = data;
|
||||||
lifecycleEventCounter counter;
|
lifecycleEventCounter counter = { 0 };
|
||||||
int eventId = VIR_DOMAIN_EVENT_ID_LIFECYCLE;
|
int eventId = VIR_DOMAIN_EVENT_ID_LIFECYCLE;
|
||||||
int id;
|
int id;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -419,8 +400,6 @@ testDomainStartStopEvent(const void *data)
|
|||||||
virConnectPtr conn2 = NULL;
|
virConnectPtr conn2 = NULL;
|
||||||
virDomainPtr dom2 = NULL;
|
virDomainPtr dom2 = NULL;
|
||||||
|
|
||||||
lifecycleEventCounter_reset(&counter);
|
|
||||||
|
|
||||||
dom = virDomainLookupByName(test->conn, "test");
|
dom = virDomainLookupByName(test->conn, "test");
|
||||||
if (dom == NULL)
|
if (dom == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
@ -476,13 +455,11 @@ static int
|
|||||||
testNetworkCreateXML(const void *data)
|
testNetworkCreateXML(const void *data)
|
||||||
{
|
{
|
||||||
const objecteventTest *test = data;
|
const objecteventTest *test = data;
|
||||||
lifecycleEventCounter counter;
|
lifecycleEventCounter counter = { 0 };
|
||||||
virNetworkPtr net;
|
virNetworkPtr net;
|
||||||
int id;
|
int id;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
lifecycleEventCounter_reset(&counter);
|
|
||||||
|
|
||||||
id = virConnectNetworkEventRegisterAny(test->conn, NULL,
|
id = virConnectNetworkEventRegisterAny(test->conn, NULL,
|
||||||
VIR_NETWORK_EVENT_ID_LIFECYCLE,
|
VIR_NETWORK_EVENT_ID_LIFECYCLE,
|
||||||
VIR_NETWORK_EVENT_CALLBACK(&networkLifecycleCb),
|
VIR_NETWORK_EVENT_CALLBACK(&networkLifecycleCb),
|
||||||
@ -512,13 +489,11 @@ static int
|
|||||||
testNetworkDefine(const void *data)
|
testNetworkDefine(const void *data)
|
||||||
{
|
{
|
||||||
const objecteventTest *test = data;
|
const objecteventTest *test = data;
|
||||||
lifecycleEventCounter counter;
|
lifecycleEventCounter counter = { 0 };
|
||||||
virNetworkPtr net;
|
virNetworkPtr net;
|
||||||
int id;
|
int id;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
lifecycleEventCounter_reset(&counter);
|
|
||||||
|
|
||||||
id = virConnectNetworkEventRegisterAny(test->conn, NULL,
|
id = virConnectNetworkEventRegisterAny(test->conn, NULL,
|
||||||
VIR_NETWORK_EVENT_ID_LIFECYCLE,
|
VIR_NETWORK_EVENT_ID_LIFECYCLE,
|
||||||
VIR_NETWORK_EVENT_CALLBACK(&networkLifecycleCb),
|
VIR_NETWORK_EVENT_CALLBACK(&networkLifecycleCb),
|
||||||
@ -563,15 +538,13 @@ static int
|
|||||||
testNetworkStartStopEvent(const void *data)
|
testNetworkStartStopEvent(const void *data)
|
||||||
{
|
{
|
||||||
const objecteventTest *test = data;
|
const objecteventTest *test = data;
|
||||||
lifecycleEventCounter counter;
|
lifecycleEventCounter counter = { 0 };
|
||||||
int id;
|
int id;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!test->net)
|
if (!test->net)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
lifecycleEventCounter_reset(&counter);
|
|
||||||
|
|
||||||
id = virConnectNetworkEventRegisterAny(test->conn, test->net,
|
id = virConnectNetworkEventRegisterAny(test->conn, test->net,
|
||||||
VIR_NETWORK_EVENT_ID_LIFECYCLE,
|
VIR_NETWORK_EVENT_ID_LIFECYCLE,
|
||||||
VIR_NETWORK_EVENT_CALLBACK(&networkLifecycleCb),
|
VIR_NETWORK_EVENT_CALLBACK(&networkLifecycleCb),
|
||||||
@ -599,13 +572,11 @@ static int
|
|||||||
testStoragePoolCreateXML(const void *data)
|
testStoragePoolCreateXML(const void *data)
|
||||||
{
|
{
|
||||||
const objecteventTest *test = data;
|
const objecteventTest *test = data;
|
||||||
lifecycleEventCounter counter;
|
lifecycleEventCounter counter = { 0 };
|
||||||
virStoragePoolPtr pool;
|
virStoragePoolPtr pool;
|
||||||
int id;
|
int id;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
lifecycleEventCounter_reset(&counter);
|
|
||||||
|
|
||||||
id = virConnectStoragePoolEventRegisterAny(test->conn, NULL,
|
id = virConnectStoragePoolEventRegisterAny(test->conn, NULL,
|
||||||
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
|
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
|
||||||
VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycleCb),
|
VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycleCb),
|
||||||
@ -635,13 +606,11 @@ static int
|
|||||||
testStoragePoolDefine(const void *data)
|
testStoragePoolDefine(const void *data)
|
||||||
{
|
{
|
||||||
const objecteventTest *test = data;
|
const objecteventTest *test = data;
|
||||||
lifecycleEventCounter counter;
|
lifecycleEventCounter counter = { 0 };
|
||||||
virStoragePoolPtr pool;
|
virStoragePoolPtr pool;
|
||||||
int id;
|
int id;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
lifecycleEventCounter_reset(&counter);
|
|
||||||
|
|
||||||
id = virConnectStoragePoolEventRegisterAny(test->conn, NULL,
|
id = virConnectStoragePoolEventRegisterAny(test->conn, NULL,
|
||||||
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
|
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
|
||||||
VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycleCb),
|
VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycleCb),
|
||||||
@ -686,7 +655,7 @@ static int
|
|||||||
testStoragePoolStartStopEvent(const void *data)
|
testStoragePoolStartStopEvent(const void *data)
|
||||||
{
|
{
|
||||||
const objecteventTest *test = data;
|
const objecteventTest *test = data;
|
||||||
lifecycleEventCounter counter;
|
lifecycleEventCounter counter = { 0 };
|
||||||
int refreshCounter;
|
int refreshCounter;
|
||||||
int id1, id2;
|
int id1, id2;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -694,7 +663,6 @@ testStoragePoolStartStopEvent(const void *data)
|
|||||||
if (!test->pool)
|
if (!test->pool)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
lifecycleEventCounter_reset(&counter);
|
|
||||||
refreshCounter = 0;
|
refreshCounter = 0;
|
||||||
|
|
||||||
id1 = virConnectStoragePoolEventRegisterAny(test->conn, test->pool,
|
id1 = virConnectStoragePoolEventRegisterAny(test->conn, test->pool,
|
||||||
@ -730,12 +698,10 @@ static int
|
|||||||
testStoragePoolBuild(const void *data)
|
testStoragePoolBuild(const void *data)
|
||||||
{
|
{
|
||||||
const objecteventTest *test = data;
|
const objecteventTest *test = data;
|
||||||
lifecycleEventCounter counter;
|
lifecycleEventCounter counter = { 0 };
|
||||||
int id;
|
int id;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
lifecycleEventCounter_reset(&counter);
|
|
||||||
|
|
||||||
id = virConnectStoragePoolEventRegisterAny(test->conn, NULL,
|
id = virConnectStoragePoolEventRegisterAny(test->conn, NULL,
|
||||||
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
|
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
|
||||||
VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycleCb),
|
VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycleCb),
|
||||||
@ -762,12 +728,10 @@ static int
|
|||||||
testStoragePoolDelete(const void *data)
|
testStoragePoolDelete(const void *data)
|
||||||
{
|
{
|
||||||
const objecteventTest *test = data;
|
const objecteventTest *test = data;
|
||||||
lifecycleEventCounter counter;
|
lifecycleEventCounter counter = { 0 };
|
||||||
int id;
|
int id;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
lifecycleEventCounter_reset(&counter);
|
|
||||||
|
|
||||||
id = virConnectStoragePoolEventRegisterAny(test->conn, NULL,
|
id = virConnectStoragePoolEventRegisterAny(test->conn, NULL,
|
||||||
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
|
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
|
||||||
VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycleCb),
|
VIR_STORAGE_POOL_EVENT_CALLBACK(&storagePoolLifecycleCb),
|
||||||
@ -793,13 +757,11 @@ static int
|
|||||||
testNodeDeviceCreateXML(const void *data)
|
testNodeDeviceCreateXML(const void *data)
|
||||||
{
|
{
|
||||||
const objecteventTest *test = data;
|
const objecteventTest *test = data;
|
||||||
lifecycleEventCounter counter;
|
lifecycleEventCounter counter = { 0 };
|
||||||
virNodeDevicePtr dev;
|
virNodeDevicePtr dev;
|
||||||
int id;
|
int id;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
lifecycleEventCounter_reset(&counter);
|
|
||||||
|
|
||||||
id = virConnectNodeDeviceEventRegisterAny(test->conn, NULL,
|
id = virConnectNodeDeviceEventRegisterAny(test->conn, NULL,
|
||||||
VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE,
|
VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE,
|
||||||
VIR_NODE_DEVICE_EVENT_CALLBACK(&nodeDeviceLifecycleCb),
|
VIR_NODE_DEVICE_EVENT_CALLBACK(&nodeDeviceLifecycleCb),
|
||||||
|
Loading…
Reference in New Issue
Block a user