From 3cb01aaf8cdf897f8a1619887b6856d52ac289c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Ji=C5=99i=C5=A1t=C4=9B?= Date: Mon, 11 Mar 2024 14:39:21 +0100 Subject: [PATCH] Change the addition for proper ordering The boss addition relied on ft_vec_append which makes the new entry be at the end. This messes with the ordering as added entries are ready to be defeated hence should be at the top. This commit uses insert to insert the new entry to the very top which conserves the ordering property. --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 9afea1f..6db3701 100644 --- a/src/main.c +++ b/src/main.c @@ -292,7 +292,7 @@ void carry_out_command(t_command *com, t_vec *database) else if (com->basic == basic_remove) ft_vec_erase(database, ind, free_entry); else if (com->basic == basic_add) - ft_vec_append(database, &com->entry); + ft_vec_insert(database, &com->entry, 0); else if (com->basic == basic_list) { if (com->entry.name == NULL) -- 2.30.2