Commit e9e0d287 authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent ea39d557
......@@ -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++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment