This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] posix: if glob has a trailing slash match directories only.
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Dmitry Goncharov <dgoncharov at users dot sf dot net>
- Cc: libc-alpha at sourceware dot org, bug-gnulib at gnu dot org
- Date: Mon, 4 Dec 2017 11:32:06 -0800
- Subject: Re: [PATCH] posix: if glob has a trailing slash match directories only.
- Authentication-results: sourceware.org; auth=none
- References: <20171128210857.GC2745@madrid> <a97c9749-5bcd-0292-9eae-bd7c4c59ab09@cs.ucla.edu> <20171129042114.GA2702@madrid> <dec247a8-a079-ccde-89da-f7dd6b572604@cs.ucla.edu> <CAG+Z0CsgP0sMTtaurAF8kXJ0HSqhPMC-BxS36=OB05GNUo9xSQ@mail.gmail.com> <CAG+Z0CsvFWv+JGauq3=PAV8=pcD9YHi8p1k9yTbsdT8iNU9AZw@mail.gmail.com> <c6f24b4a-9681-bb87-16c4-6ba8535c45c9@cs.ucla.edu> <20171204042021.GA3045@madrid> <8af8f535-5b5b-8a11-b789-bef13b44ac8a@cs.ucla.edu> <CAG+Z0Ct4yBv5LhkyPgJaVUvBCaur7_Y1vGB7Lh==DLMtESHQxw@mail.gmail.com>
On 12/04/2017 07:46 AM, Dmitry Goncharov wrote:
Can't you simply copy nonnull entries in-place, in a single pass?
The first pass calls is_dir and frees and resets files. Do you mean to
also do copying in this very pass?
I would think that would be easy, yes.
That way, the filtered order will be the same as the original order.
The stable algorithm results in more iterations and more copying. Are you sure?
Sorry, I'm not seeing why an extra iteration would be needed. I expect
users would prefer that this bug-fix does not alter the order of
returned values.