diff options
author | Russell Belfer <rb@github.com> | 2013-03-09 04:39:57 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-03-09 04:39:57 +0400 |
commit | e40f1c2d23c3758968df94a17831ec5432ae6988 (patch) | |
tree | a634eb49add884f11c576b6a956b8b9e1d87357b /src/util.h | |
parent | 9bea03ce776ed864b0556815d94d71d300ac1da3 (diff) |
Make tree iterator handle icase equivalence
There is a serious bug in the previous tree iterator implementation.
If case insensitivity resulted in member elements being equivalent
to one another, and those member elements were trees, then the
children of the colliding elements would be processed in sequence
instead of in a single flattened list. This meant that the tree
iterator was not truly acting like a case-insensitive list.
This completely reworks the tree iterator to manage lists with
case insensitive equivalence classes and advance through the items
in a unified manner in a single sorted frame.
It is possible that at a future date we might want to update this
to separate the case insensitive and case sensitive tree iterators
so that the case sensitive one could be a minimal amount of code
and the insensitive one would always know what it needed to do
without checking flags.
But there would be so much shared code between the two, that I'm
not sure it that's a win. For now, this gets what we need.
More tests are needed, though.
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h index 9dbcb6a4f..e77f17efc 100644 --- a/src/util.h +++ b/src/util.h @@ -151,6 +151,10 @@ typedef int (*git__tsort_r_cmp)(const void *a, const void *b, void *payload); extern void git__tsort_r( void **dst, size_t size, git__tsort_r_cmp cmp, void *payload); +typedef int (*git__qsort_r_cmp)(const void *a, const void *b, void *payload); + +extern void git__qsort_r( + void *els, size_t nel, size_t elsize, git__qsort_r_cmp cmp, void *payload); /** * @param position If non-NULL, this will be set to the position where the |