]> git.dujemihanovic.xyz Git - u-boot.git/commit
alist: Add a way to efficiently filter an alist
authorSimon Glass <sjg@chromium.org>
Sat, 19 Oct 2024 15:21:47 +0000 (09:21 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 4 Nov 2024 03:27:12 +0000 (21:27 -0600)
commit5dfc1c8078572436fc68817d22d9e046eaa01398
tree5cdd37adeb5fd8ebfc90588a3399694e85ec0ebe
parent5bd4ead8bd76c85aa599c44e8bfb12f512d8ed09
alist: Add a way to efficiently filter an alist

Unlike linked lists, it is inefficient to remove items from an alist,
particularly if it is large. If most items need to be removed, then the
time-complexity approaches O(n2).

Provide a way to do this efficiently, by working through the alist once
and copying elements down.

Signed-off-by: Simon Glass <sjg@chromium.org>
include/alist.h
lib/alist.c
test/lib/alist.c