]> 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)
committerSimon Glass <sjg@chromium.org>
Sat, 2 Nov 2024 17:13:59 +0000 (11:13 -0600)
commitd01c58acb71874721c05684472412ce169bb7df8
tree792545e85e3308e171ed70646e1d59a349e9e641
parent70f5f17415a257ce8d5f32df5b40194b89a27960
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