]> mj.ucw.cz Git - libucw.git/blobdiff - lib/sorter/s-twoway.h
Really deallocate the big_buf when radix-splitting.
[libucw.git] / lib / sorter / s-twoway.h
index 51caf3d45887d1626a6b6f0ea8334f85b262c48e..ef23a2e9339806b51bc2622379e0b9c6417d24d2 100644 (file)
@@ -7,9 +7,6 @@
  *     of the GNU Lesser General Public License.
  */
 
-/* FIXME: There is a plenty of room for further optimization */
-/* FIXME: Swap outputs if there already are some runs? */
-
 static void P(twoway_merge)(struct sort_context *ctx UNUSED, struct sort_bucket **ins, struct sort_bucket **outs)
 {
   struct fastbuf *fin1, *fin2, *fout1, *fout2, *ftmp;
@@ -58,6 +55,9 @@ static void P(twoway_merge)(struct sort_context *ctx UNUSED, struct sort_bucket
            }
          run_count++;
        }
+#ifdef SORT_ASSERT_UNIQUE
+      ASSERT(comp != 0);
+#endif
       if (comp LESS 0)
        {
          P(copy_data)(kin1, fin1, fout1);
@@ -66,7 +66,7 @@ static void P(twoway_merge)(struct sort_context *ctx UNUSED, struct sort_bucket
          run1 = next1 && (P(compare)(kprev1, kin1) LESS 0);
          kout = kprev1;
        }
-#ifdef SORT_MERGE
+#ifdef SORT_UNIFY
       else if (comp == 0)
        {
          P(key) *mkeys[] = { kin1, kin2 };
@@ -80,10 +80,6 @@ static void P(twoway_merge)(struct sort_context *ctx UNUSED, struct sort_bucket
          run2 = next2 && (P(compare)(kprev2, kin2) LESS 0);
          kout = kprev2;
        }
-#endif
-#ifdef SORT_ASSERT_UNIQUE
-      else if (unlikely(comp == 0))
-       ASSERT(0);
 #endif
       else
        {