summaryrefslogtreecommitdiffstats
path: root/src/svnqt/client_impl.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2015-10-18 17:00:26 +0700
committerMichele Calgaro <michele.calgaro@yahoo.it>2015-10-19 21:43:07 +0700
commite6650503faaec336fca836b99763c5fd41a8ddb2 (patch)
tree412fba593b9d456c0e76cd9fcc951e4bd97608d9 /src/svnqt/client_impl.cpp
parent26944d84f6234cab2705ceb41bf2e54dfddee1c4 (diff)
downloadtdesvn-e6650503faaec336fca836b99763c5fd41a8ddb2.tar.gz
tdesvn-e6650503faaec336fca836b99763c5fd41a8ddb2.zip
Fixed FTBFS introduced by subversion 1.9. This relates to bug 2528.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit e42c18959be00a4ec623e53d7025ed13ced90adf)
Diffstat (limited to 'src/svnqt/client_impl.cpp')
-rw-r--r--src/svnqt/client_impl.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/svnqt/client_impl.cpp b/src/svnqt/client_impl.cpp
index 736afca..d138016 100644
--- a/src/svnqt/client_impl.cpp
+++ b/src/svnqt/client_impl.cpp
@@ -38,6 +38,51 @@
#include <tqmap.h>
#include <tqstringlist.h>
+
+#if (!(SVN_VER_MAJOR == 1 && SVN_VER_MINOR <= 8))
+apr_array_header_t* svn_sort__hash(apr_hash_t *ht,
+ int (*comparison_func)(const svn_sort__item_t*, const svn_sort__item_t*), apr_pool_t *pool)
+{
+ apr_hash_index_t *hi;
+ apr_array_header_t *ary;
+ svn_boolean_t sorted;
+ svn_sort_item_type *prev_item;
+
+ /* allocate an array with enough elements to hold all the keys. */
+ ary = apr_array_make(pool, apr_hash_count(ht), sizeof(svn_sort_item_type));
+
+ /* loop over hash table and push all keys into the array */
+ sorted = TRUE;
+ prev_item = NULL;
+ for (hi = apr_hash_first(pool, ht); hi; hi = apr_hash_next(hi))
+ {
+ svn_sort_item_type *item = (svn_sort_item_type*)apr_array_push(ary);
+ apr_hash_this(hi, &item->key, &item->klen, &item->value);
+
+ if (prev_item == NULL)
+ {
+ prev_item = item;
+ continue;
+ }
+
+ if (sorted)
+ {
+ sorted = (comparison_func((svn_sort__item_t*)prev_item, (svn_sort__item_t*)item) < 0);
+ prev_item = item;
+ }
+ }
+
+ /* quicksort the array if it isn't already sorted. */
+ if (!sorted)
+ {
+ qsort(ary->elts, ary->nelts, ary->elt_size,
+ (int (*)(const void*, const void*))comparison_func);
+ }
+
+ return ary;
+}
+#endif
+
namespace svn
{