fiptool: simplify assert() for add_image(_desc)

lookup_image(_desc)_from_uuid() traverses the linked list, so it
is not efficient.  We just want to make sure *p points to NULL here.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
Masahiro Yamada 2017-01-27 12:53:13 +09:00
parent ea39d557ae
commit e9e0d2877f
1 changed files with 2 additions and 4 deletions

View File

@ -202,11 +202,10 @@ static void add_image_desc(image_desc_t *desc)
{
image_desc_t **p = &image_desc_head;
assert(lookup_image_desc_from_uuid(&desc->uuid) == NULL);
while (*p)
p = &(*p)->next;
assert(*p == NULL);
*p = desc;
nr_image_descs++;
}
@ -244,11 +243,10 @@ static void add_image(image_t *image)
{
image_t **p = &image_head;
assert(lookup_image_from_uuid(&image->uuid) == NULL);
while (*p)
p = &(*p)->next;
assert(*p == NULL);
*p = image;
nr_images++;