Re: [PATCH 1/7] kernel-shark-qt: Add plugin infrastructure to be used by the Qt-baset KS.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux