]> mj.ucw.cz Git - libucw.git/commitdiff
Added SORT_DELETE_INPUT.
authorMartin Mares <mj@ucw.cz>
Tue, 22 May 2007 13:09:08 +0000 (15:09 +0200)
committerMartin Mares <mj@ucw.cz>
Tue, 22 May 2007 13:09:08 +0000 (15:09 +0200)
lib/sorter/sort-test.c
lib/sorter/sorter.h

index 524a4cdc763da9d2608cf497436b626af19699d5..a6b29f0ecc3c49d266df03b260d396026388c295 100644 (file)
@@ -51,6 +51,7 @@ struct key1 {
 #define SORT_OUTPUT_FB
 #define SORT_UNIQUE
 #define SORT_INT(k) (k).x
+#define SORT_DELETE_INPUT 0
 
 #include "lib/sorter/sorter.h"
 
index cf47ead7793268563ea2fcc98b6c1924ab27591c..e7715b887a7e682682b81dcd74da097996567dfe 100644 (file)
@@ -75,6 +75,8 @@
  *                     to get successive batches of pre-sorted data.
  *                     The function is passed a page-aligned presorting buffer.
  *                     It returns 1 on success or 0 on EOF.
+ *  SORT_DELETE_INPUT  A C expression, if true, then the input files are deleted
+ *                     as soon as possible.
  *
  *  Output (chose one of these):
  *
@@ -219,6 +221,10 @@ static struct fastbuf *P(sort)(
 #else
 #error No input given.
 #endif
+#ifdef SORT_DELETE_INPUT
+  if (SORT_DELETE_INPUT)
+    bconfig(ctx.in_fb, BCONFIG_IS_TEMP_FILE, 1);
+#endif
 
 #ifdef SORT_OUTPUT_FB
   ASSERT(!out);
@@ -274,6 +280,7 @@ static struct fastbuf *P(sort)(
 #undef SORT_OUTPUT_THIS_FB
 #undef SORT_UNIQUE
 #undef SORT_ASSERT_UNIQUE
+#undef SORT_DELETE_INPUT
 #undef SWAP
 #undef LESS
 #undef P