From: Martin Mares Date: Tue, 22 May 2007 13:09:08 +0000 (+0200) Subject: Added SORT_DELETE_INPUT. X-Git-Tag: holmes-import~506^2~13^2~133 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=9b26365f8534b271f2d76563f5985b475b1405fa;p=libucw.git Added SORT_DELETE_INPUT. --- diff --git a/lib/sorter/sort-test.c b/lib/sorter/sort-test.c index 524a4cdc..a6b29f0e 100644 --- a/lib/sorter/sort-test.c +++ b/lib/sorter/sort-test.c @@ -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" diff --git a/lib/sorter/sorter.h b/lib/sorter/sorter.h index cf47ead7..e7715b88 100644 --- a/lib/sorter/sorter.h +++ b/lib/sorter/sorter.h @@ -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