On 29.08.2018 23:32, Steven Rostedt wrote:
+ struct kshark_event_handler **last = handlers; + struct kshark_event_handler *list; + + for (list = *handlers; list; list = list->next) {You can simplify this to: for (last = handlers; *last; last = &(*last)->next) { list = *last;+ if (list->id == event_id && + list->event_func == evt_func && + list->draw_func == dw_func) { + *last = list->next; + free(list); + return; + } ++ last = &list->next;Then you can remove the above line.
I am confused. For me the two implementations of this for-loop are identical. Where is the simplification?
Thanks! Yordan