From dd32032c94021f23838645d6ff76a4ef64d5e29e Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Mon, 13 Feb 2023 15:17:31 +0100 Subject: [PATCH] correct stack order conditions --- stack.c | 7 +------ tabular.c | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/stack.c b/stack.c index a355fa5..081023f 100644 --- a/stack.c +++ b/stack.c @@ -124,12 +124,7 @@ double min () void order () { - int n = size_tab (stack); - if (n < 3) { - VERBOSE (WARNING, fprintf (stdout, "error not enough element in stack (%d)\n", n)); - } else { - order_tab (stack); - } + order_tab (stack); } double median () diff --git a/tabular.c b/tabular.c index 0252a8e..a7916a4 100644 --- a/tabular.c +++ b/tabular.c @@ -154,8 +154,8 @@ double pop_tab (tab_t *tab, int id) void order_tab (tab_t *tab) { int i, j; - if ((!tab) || (tab->size < 3)) { - VERBOSE (WARNING, fprintf (stdout, "error not enough element in stack (%d)\n", tab->size)); + if ((!tab) || (tab->size < 2)) { + VERBOSE (WARNING, fprintf (stdout, "error not enough element in stack (%d)\n", (tab) ? tab->size : 0)); return; } -- 2.30.2