From 78f05087c6e452f62750ef9200b173efdacc10b4 Mon Sep 17 00:00:00 2001 From: Michal Utlak Date: Tue, 9 Apr 2024 17:04:30 +0200 Subject: [PATCH] pls --- cv9/snake.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/cv9/snake.c b/cv9/snake.c index 5d2df07..f43a6d0 100644 --- a/cv9/snake.c +++ b/cv9/snake.c @@ -18,22 +18,17 @@ struct snake* remove_snake(struct snake* snake){ return NULL; } - struct snake* nova_hlavicka = snake->next; + free(snake); - - if (nova_hlavicka == NULL || nova_hlavicka->next == NULL) { - assert(nova_hlavicka == NULL || nova_hlavicka->next == NULL); - return nova_hlavicka; + if (nova_hlavicka == NULL) { + return NULL; } - - struct snake* chvost = nova_hlavicka; while (chvost->next != NULL) { chvost = chvost->next; } - assert(chvost->next == NULL); return nova_hlavicka;