fixes inappropriate size datatype in list merge sort feature/array

Thu, 04 Jul 2019 21:31:45 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 04 Jul 2019 21:31:45 +0200
branch
feature/array
changeset 335
872ae61c8945
parent 334
bc81faa9afda
child 336
6d7aa8a1a3b3

fixes inappropriate size datatype in list merge sort

src/list.c file | annotate | diff | comparison | revisions
--- a/src/list.c	Thu Jul 04 20:07:31 2019 +0200
+++ b/src/list.c	Thu Jul 04 21:31:45 2019 +0200
@@ -206,7 +206,7 @@
     return s;
 }
 
-static UcxList *ucx_list_sort_merge(int length,
+static UcxList *ucx_list_sort_merge(size_t length,
         UcxList* ls, UcxList* le, UcxList* re,
         cmp_func fnc, void* data) {
 
@@ -214,7 +214,7 @@
     UcxList *rc, *lc;
 
     lc = ls; rc = le;
-    int n = 0;
+    size_t n = 0;
     while (lc && lc != le && rc != re) {
         if (fnc(lc->data, rc->data, data) <= 0) {
             sorted[n] = lc;
@@ -255,7 +255,7 @@
     }
 
     UcxList *lc;
-    int ln = 1;
+    size_t ln = 1;
 
     UcxList *ls = l, *le, *re;
     
@@ -271,7 +271,7 @@
         return l; // this list is already sorted :)
     } else {
         UcxList *rc;
-        int rn = 1;
+        size_t rn = 1;
         rc = le;
         // skip already sorted elements
         while (rc->next != NULL && fnc(rc->next->data, rc->data, data) > 0) {

mercurial