From 73c2b00a10c5786ddeeacc915e233fd4df1c9321 Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Sat, 11 Oct 2025 22:19:00 +0200 Subject: fix: evalexpr & tinyprintf contenaient toute la piscine --- rushs/tinyprintf/heap/pop.c | 49 --------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 rushs/tinyprintf/heap/pop.c (limited to 'rushs/tinyprintf/heap/pop.c') diff --git a/rushs/tinyprintf/heap/pop.c b/rushs/tinyprintf/heap/pop.c deleted file mode 100644 index 55e063f..0000000 --- a/rushs/tinyprintf/heap/pop.c +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include - -#include "heap.h" - -void heapify2(struct heap *h, size_t i) -{ - size_t max = i; - if (2 * i + 1 < h->size && h->array[2 * i + 1] > h->array[max]) - max = 2 * i + 1; - if (2 * i + 2 < h->size && h->array[2 * i + 2] > h->array[max]) - max = 2 * i + 2; - if (max != i) - { - int tmp = h->array[i]; - h->array[i] = h->array[max]; - h->array[max] = tmp; - heapify2(h, max); - } -} - -int pop(struct heap *heap) -{ - assert(heap->size != 0); - if (heap->size == 1) - { - heap->size--; - return heap->array[0]; - } - else - { - int res = heap->array[0]; - heap->array[0] = heap->array[heap->size - 1]; - heap->size--; - heapify2(heap, 0); - if (heap->size < heap->capacity / 2 && heap->capacity > 8) - { - heap->array = - realloc(heap->array, (heap->capacity / 2) * sizeof(int)); - if (heap->array == NULL) - { - free(heap); - return -1; - } - heap->capacity /= 2; - } - return res; - } -} -- cgit v1.2.3