/* Immutable pointer, self-locking APIs */
virThreadPool *workerPool;
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(udevEventData, virObjectUnref);
static virClass *udevEventDataClass;
static udevEventData *
udevEventDataNew(void)
{
- udevEventData *ret = NULL;
+ g_autoptr(udevEventData) ret = NULL;
if (udevEventDataInitialize() < 0)
return NULL;
if (!(ret = virObjectLockableNew(udevEventDataClass)))
return NULL;
- if (virCondInit(&ret->udevThreadCond) < 0) {
- virObjectUnref(ret);
+ if (virCondInit(&ret->udevThreadCond) < 0)
return NULL;
- }
- if (virMutexInit(&ret->mdevctlLock) < 0) {
- virObjectUnref(ret);
+ if (virMutexInit(&ret->mdevctlLock) < 0)
return NULL;
- }
ret->mdevctlTimeout = -1;
ret->watch = -1;
- return ret;
+ return g_steal_pointer(&ret);
}
typedef enum {