void webpage_sendMessage(webpage_t * self, const char * message, const char * hyperlink) { int count = list_getCount(self->event_notification); for (int i = 0; i < count; i++) { event_t * ev = list_getEl(self->event_notification, i); if (NULL != ev->callback) { webpage_notification_fn fn = ev->callback; fn(ev->receiver, self, message, hyperlink); } } }
//adding the event to list and checking value static void add_EventToList_Event(void ** state) { list_t * list = list_new(); event_t * ev = malloc(sizeof(event_t)); ev->receiver = NULL; ev->callback = NULL; list_push_back(list, ev); assert_memory_equal(list_getEl(list, 0), ev, 0); free(ev); free(list); }
static void text_check(text_t * self) { int count = list_getCount(self->event_notification); for (int i = 0; i < count; i++) { event_t * ev = list_getEl(self->event_notification, i); if (NULL != ev->callback) { cb fn = ev->callback; if(fn(text_getEl(self, self->size - 1)) == 1) { text_pop(self); } } } }