correct stack order conditions
authorLaurent Mazet <laurent.mazet@thalesgroup.com>
Mon, 13 Feb 2023 14:17:31 +0000 (15:17 +0100)
committerLaurent Mazet <laurent.mazet@thalesgroup.com>
Mon, 13 Feb 2023 14:17:31 +0000 (15:17 +0100)
stack.c
tabular.c

diff --git a/stack.c b/stack.c
index a355fa5e3281b2fc34d1c3460c43701d776c99a2..081023fa985c4d7f3d097e7483662c04096d59a3 100644 (file)
--- 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 ()
index 0252a8e8ec1bf82aad5e3f6a723db40644fe35de..a7916a47531a60aad42c59f6c8962b0a51b58f28 100644 (file)
--- 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;
     }