coreboot/tests/commonlib
Yu-Ping Wu e50f7e8b49 commonlib/list: Add list_length() and more to API
In a follow-up patch (CB:90962), the list will be changed to a circular
one, and list_node fields 'next' and 'prev' will become private to the
implementation.

To allow smooth transition to circular lists for all call sites, add the
following functions to the list API:

- list_is_empty()
- list_next()
- list_prev()
- list_first()
- list_last()
- list_length()

All list API call sites are expected to use the public API instead of
the raw 'next' and 'prev' pointers.

Change-Id: Ib1040f5caab8550ea52db9b55a074d7d79c591e5
Signed-off-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90961
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jakub "Kuba" Czapiga <czapiga@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
2026-02-01 02:25:52 +00:00
..
bsd commonlib/bsd/string: Fix pointer overflow for strnlen() 2024-08-15 18:16:23 +00:00
device_tree-test.c treewide: Move device_tree to commonlib 2024-06-22 04:02:04 +00:00
list-test.c commonlib/list: Add list_length() and more to API 2026-02-01 02:25:52 +00:00
Makefile.mk treewide: Move device_tree to commonlib 2024-06-22 04:02:04 +00:00
rational-test.c tests/commonlib/rational-test: Use test group runner wrapper 2022-09-07 22:24:31 +00:00
region-test.c region: Turn region_end() into an inclusive region_last() 2024-08-23 01:08:16 +00:00