diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-11-22 13:35:55 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-11-22 13:35:55 -0800 |
commit | 81fa0c0f30bb6bcd2a4d287748db6d090b0d04ea (patch) | |
tree | d581b3e6445623ed47f81e0e34c061b4445cd66b /eval.h | |
parent | 0a4c8368263bf2b9258f02fea12c60825d780885 (diff) | |
download | txr-81fa0c0f30bb6bcd2a4d287748db6d090b0d04ea.tar.gz txr-81fa0c0f30bb6bcd2a4d287748db6d090b0d04ea.tar.bz2 txr-81fa0c0f30bb6bcd2a4d287748db6d090b0d04ea.zip |
glob: suppress consecutive duplicates; fix memleak.
* glob.c (glob_wrap): When converting the glob array to the
returned list, suppress consecutive duplicates. This has to be
done separately for each call to glob or super_glob, so we now
interleave the production of the output list with the glob
calls. It has to be done separately because there can be
duplicates between different patterns. E.g. if (glob "?")
matches one path then (glob '("?" "?")) must return two copies
of it. Furthermore, the brace expansion implementation in
glob* produces multiple glob calls and appends their results.
Duplicates inside a single super_glob call result when there
are multiple ** (double star) patterns present, which are
matched by the same path in more than one way. If the results
are sorted, then the duplicates appear consecutively and we
will squash them. Also, a memory leak is fixed here: we
must free(pat_u8) unconditionally, before testing for the
early exit situation.
Diffstat (limited to 'eval.h')
0 files changed, 0 insertions, 0 deletions