X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fsorter%2Fsorter.h;h=cd5e843f84bd0930d11e18ba7879452ca1fd83e6;hb=66b0f5843d272887ceb09b0d2d339f3cec10eca7;hp=e7715b887a7e682682b81dcd74da097996567dfe;hpb=9b26365f8534b271f2d76563f5985b475b1405fa;p=libucw.git diff --git a/lib/sorter/sorter.h b/lib/sorter/sorter.h index e7715b88..cd5e843f 100644 --- a/lib/sorter/sorter.h +++ b/lib/sorter/sorter.h @@ -60,10 +60,13 @@ * void PREFIX_write_merged(struct fastbuf *f, SORT_KEY **keys, void **data, uns n, void *buf) * takes n records in memory with keys which compare equal and writes * a single record to the given fastbuf. `buf' points to a buffer which - * is guaranteed to hold all given records. + * is guaranteed to hold the sum of workspace requirements (see below) + * over all given records. * void PREFIX_copy_merged(SORT_KEY **keys, struct fastbuf **data, uns n, struct fastbuf *dest) * takes n records with keys in memory and data in fastbufs and writes - * a single record. + * a single record. Used only if SORT_DATA_SIZE or SORT_UNIFY_WORKSPACE is defined. + * SORT_UNIFY_WORKSPACE(key) gets a key and returns the amount of workspace required when merging + * the given record. Defaults to 0. * * Input (choose one of these): * @@ -174,7 +177,14 @@ static inline void P(copy_data)(P(key) *key, struct fastbuf *in, struct fastbuf #endif } -#if defined(SORT_VAR_KEY) || defined(SORT_VAR_DATA) +#if defined(SORT_UNIFY) && !defined(SORT_VAR_DATA) && !defined(SORT_UNIFY_WORKSPACE) +static inline void P(copy_merged)(P(key) **keys, struct fastbuf **data UNUSED, uns n, struct fastbuf *dest) +{ + P(write_merged)(dest, keys, NULL, n, NULL); +} +#endif + +#if defined(SORT_VAR_KEY) || defined(SORT_VAR_DATA) || defined(SORT_UNIFY_WORKSPACE) #include "lib/sorter/s-internal.h" #else #include "lib/sorter/s-fixint.h" @@ -272,6 +282,7 @@ static struct fastbuf *P(sort)( #undef SORT_INT #undef SORT_HASH_BITS #undef SORT_UNIFY +#undef SORT_UNIFY_WORKSPACE #undef SORT_INPUT_FILE #undef SORT_INPUT_FB #undef SORT_INPUT_PRESORT