Add an element at the end of a list. Signed-off-by: Frediano Ziglio <frediano.zig...@cloud.com> --- grub-core/kern/list.c | 10 ++++++++++ include/grub/list.h | 1 + 2 files changed, 11 insertions(+)
diff --git a/grub-core/kern/list.c b/grub-core/kern/list.c index 09761b0e5..c5bdaf94b 100644 --- a/grub-core/kern/list.c +++ b/grub-core/kern/list.c @@ -43,6 +43,16 @@ grub_list_push (grub_list_t *head, grub_list_t item) *head = item; } +void +grub_list_append (grub_list_t *head, grub_list_t item) +{ + while (*head) + head = &(*head)->next; + item->prev = head; + item->next = NULL; + *head = item; +} + void grub_list_remove (grub_list_t item) { diff --git a/include/grub/list.h b/include/grub/list.h index 094eaf9cd..c11c180a7 100644 --- a/include/grub/list.h +++ b/include/grub/list.h @@ -33,6 +33,7 @@ struct grub_list typedef struct grub_list *grub_list_t; void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item); +void EXPORT_FUNC(grub_list_append) (grub_list_t *head, grub_list_t item); void EXPORT_FUNC(grub_list_remove) (grub_list_t item); grub_size_t EXPORT_FUNC(grub_list_length) (grub_list_t head); -- 2.43.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel