memrange: Add a helper function to determine if memranges is empty

This change adds a helper function memranges_is_empty() which returns
true if there are no entries in memranges.

BUG=b:149186922

Signed-off-by: Furquan Shaikh <furquan@google.com>
Change-Id: If841c42a9722cbc73ef321568928bc175bf88fd5
Reviewed-on: https://review.coreboot.org/c/coreboot/+/39485
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Furquan Shaikh 2020-03-12 16:43:49 -07:00 committed by Patrick Georgi
parent 9c6274cd8f
commit 2190a632e0
1 changed files with 5 additions and 0 deletions

View File

@ -81,6 +81,11 @@ static inline void range_entry_update_tag(struct range_entry *r,
r->tag = new_tag;
}
static inline bool memranges_is_empty(struct memranges *ranges)
{
return ranges->entries == NULL;
}
/* Iterate over each entry in a memranges structure. Ranges cannot
* be deleted while processing each entry as the list cannot be safely
* traversed after such an operation.