提高链表删除效率

如果不加这一语句,那删除需要遍历整个链表,直到找到尾指针才会退出,虽然时间固定,但是降低了效率,加一个return;可以解决这个问题
pull/19/head
Glacierty 4 years ago committed by GitHub
parent 20c3a58110
commit 034496c83e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -179,6 +179,7 @@ void button_stop(struct Button* handle)
if (entry == handle) { if (entry == handle) {
*curr = entry->next; *curr = entry->next;
// free(entry); // free(entry);
return;
} else } else
curr = &entry->next; curr = &entry->next;
} }

Loading…
Cancel
Save