From 9717cff35af5748d68fd694b8d8e2d2f21f7b86f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20LUDWIG?= Date: Mon, 31 Jul 2023 23:51:37 +0200 Subject: [PATCH] feat: add terminal_print_array_list --- lib/terminal.c | 4 ++++ lib/terminal.h | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/terminal.c b/lib/terminal.c index 6209ada..d352c52 100644 --- a/lib/terminal.c +++ b/lib/terminal.c @@ -111,3 +111,7 @@ void terminal_print_hash_map(struct hash_map* hash_map, void (*print_element)(vo } printf("}\n"); } + +void terminal_print_array_list(struct array_list* list, void (*print_element)(void*)) { + terminal_print_array(list->data, list->size, sizeof(void*), print_element); +} diff --git a/lib/terminal.h b/lib/terminal.h index 1bf62b8..1eba360 100644 --- a/lib/terminal.h +++ b/lib/terminal.h @@ -6,6 +6,7 @@ #include #include +#include "array_list.h" #include "character.h" #include "hash_map.h" #include "linked_list.h" @@ -106,4 +107,13 @@ void terminal_print_linked_list(struct linked_list* linked_list, void (*print_el */ void terminal_print_hash_map(struct hash_map* hash_map, void (*print_element)(void*)); +/** + * @brief Print an array list. + * + * @param array_list + * @param print_element + * @since v2.1.0 + */ +void terminal_print_array_list(struct array_list* list, void (*print_element)(void*)); + #endif