This commit is contained in:
Pietro Gagliardi 2019-05-16 23:34:33 -04:00
parent 96c346c2dd
commit 56156f549b
1 changed files with 9 additions and 9 deletions

View File

@ -55,13 +55,13 @@ uiEvent *uiNewEvent(const uiEventOptions *options)
return e; return e;
} }
#define checkEventNonnull(e, ...) if ((e) == NULL) { \ #define checkEventNonnull(e, ret) if ((e) == NULL) { \
uiprivProgrammerError(uiprivProgrammerErrorNullPointer, "uiEvent", __func__); \ uiprivProgrammerError(uiprivProgrammerErrorNullPointer, "uiEvent", __func__); \
return __VA_ARGS__; \ return ret; \
} }
#define checkEventNotFiring(e, ...) if ((e)->firing) { \ #define checkEventNotFiring(e, ret) if ((e)->firing) { \
uiprivProgrammerError(uiprivProgrammerErrorChangingEventDuringFire, __func__); \ uiprivProgrammerError(uiprivProgrammerErrorChangingEventDuringFire, __func__); \
return __VA_ARGS__; \ return ret; \
} }
static bool checkEventSender(const uiEvent *e, void *sender, const char *func) static bool checkEventSender(const uiEvent *e, void *sender, const char *func)
@ -111,8 +111,8 @@ void uiEventDeleteHandler(uiEvent *e, int id)
{ {
struct handler *h; struct handler *h;
checkEventNonnull(e); checkEventNonnull(e, /* nothing */);
checkEventNotFiring(e); checkEventNotFiring(e, /* nothing */);
h = findHandler(e, id, __func__); h = findHandler(e, id, __func__);
if (h == NULL) if (h == NULL)
return; return;
@ -125,7 +125,7 @@ void uiEventFire(uiEvent *e, void *sender, void *args)
struct handler *h; struct handler *h;
size_t i; size_t i;
checkEventNonnull(e); checkEventNonnull(e, /* nothing */);
if (e->firing) { if (e->firing) {
uiprivProgrammerError(uiprivProgrammerErrorRecursiveEventFire); uiprivProgrammerError(uiprivProgrammerErrorRecursiveEventFire);
return; return;
@ -158,8 +158,8 @@ void uiEventSetHandlerBlocked(uiEvent *e, int id, bool blocked)
{ {
struct handler *h; struct handler *h;
checkEventNonnull(e); checkEventNonnull(e, /* nothing */);
checkEventNotFiring(e); checkEventNotFiring(e, /* nothing */);
h = findHandler(e, id, __func__); h = findHandler(e, id, __func__);
if (h == NULL) if (h == NULL)
return; return;