From: Lukáš Jiřiště Date: Mon, 11 Mar 2024 13:39:21 +0000 (+0100) Subject: Change the addition for proper ordering X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=3cb01aaf8cdf897f8a1619887b6856d52ac289c9;p=palboss.git 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. --- 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)