From 60011b1b11e9025752ad12e05886a0222fb49828 Mon Sep 17 00:00:00 2001 From: David GAILLETON Date: Wed, 14 Jan 2026 11:42:10 +0100 Subject: [PATCH] Fix bench valgrind error (Write size) --- algorithms/radix/radix.c | 12 ++++++------ flags/bench.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/algorithms/radix/radix.c b/algorithms/radix/radix.c index 31e8a82..249c2d5 100644 --- a/algorithms/radix/radix.c +++ b/algorithms/radix/radix.c @@ -12,17 +12,17 @@ #include "push_swap.h" -static int still_unit_value(t_stacks *stacks, int unit) +static int still_unit_index(t_stacks *stacks, int unit) { t_stack *temp; temp = stacks->a; - if (!temp || temp->value >= unit) + if (!temp || temp->index >= unit) return (1); temp = temp->next; while (temp != stacks->a) { - if (temp->value >= unit) + if (temp->index >= unit) return (1); temp = temp->next; } @@ -43,9 +43,9 @@ static void push_by_number_to_b(t_stacks *stacks, int unit, int nb) temp = temp->next; } i = 0; - while (i < s_len && still_unit_value(stacks, unit)) + while (i < s_len && still_unit_index(stacks, unit)) { - if (stacks->a && (stacks->a->value % (unit * 10)) / unit == nb) + if (stacks->a && (stacks->a->index % (unit * 10)) / unit == nb) pb(stacks); else ra(stacks); @@ -58,7 +58,7 @@ static void rec_sort(t_stacks *stacks, int unit) int i; i = 0; - if (!still_unit_value(stacks, unit)) + if (!still_unit_index(stacks, unit)) return ; while (i <= 9) { diff --git a/flags/bench.c b/flags/bench.c index 31b5d2a..9c59efe 100644 --- a/flags/bench.c +++ b/flags/bench.c @@ -31,7 +31,7 @@ static void print_disorder(t_stacks *stacks) secure_write(2, ".", 1); if (ft_strlen(str) == 1) secure_write(2, "0", 1); - secure_write(2, &str[ft_strlen(str) - 2], 2); + secure_write(2, &str[ft_strlen(str) - 2], ft_strlen(str) - 2); secure_write(2, "%\n", 2); free(str); }