mostly done; helgrind issue not fixed

This commit is contained in:
Semere M. Mebrahtom 2026-04-02 19:53:23 +02:00
parent b1b32525a5
commit 6d65af5288
Signed by: semere
GPG key ID: 7FC937214DF30488
9 changed files with 381 additions and 231 deletions

View file

@ -1,6 +1,16 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* heap.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: semebrah <semebrah@student.42berlin.de> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/03/22 18:07:14 by semebrah #+# #+# */
/* Updated: 2026/03/22 18:07:31 by semebrah ### ########.fr */
/* */
/* ************************************************************************** */
#include "codexion.h"
#include <stdbool.h>
#include <stdlib.h>
static void sift_up(t_minheap *heap, int i, int (*cmp)(void *, void *))
{
@ -49,18 +59,6 @@ static void sift_down(t_minheap *heap, int i, int (*cmp)(void *, void *))
}
}
t_minheap *init_heap(int (*cmp)(void *, void *))
{
t_minheap *heap;
heap = malloc(sizeof(t_minheap));
if (!heap)
return (NULL);
heap->length = 0;
heap->cmp = cmp;
return (heap);
}
void *peek(t_minheap *heap)
{
if (!heap || !heap->length)