Adds funny casting to avoid pedantic ISO C warning
This commit is contained in:
parent
fd3a625249
commit
3e43c30bcb
|
@ -25,7 +25,8 @@ static LinkedList *callbacks = NULL;
|
|||
void
|
||||
event_register_listener(EventCallback cb)
|
||||
{
|
||||
linkedlist_append(&callbacks, cb);
|
||||
// Cast a pointer to a pointer to avoid -wpedantic iso warning
|
||||
linkedlist_append(&callbacks, *(void**)(&cb));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -40,7 +41,8 @@ event_trigger(Event *event)
|
|||
{
|
||||
LinkedList *cbs = callbacks;
|
||||
while (cbs) {
|
||||
((EventCallback) cbs->data)(event);
|
||||
// Reverse the cast from the register (-pedantic ISO warning)
|
||||
(*(EventCallback*)(&cbs->data))(event);
|
||||
cbs = cbs->next;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue