Alfred M. Szmidt wrote:
   sure; the patch (int its old version - see Eric blake comments on
   it) is attached to this mail.

I wanted to look at the updated one, sorry for not being clear.
sorry but before updating the patch I'd like to have a reply to my following 
problem:

Eric Blake wrote:
>> +     return 1;          // b goes before a
>> +
>> +  /* a and b are both files or both folders;
>> +     will be sorted later using the user-selected sortkey */
>> +  return 0;
>> +}
>> +
>> +int group_dirs_first()
>> +{
>> +  int i, n=0;
>> +  qsort (files, files_index, sizeof *files, cmp_directories);
>
>
>
> EVIL.  You are calling qsort twice for every element (once to put
> directories first, then twice again on the subsets).  This is twice as
> slow as just writing a proper sort function that does everything all in
> one comparison, so that you only call qsort once.

however if we want to make a single qsort call, then we'll need to declare a lot of new functions which merge previous tests with the groupdir test:

static int groupdir_compare_name (V a, V b)
static int groupdir_compstr_name (V a, V b)
static int groupdir_rev_cmp_name (V a, V b)
static int groupdir_rev_str_name (V a, V b)

static int groupdir_compare_extension (V a, V b)
static int groupdir_compstr_extension (V a, V b)
static int groupdir_rev_cmp_extension (V a, V b)
static int groupdir_rev_str_extension (V a, V b)

...


is it right ?
Won't that clutter the source file ?


Thanks a lot,
Francesco



_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to