You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/11/11 15:37:48 UTC
svn commit: r1713853 - in /subversion/branches/move-tracking-2/subversion:
include/ include/private/ libsvn_delta/ libsvn_ra/ libsvn_subr/ svnmover/
Author: julianfoad
Date: Wed Nov 11 14:37:47 2015
New Revision: 1713853
URL: http://svn.apache.org/viewvc?rev=1713853&view=rev
Log:
On the 'move-tracking-2' branch: Remove most of my special hash and array
iteration utilities, leaving just a few particularly useful variants.
* subversion/include/svn_iter.h,
subversion/libsvn_subr/iter.c
(svn_array_*,
svn_hash_*,
svn_iter_t,
etc.): Delete.
(svn_int_hash_get,
svn_int_hash_set,
svn_int_hash_this_key): Rename and move ...
* subversion/include/private/svn_element.h
subversion/libsvn_delta/element.c
(svn_eid_hash_get,
svn_eid_hash_set,
svn_eid_hash_this_key): ... to these.
(svn_eid__hash_iter_t,
svn_eid__hash_sorted_first,
svn_eid__hash_sorted_next,
svn_eid__hash_sort_compare_items_by_eid,
SVN_EID__HASH_ITER_SORTED,
SVN_EID__HASH_ITER_SORTED_BY_EID): New.
Update all callers to use either existing APR functions or the new
svn_eid_* functions.
Modified:
subversion/branches/move-tracking-2/subversion/include/private/svn_element.h
subversion/branches/move-tracking-2/subversion/include/svn_iter.h
subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c
subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_compat.c
subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_nested.c
subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_repos.c
subversion/branches/move-tracking-2/subversion/libsvn_delta/element.c
subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c
subversion/branches/move-tracking-2/subversion/libsvn_subr/iter.c
subversion/branches/move-tracking-2/subversion/svnmover/merge3.c
subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c
Modified: subversion/branches/move-tracking-2/subversion/include/private/svn_element.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/private/svn_element.h?rev=1713853&r1=1713852&r2=1713853&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/private/svn_element.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/private/svn_element.h Wed Nov 11 14:37:47 2015
@@ -30,6 +30,7 @@
#define SVN_ELEMENT_H
#include <apr_pools.h>
+#include <apr_tables.h>
#include "svn_types.h"
@@ -38,6 +39,71 @@ extern "C" {
#endif /* __cplusplus */
+/* ====================================================================== */
+
+/** Like apr_hash_get() but the hash key is an integer. */
+void *
+svn_eid_hash_get(apr_hash_t *ht,
+ int key);
+
+/** Like apr_hash_set() but the hash key is an integer. */
+void
+svn_eid_hash_set(apr_hash_t *ht,
+ int key,
+ const void *val);
+
+/** Like apr_hash_this_key() but the hash key is an integer. */
+int
+svn_eid_hash_this_key(apr_hash_index_t *hi);
+
+struct svn_sort__item_t;
+
+/** A hash iterator for iterating over an array or a hash table in
+ * its natural order or in sorted order.
+ *
+ * For an array, the @a i and @a val members provide the index and value
+ * of the current item.
+ */
+typedef struct svn_eid__hash_iter_t
+{
+ /* private: an array of (svn_sort__item_t) hash items for sorted iteration */
+ const apr_array_header_t *array;
+
+ /* current element: iteration order index */
+ int i;
+ /* current element: key */
+ int eid;
+ /* current element: value */
+ void *val;
+} svn_eid__hash_iter_t;
+
+svn_eid__hash_iter_t *
+svn_eid__hash_sorted_first(apr_pool_t *pool,
+ apr_hash_t *ht,
+ int (*comparison_func)(const struct svn_sort__item_t *,
+ const struct svn_sort__item_t *));
+
+svn_eid__hash_iter_t *
+svn_eid__hash_sorted_next(svn_eid__hash_iter_t *hi);
+
+/** A sort ordering callback function that returns an indication whether
+ * A sorts before or after or equal to B, by comparing their keys as EIDs.
+ */
+int
+svn_eid__hash_sort_compare_items_by_eid(const struct svn_sort__item_t *a,
+ const struct svn_sort__item_t *b);
+
+#define SVN_EID__HASH_ITER_SORTED(i, ht, comparison_func, pool) \
+ i = (void *)svn_eid__hash_sorted_first(pool, ht, comparison_func); \
+ i; \
+ i = (void *)svn_eid__hash_sorted_next((void *)i)
+
+#define SVN_EID__HASH_ITER_SORTED_BY_EID(i, ht, pool) \
+ SVN_EID__HASH_ITER_SORTED(i, ht, svn_eid__hash_sort_compare_items_by_eid, pool)
+
+
+/* ====================================================================== */
+
/** A location in a committed revision.
*
* @a rev shall not be #SVN_INVALID_REVNUM unless the interface using this
Modified: subversion/branches/move-tracking-2/subversion/include/svn_iter.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/svn_iter.h?rev=1713853&r1=1713852&r2=1713853&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/svn_iter.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/svn_iter.h Wed Nov 11 14:37:47 2015
@@ -132,294 +132,6 @@ svn_iter__break(void);
#define svn_iter_break(pool) return svn_iter__break()
-/* ====================================================================== */
-
-/** Like apr_hash_get() but the hash key is an integer. */
-void *
-svn_int_hash_get(apr_hash_t *ht,
- int key);
-
-/** Like apr_hash_set() but the hash key is an integer. */
-void
-svn_int_hash_set(apr_hash_t *ht,
- int key,
- const void *val);
-
-/** Like apr_hash_this_key() but the hash key is an integer. */
-int
-svn_int_hash_this_key(apr_hash_index_t *hi);
-
-
-/* ====================================================================== */
-
-/** A hash iterator for iterating over an array or a hash table in
- * its natural order or in sorted order.
- *
- * For an array, the @a i and @a val members provide the index and value
- * of the current item.
- *
- * For a hash table, the @c key, @c klen and @c val members provide the
- * key, key length (in bytes) and value of the current item.
- *
- * The @c iterpool member provides a managed iteration pool. It is cleared
- * at the start of each iteration and destroyed at the end of iteration.
- */
-typedef struct svn_iter_t
-{
- /* private: the original hash for unsorted hash iteration */
- apr_hash_index_t *apr_hi;
-
- /* private: the original or sorted array for array iteration, or an array
- of (svn_sort__item_t) hash items for sorted hash iteration */
- const apr_array_header_t *array;
-
- /* current element: iteration order index (array only; undefined for hash) */
- int i;
- /* current element: key (hash only; undefined for an array) */
- const char *key;
- /* current element: key length (hash only; undefined for an array) */
- apr_ssize_t klen;
- /* current element: value (array or hash) */
- void *val;
-
- /* iteration pool */
- apr_pool_t *iterpool;
-} svn_iter_t;
-
-/* Type-templated iterator.
- * ### Layout must be the same as svn_iter_t.
- */
-#define SVN_ITER_T(element_target_type) \
- struct { \
- apr_hash_index_t *apr_hi; \
- const apr_array_header_t *array; \
- int i; /* the current index into ARRAY */ \
- const char *key; \
- apr_ssize_t klen; \
- element_target_type *val; \
- apr_pool_t *iterpool; \
- }
-
-/* Type-templated iterator with pointer to 'const' elements.
- * ### Layout must be the same as svn_iter_t.
- * ### One of the main uses should be to iterate over a const collection,
- * but the iteration implementation doesn't currently distinguish const
- * from non-const collections.
- */
-#define SVN_CONST_ITER_T(element_target_type) \
- SVN_ITER_T(element_target_type const)
-
-/* ====================================================================== */
-
-/*
- * An array of pointers to objects.
- *
- * - (void *) element type
- * - an element may not be null
- * ### TODO: Allow an element to be null.
- */
-
-/** An array, assumed to be an array of pointers. */
-typedef apr_array_header_t svn_array_t;
-
-/** Return a new, empty array, allocated in @a pool. */
-svn_array_t *
-svn_array_make(apr_pool_t *pool);
-
-/** Return a new, empty array, with initial space for @a elements elements,
- * allocated in POOL. The current number of elements is set to 0.
- *
- * @note This is for performance optimization.
- */
-svn_array_t *
-svn_array_make_n(apr_pool_t *pool, int elements);
-
-/** Ensure the array has space for at least @a elements elements in total.
- * The current number of elements is unchanged.
- *
- * @note This is for performance optimization.
- */
-void
-svn_array_ensure(svn_array_t *array, int elements);
-
-/** Shallow-copy an array of pointers to simple objects.
- *
- * Return a duplicate in @a pool of the array @a array of pointers.
- * Do not duplicate the pointed-to objects.
- */
-apr_array_header_t *
-svn_array_dup_shallow(const apr_array_header_t *array,
- apr_pool_t *pool);
-
-/** Deep-copy an array of pointers to simple objects.
- *
- * Return a duplicate in @a pool of the array @a array of pointers to
- * objects of size @a object_size bytes. Duplicate each object bytewise.
- */
-apr_array_header_t *
-svn_array_dup_simple(const apr_array_header_t *array,
- size_t object_size,
- apr_pool_t *pool);
-
-/** Deep-copy an array of pointers to simple objects.
- *
- * Return a duplicate in @a pool of the array @a array of pointers to
- * objects of type @a element_type. Duplicate each object bytewise.
- */
-#define SVN_ARRAY_DUP_SIMPLE(array, element_type, pool) \
- svn_array_dup_simple(array, sizeof(element_type), pool)
-
-/** Deep-copy an array of pointers to compound objects.
- *
- * Return a duplicate in @a pool of the array @a array of pointers to
- * compound objects. Use @a element_dup_func to duplicate each element.
- *
- * ### A more efficient version could be offered, taking a "copy
- * constructor" rather than a "dup" function for the elements,
- * and using a hybrid of this implementation and the
- * svn_array_dup_simple() implementation. (A copy constructor
- * constructs a copy at a specified address.)
- */
-apr_array_header_t *
-svn_array_dup_compound(const apr_array_header_t *array,
- void *(*element_dup_func)(const void *, apr_pool_t *),
- apr_pool_t *pool);
-
-/** Get element number @a i in @a array. */
-void *
-svn_array_get(const svn_array_t *array,
- int i);
-
-/** Set element number @a i in @a array to @a val. */
-void
-svn_array_set(svn_array_t *array,
- int i,
- const void *val);
-
-/* These pop/push macros are intended to be similar to the APR ones. */
-#define svn_array_pop(array) ((void **)apr_array_pop(array))
-#define svn_array_push(array) ((const void **)apr_array_push(array))
-#define SVN_ARRAY_PUSH(array) (*(svn_array_push(array)))
-
-/** Start iterating over the array @a array, in arbitrary order.
- *
- * Return an iterator, or null if there are no items in @a array.
- */
-svn_iter_t *
-svn_array__first(apr_pool_t *pool,
- const svn_array_t *array);
-
-/** Start iterating over the array @a array, in sorted order according to
- * @a comparison_func. Return a pointer to the first element, or NULL if
- * there are no elements.
- *
- * It is permissible to change the original array @a array during the
- * iteration. Doing so will not affect the sequence of elements returned
- * by svn_array__next(), as svn_array__sorted_first() takes a snapshot of
- * pointers to the original elements. The memory in which the
- * original elements of @a array are stored must remain available during
- * the iteration.
- */
-svn_iter_t *
-svn_array__sorted_first(apr_pool_t *pool,
- const svn_array_t *array,
- int (*comparison_func)(const void *,
- const void *));
-
-/** Return a pointer to the next element of the array being iterated by
- * @a i, or NULL if there are no more elements.
- */
-svn_iter_t *
-svn_array__next(svn_iter_t *i);
-
-/** Iteration over the array @a array.
- *
- * To be used in the parentheses of a for() loop.
- * @a i is the iterator variable declared with "SVN_[CONST_]ITER_T(type) *i;".
- */
-#define SVN_ARRAY_ITER(i, array, pool) \
- i = (void *)svn_array__first(pool, array); \
- i; \
- i = (void *)svn_array__next((void *)i)
-
-/** Like SVN_ARRAY_ITER but using the array's own pool. */
-#define SVN_ARRAY_ITER_NO_POOL(i, array) \
- SVN_ARRAY_ITER(i, array, (array)->pool)
-
-/** Like SVN_ARRAY_ITER but iterating over a copy of the array sorted by
- * @a comparison_func. */
-#define SVN_ARRAY_ITER_SORTED(i, array, comparison_func, pool) \
- i = (void *)svn_array__sorted_first(pool, array, comparison_func); \
- i; \
- i = (void *)svn_array__next((void *)i)
-
-/** Like SVN_ARRAY_SORTED but using the array's own pool. */
-#define SVN_ARRAY_ITER_SORTED_NO_POOL(i, array, comparison_func) \
- SVN_ARRAY_ITER_SORTED(i, array, comparison_func, (array)->pool)
-
-/* ====================================================================== */
-
-/*
- * A hash table in which:
- * - keys are assumed to be null-terminated (const char *) strings
- * - iteration in sorted order is possible
- * - an iteration pool is provided
- */
-
-struct svn_sort__item_t;
-
-/** Start iterating over the hash table @a ht, in arbitrary order.
- *
- * Similar to apr_hash_first().
- */
-svn_iter_t *
-svn_hash__first(apr_pool_t *pool,
- apr_hash_t *ht);
-
-/** Start iterating over the hash table @a ht, in sorted order according to
- * @a comparison_func. Return a pointer to the first element, or NULL if
- * there are no elements.
- *
- * It is permissible to change the original hash table @a ht during the
- * iteration. Doing so will not affect the sequence of elements returned
- * by svn_hash__next(), as svn_hash__sorted_first() takes a snapshot of
- * pointers to the original keys and values. The memory in which the
- * original keys and values of HT are stored must remain available during
- * the iteration.
- */
-svn_iter_t *
-svn_hash__sorted_first(apr_pool_t *pool,
- apr_hash_t *ht,
- int (*comparison_func)(const struct svn_sort__item_t *,
- const struct svn_sort__item_t *));
-
-/** Return a pointer to the next element of the hash table being iterated by
- * @a hi, or NULL if there are no more elements.
- */
-svn_iter_t *
-svn_hash__next(svn_iter_t *hi);
-
-/* Type-templated iteration.
- * To be used in the parentheses of a for() loop.
- * I is the iterator variable declared with "SVN_[CONST_]ITER_T(type) *i;".
- */
-#define SVN_HASH_ITER(i, pool, ht) \
- i = (void *)svn_hash__first(pool, ht); \
- i; \
- i = (void *)svn_hash__next((void *)i)
-
-#define SVN_HASH_ITER_NO_POOL(i, ht) \
- SVN_HASH_ITER(i, apr_hash_pool_get(ht), ht)
-
-#define SVN_HASH_ITER_SORTED(i, ht, comparison_func, pool) \
- i = (void *)svn_hash__sorted_first(pool, ht, comparison_func); \
- i; \
- i = (void *)svn_hash__next((void *)i)
-
-#define SVN_HASH_ITER_SORTED_NO_POOL(i, ht, comparison_func) \
- SVN_HASH_ITER_SORTED(i, ht, comparison_func, apr_hash_pool_get(ht))
-
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c?rev=1713853&r1=1713852&r2=1713853&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c Wed Nov 11 14:37:47 2015
@@ -147,7 +147,7 @@ branch_txn_add_branch(svn_branch_txn_t *
svn_branch_state_t *branch,
apr_pool_t *scratch_pool)
{
- SVN_ARRAY_PUSH(txn->priv->branches) = branch;
+ APR_ARRAY_PUSH(txn->priv->branches, void *) = branch;
return SVN_NO_ERROR;
}
@@ -167,7 +167,7 @@ branch_txn_add_new_branch(svn_branch_txn
new_branch = branch_state_create(bid, predecessor, root_eid, txn,
txn->priv->branches->pool);
- SVN_ARRAY_PUSH(txn->priv->branches) = new_branch;
+ APR_ARRAY_PUSH(txn->priv->branches, void *) = new_branch;
return new_branch;
}
@@ -178,17 +178,17 @@ branch_txn_delete_branch(svn_branch_txn_
const char *bid,
apr_pool_t *scratch_pool)
{
- SVN_ITER_T(svn_branch_state_t) *bi;
+ int i;
- for (SVN_ARRAY_ITER(bi, txn->priv->branches, scratch_pool))
+ for (i = 0; i < txn->priv->branches->nelts; i++)
{
- svn_branch_state_t *b = bi->val;
+ svn_branch_state_t *b = APR_ARRAY_IDX(txn->priv->branches, i, void *);
if (strcmp(b->bid, bid) == 0)
{
SVN_DBG(("deleting branch b%s e%d",
bid, b->priv->element_tree->root_eid));
- svn_sort__array_delete(txn->priv->branches, bi->i, 1);
+ svn_sort__array_delete(txn->priv->branches, i, 1);
break;
}
}
@@ -569,7 +569,7 @@ branch_finalize_eids(svn_branch_state_t
for (hi = apr_hash_first(scratch_pool, branch->priv->element_tree->e_map);
hi; hi = apr_hash_next(hi))
{
- int old_eid = svn_int_hash_this_key(hi);
+ int old_eid = svn_eid_hash_this_key(hi);
svn_element_content_t *element = apr_hash_this_val(hi);
if (old_eid < -1)
@@ -627,7 +627,7 @@ branch_txn_serialize(svn_branch_txn_t *t
apr_pool_t *scratch_pool)
{
apr_array_header_t *branches = branch_txn_get_branches(txn, scratch_pool);
- SVN_ITER_T(svn_branch_state_t) *bi;
+ int i;
SVN_ERR(svn_stream_printf(stream, scratch_pool,
"r%ld: eids %d %d "
@@ -636,16 +636,16 @@ branch_txn_serialize(svn_branch_txn_t *t
txn->priv->first_eid, txn->priv->next_eid,
branches->nelts));
- for (SVN_ARRAY_ITER(bi, branches, scratch_pool))
+ for (i = 0; i < branches->nelts; i++)
{
- svn_branch_state_t *branch = bi->val;
+ svn_branch_state_t *branch = APR_ARRAY_IDX(branches, i, void *);
if (branch->predecessor && branch->predecessor->rev < 0)
{
branch->predecessor->rev = txn->rev;
}
- SVN_ERR(svn_branch_state_serialize(stream, bi->val, bi->iterpool));
+ SVN_ERR(svn_branch_state_serialize(stream, branch, scratch_pool));
}
return SVN_NO_ERROR;
}
@@ -660,12 +660,12 @@ svn_branch_txn_get_branch_by_id(const sv
apr_pool_t *scratch_pool)
{
apr_array_header_t *branches = svn_branch_txn_get_branches(txn, scratch_pool);
- SVN_ITER_T(svn_branch_state_t) *bi;
+ int i;
svn_branch_state_t *branch = NULL;
- for (SVN_ARRAY_ITER(bi, branches, scratch_pool))
+ for (i = 0; i < branches->nelts; i++)
{
- svn_branch_state_t *b = bi->val;
+ svn_branch_state_t *b = APR_ARRAY_IDX(branches, i, void *);
if (strcmp(svn_branch_get_id(b, scratch_pool), branch_id) == 0)
{
@@ -713,7 +713,7 @@ branch_txn_create(svn_branch_repos_t *re
txn->repos = repos;
txn->rev = rev;
txn->base_rev = base_rev;
- txn->priv->branches = svn_array_make(result_pool);
+ txn->priv->branches = apr_array_make(result_pool, 0, sizeof(void *));
return txn;
}
@@ -743,7 +743,7 @@ assert_branch_state_invariants(const svn
for (hi = apr_hash_first(scratch_pool, branch->priv->element_tree->e_map);
hi; hi = apr_hash_next(hi))
{
- branch_validate_element(branch, svn_int_hash_this_key(hi),
+ branch_validate_element(branch, svn_eid_hash_this_key(hi),
apr_hash_this_val(hi));
}
}
@@ -1106,7 +1106,7 @@ svn_branch_get_eid_by_path(const svn_bra
for (hi = apr_hash_first(scratch_pool, elements->e_map);
hi; hi = apr_hash_next(hi))
{
- int eid = svn_int_hash_this_key(hi);
+ int eid = svn_eid_hash_this_key(hi);
const char *this_path = svn_element_tree_get_path_by_eid(elements, eid,
scratch_pool);
@@ -1164,7 +1164,7 @@ svn_branch_map_add_subtree(svn_branch_st
for (hi = apr_hash_first(scratch_pool, new_subtree->e_map);
hi; hi = apr_hash_next(hi))
{
- int this_from_eid = svn_int_hash_this_key(hi);
+ int this_from_eid = svn_eid_hash_this_key(hi);
svn_element_content_t *from_element = apr_hash_this_val(hi);
if (from_element->parent_eid == new_subtree->root_eid)
@@ -1200,7 +1200,7 @@ branch_instantiate_elements(svn_branch_s
for (hi = apr_hash_first(scratch_pool, elements->e_map);
hi; hi = apr_hash_next(hi))
{
- int this_eid = svn_int_hash_this_key(hi);
+ int this_eid = svn_eid_hash_this_key(hi);
svn_element_content_t *this_element = apr_hash_this_val(hi);
branch_map_set(to_branch, this_eid,
@@ -1564,17 +1564,6 @@ svn_branch_txn_parse(svn_branch_txn_t **
return SVN_NO_ERROR;
}
-/* ### Duplicated in svnmover.c. */
-static int
-sort_compare_items_by_eid(const svn_sort__item_t *a,
- const svn_sort__item_t *b)
-{
- int eid_a = *(const int *)a->key;
- int eid_b = *(const int *)b->key;
-
- return eid_a - eid_b;
-}
-
/* Write to STREAM a parseable representation of BRANCH.
*/
svn_error_t *
@@ -1582,8 +1571,8 @@ svn_branch_state_serialize(svn_stream_t
svn_branch_state_t *branch,
apr_pool_t *scratch_pool)
{
- SVN_ITER_T(svn_element_content_t) *hi;
const char *predecessor_str = "";
+ svn_eid__hash_iter_t *ei;
SVN_ERR_ASSERT(branch->priv->is_flat);
@@ -1602,10 +1591,10 @@ svn_branch_state_serialize(svn_stream_t
apr_hash_count(branch->priv->element_tree->e_map),
predecessor_str));
- for (SVN_HASH_ITER_SORTED(hi, branch->priv->element_tree->e_map,
- sort_compare_items_by_eid, scratch_pool))
+ for (SVN_EID__HASH_ITER_SORTED_BY_EID(ei, branch->priv->element_tree->e_map,
+ scratch_pool))
{
- int eid = *(const int *)hi->key;
+ int eid = ei->eid;
svn_element_content_t *element = branch_get_element(branch, eid);
int parent_eid;
const char *name;
Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_compat.c?rev=1713853&r1=1713852&r2=1713853&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_compat.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_compat.c Wed Nov 11 14:37:47 2015
@@ -564,13 +564,13 @@ static const apr_array_header_t *
get_unsorted_paths(apr_hash_t *changes,
apr_pool_t *scratch_pool)
{
- svn_array_t *paths = svn_array_make(scratch_pool);
+ apr_array_header_t *paths = apr_array_make(scratch_pool, 0, sizeof(void *));
apr_hash_index_t *hi;
for (hi = apr_hash_first(scratch_pool, changes); hi; hi = apr_hash_next(hi))
{
const char *this_path = apr_hash_this_key(hi);
- SVN_ARRAY_PUSH(paths) = this_path;
+ APR_ARRAY_PUSH(paths, const char *) = this_path;
}
return paths;
@@ -1199,7 +1199,7 @@ convert_branch_to_paths_r(apr_hash_t *pa
apr_pool_t *scratch_pool)
{
apr_array_header_t *subbranches;
- SVN_ITER_T(svn_branch_state_t) *bi;
+ int i;
/*SVN_DBG(("[%d] branch={b%s e%d at '%s'}", idx,
svn_branch_get_id(branch, scratch_pool), branch->root_eid,
@@ -1210,10 +1210,12 @@ convert_branch_to_paths_r(apr_hash_t *pa
SVN_ERR(svn_branch_get_immediate_subbranches(branch, &subbranches,
scratch_pool, scratch_pool));
/* Rercurse into sub-branches */
- for (SVN_ARRAY_ITER(bi, subbranches, scratch_pool))
+ for (i = 0; i < subbranches->nelts; i++)
{
- SVN_ERR(convert_branch_to_paths_r(paths_union, bi->val, result_pool,
- bi->iterpool));
+ svn_branch_state_t *b = APR_ARRAY_IDX(subbranches, i, void *);
+
+ SVN_ERR(convert_branch_to_paths_r(paths_union, b, result_pool,
+ scratch_pool));
}
return SVN_NO_ERROR;
}
Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_nested.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_nested.c?rev=1713853&r1=1713852&r2=1713853&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_nested.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_nested.c Wed Nov 11 14:37:47 2015
@@ -126,7 +126,8 @@ svn_branch_get_immediate_subbranches(svn
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- svn_array_t *subbranches = svn_array_make(result_pool);
+ apr_array_header_t *subbranches
+ = apr_array_make(result_pool, 0, sizeof(void *));
const char *branch_id = svn_branch_get_id(branch, scratch_pool);
svn_element_tree_t *elements;
apr_hash_index_t *hi;
@@ -135,7 +136,7 @@ svn_branch_get_immediate_subbranches(svn
for (hi = apr_hash_first(scratch_pool, elements->e_map);
hi; hi = apr_hash_next(hi))
{
- int eid = svn_int_hash_this_key(hi);
+ int eid = svn_eid_hash_this_key(hi);
svn_element_content_t *element = apr_hash_this_val(hi);
if (element->payload->is_subbranch_root)
@@ -147,7 +148,7 @@ svn_branch_get_immediate_subbranches(svn
scratch_pool);
SVN_ERR_ASSERT_NO_RETURN(subbranch);
- SVN_ARRAY_PUSH(subbranches) = subbranch;
+ APR_ARRAY_PUSH(subbranches, void *) = subbranch;
}
}
*subbranches_p = subbranches;
@@ -175,7 +176,8 @@ svn_branch_get_subtree(svn_branch_state_
svn_element_tree_t *element_tree;
svn_branch_subtree_t *new_subtree;
apr_array_header_t *subbranches;
- SVN_ITER_T(svn_branch_state_t) *bi;
+ int i;
+ apr_pool_t *iterpool = result_pool; /* ### not a proper iterpool */
SVN_ERR(svn_branch_state_get_elements(branch, &element_tree, result_pool));
element_tree = svn_element_tree_get_subtree_at_eid(element_tree, eid,
@@ -188,18 +190,18 @@ svn_branch_get_subtree(svn_branch_state_
/* Add subbranches */
SVN_ERR(svn_branch_get_immediate_subbranches(branch, &subbranches,
result_pool, result_pool));
- for (SVN_ARRAY_ITER(bi, subbranches, result_pool))
+ for (i = 0; i < subbranches->nelts; i++)
{
- svn_branch_state_t *subbranch = bi->val;
+ svn_branch_state_t *subbranch = APR_ARRAY_IDX(subbranches, i, void *);
const char *outer_bid;
int outer_eid;
const char *subbranch_relpath_in_subtree;
svn_branch_id_unnest(&outer_bid, &outer_eid, subbranch->bid,
- bi->iterpool);
+ iterpool);
subbranch_relpath_in_subtree
= svn_element_tree_get_path_by_eid(new_subtree->tree, outer_eid,
- bi->iterpool);
+ iterpool);
/* Is it pathwise at or below EID? If so, add it into the subtree. */
if (subbranch_relpath_in_subtree)
@@ -209,7 +211,7 @@ svn_branch_get_subtree(svn_branch_state_
SVN_ERR(svn_branch_get_subtree(subbranch, &this_subtree,
svn_branch_root_eid(subbranch),
result_pool));
- svn_int_hash_set(new_subtree->subbranches, outer_eid,
+ svn_eid_hash_set(new_subtree->subbranches, outer_eid,
this_subtree);
}
}
@@ -222,7 +224,7 @@ svn_branch_subtree_get_subbranch_at_eid(
int eid,
apr_pool_t *result_pool)
{
- subtree = svn_int_hash_get(subtree->subbranches, eid);
+ subtree = svn_eid_hash_get(subtree->subbranches, eid);
return subtree;
}
@@ -239,7 +241,7 @@ branch_instantiate_elements(svn_branch_s
for (hi = apr_hash_first(scratch_pool, elements->e_map);
hi; hi = apr_hash_next(hi))
{
- int this_eid = svn_int_hash_this_key(hi);
+ int this_eid = svn_eid_hash_this_key(hi);
svn_element_content_t *this_element = apr_hash_this_val(hi);
svn_branch_state_alter_one(to_branch, this_eid,
@@ -262,26 +264,27 @@ svn_branch_instantiate_elements_r(svn_br
/* branch any subbranches */
{
- SVN_ITER_T(svn_branch_subtree_t) *bi;
+ apr_hash_index_t *hi;
- for (SVN_HASH_ITER(bi, scratch_pool, elements.subbranches))
+ for (hi = apr_hash_first(scratch_pool, elements.subbranches);
+ hi; hi = apr_hash_next(hi))
{
- int this_outer_eid = svn_int_hash_this_key(bi->apr_hi);
- svn_branch_subtree_t *this_subtree = bi->val;
+ int this_outer_eid = svn_eid_hash_this_key(hi);
+ svn_branch_subtree_t *this_subtree = apr_hash_this_val(hi);
const char *new_branch_id;
svn_branch_state_t *new_branch;
/* branch this subbranch into NEW_BRANCH (recursing) */
new_branch_id = svn_branch_id_nest(to_branch->bid, this_outer_eid,
- bi->iterpool);
+ scratch_pool);
new_branch = svn_branch_txn_add_new_branch(to_branch->txn,
new_branch_id,
this_subtree->predecessor,
this_subtree->tree->root_eid,
- bi->iterpool);
+ scratch_pool);
SVN_ERR(svn_branch_instantiate_elements_r(new_branch, *this_subtree,
- bi->iterpool));
+ scratch_pool));
}
}
@@ -305,14 +308,14 @@ svn_branch_find_nested_branch_element_by
while (TRUE)
{
apr_array_header_t *subbranches;
- SVN_ITER_T(svn_branch_state_t) *bi;
+ int i;
svn_boolean_t found = FALSE;
SVN_ERR(svn_branch_get_immediate_subbranches(root_branch, &subbranches,
scratch_pool, scratch_pool));
- for (SVN_ARRAY_ITER(bi, subbranches, scratch_pool))
+ for (i = 0; i < subbranches->nelts; i++)
{
- svn_branch_state_t *subbranch = bi->val;
+ svn_branch_state_t *subbranch = APR_ARRAY_IDX(subbranches, i, void *);
svn_branch_state_t *outer_branch;
int outer_eid;
const char *relpath_to_subbranch;
Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_repos.c?rev=1713853&r1=1713852&r2=1713853&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_repos.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/branch_repos.c Wed Nov 11 14:37:47 2015
@@ -49,7 +49,7 @@ svn_branch_repos_create(apr_pool_t *resu
{
svn_branch_repos_t *repos = apr_pcalloc(result_pool, sizeof(*repos));
- repos->rev_roots = svn_array_make(result_pool);
+ repos->rev_roots = apr_array_make(result_pool, 0, sizeof(void *));
repos->pool = result_pool;
return repos;
}
@@ -68,7 +68,7 @@ svn_branch_repos_get_revision(const svn_
svn_revnum_t revnum)
{
assert(revnum < repos->rev_roots->nelts);
- return svn_array_get(repos->rev_roots, revnum);
+ return APR_ARRAY_IDX(repos->rev_roots, revnum, void *);
}
svn_branch_txn_t *
Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/element.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/element.c?rev=1713853&r1=1713852&r2=1713853&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/element.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/element.c Wed Nov 11 14:37:47 2015
@@ -30,11 +30,77 @@
#include "svn_props.h"
#include "svn_dirent_uri.h"
#include "svn_iter.h"
+#include "private/svn_sorts_private.h"
#include "private/svn_element.h"
#include "svn_private_config.h"
+void *
+svn_eid_hash_get(apr_hash_t *ht,
+ int key)
+{
+ return apr_hash_get(ht, &key, sizeof(key));
+}
+
+void
+svn_eid_hash_set(apr_hash_t *ht,
+ int key,
+ const void *val)
+{
+ int *id_p = apr_pmemdup(apr_hash_pool_get(ht), &key, sizeof(key));
+
+ apr_hash_set(ht, id_p, sizeof(key), val);
+}
+
+int
+svn_eid_hash_this_key(apr_hash_index_t *hi)
+{
+ return *(const int *)apr_hash_this_key(hi);
+}
+
+svn_eid__hash_iter_t *
+svn_eid__hash_sorted_first(apr_pool_t *pool,
+ apr_hash_t *ht,
+ int (*comparison_func)(const svn_sort__item_t *,
+ const svn_sort__item_t *))
+{
+ svn_eid__hash_iter_t *hi = apr_palloc(pool, sizeof(*hi));
+
+ if (apr_hash_count(ht) == 0)
+ return NULL;
+
+ hi->array = svn_sort__hash(ht, comparison_func, pool);
+ hi->i = 0;
+ hi->eid = *(int *)(APR_ARRAY_IDX(hi->array, hi->i, svn_sort__item_t).key);
+ hi->val = APR_ARRAY_IDX(hi->array, hi->i, svn_sort__item_t).value;
+ return hi;
+}
+
+svn_eid__hash_iter_t *
+svn_eid__hash_sorted_next(svn_eid__hash_iter_t *hi)
+{
+ hi->i++;
+ if (hi->i >= hi->array->nelts)
+ {
+ return NULL;
+ }
+ hi->eid = *(int *)(APR_ARRAY_IDX(hi->array, hi->i, svn_sort__item_t).key);
+ hi->val = APR_ARRAY_IDX(hi->array, hi->i, svn_sort__item_t).value;
+ return hi;
+}
+
+int
+svn_eid__hash_sort_compare_items_by_eid(const svn_sort__item_t *a,
+ const svn_sort__item_t *b)
+{
+ int eid_a = *(const int *)a->key;
+ int eid_b = *(const int *)b->key;
+
+ return eid_a - eid_b;
+}
+
+
/*
* ===================================================================
* Minor data types
@@ -332,7 +398,7 @@ svn_element_content_t *
svn_element_tree_get(const svn_element_tree_t *tree,
int eid)
{
- return svn_int_hash_get(tree->e_map, eid);
+ return svn_eid_hash_get(tree->e_map, eid);
}
svn_error_t *
@@ -340,7 +406,7 @@ svn_element_tree_set(svn_element_tree_t
int eid,
svn_element_content_t *element)
{
- svn_int_hash_set(tree->e_map, eid, element);
+ svn_eid_hash_set(tree->e_map, eid, element);
return SVN_NO_ERROR;
}
@@ -353,7 +419,7 @@ svn_element_tree_purge_orphans(apr_hash_
apr_hash_index_t *hi;
svn_boolean_t changed;
- SVN_ERR_ASSERT_NO_RETURN(svn_int_hash_get(e_map, root_eid));
+ SVN_ERR_ASSERT_NO_RETURN(svn_eid_hash_get(e_map, root_eid));
do
{
@@ -362,19 +428,19 @@ svn_element_tree_purge_orphans(apr_hash_
for (hi = apr_hash_first(scratch_pool, e_map);
hi; hi = apr_hash_next(hi))
{
- int this_eid = svn_int_hash_this_key(hi);
+ int this_eid = svn_eid_hash_this_key(hi);
svn_element_content_t *this_element = apr_hash_this_val(hi);
if (this_eid != root_eid)
{
svn_element_content_t *parent_element
- = svn_int_hash_get(e_map, this_element->parent_eid);
+ = svn_eid_hash_get(e_map, this_element->parent_eid);
/* Purge if parent is deleted */
if (! parent_element)
{
SVN_DBG(("purge orphan: e%d", this_eid));
- svn_int_hash_set(e_map, this_eid, NULL);
+ svn_eid_hash_set(e_map, this_eid, NULL);
changed = TRUE;
}
else
Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c?rev=1713853&r1=1713852&r2=1713853&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c Wed Nov 11 14:37:47 2015
@@ -735,23 +735,24 @@ txn_fetch_payloads(svn_branch_txn_t *txn
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- SVN_ITER_T(svn_branch_state_t) *bi;
+ apr_array_header_t *branches = svn_branch_txn_get_branches(txn, scratch_pool);
+ int i;
/* Read payload of each element.
(In a real implementation, of course, we'd delay this until demanded.) */
- for (SVN_ARRAY_ITER(bi, svn_branch_txn_get_branches(txn, scratch_pool),
- scratch_pool))
+ for (i = 0; i < branches->nelts; i++)
{
- svn_branch_state_t *branch = bi->val;
+ svn_branch_state_t *branch = APR_ARRAY_IDX(branches, i, void *);
svn_element_tree_t *element_tree;
- SVN_ITER_T(svn_element_content_t) *hi;
+ apr_hash_index_t *hi;
SVN_ERR(svn_branch_state_get_elements(branch, &element_tree,
scratch_pool));
- for (SVN_HASH_ITER(hi, scratch_pool, element_tree->e_map))
+ for (hi = apr_hash_first(scratch_pool, element_tree->e_map);
+ hi; hi = apr_hash_next(hi))
{
- int eid = *(const int *)hi->key;
- svn_element_content_t *element;
+ int eid = svn_eid_hash_this_key(hi);
+ svn_element_content_t *element /*= apr_hash_this_val(hi)*/;
SVN_ERR(svn_branch_state_get_element(branch, &element,
eid, scratch_pool));
Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/iter.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/iter.c?rev=1713853&r1=1713852&r2=1713853&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/iter.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/iter.c Wed Nov 11 14:37:47 2015
@@ -23,8 +23,6 @@
#include "svn_iter.h"
#include "svn_pools.h"
-#include "svn_hash.h"
-#include "private/svn_sorts_private.h"
#include "private/svn_dep_compat.h"
#include "svn_error_codes.h"
@@ -211,363 +209,3 @@ void *apr_hash_this_val(apr_hash_index_t
return val;
}
#endif
-
-
-/* ====================================================================== */
-
-void *
-svn_int_hash_get(apr_hash_t *ht,
- int key)
-{
- return apr_hash_get(ht, &key, sizeof(key));
-}
-
-void
-svn_int_hash_set(apr_hash_t *ht,
- int key,
- const void *val)
-{
- int *id_p = apr_pmemdup(apr_hash_pool_get(ht), &key, sizeof(key));
-
- apr_hash_set(ht, id_p, sizeof(key), val);
-}
-
-int
-svn_int_hash_this_key(apr_hash_index_t *hi)
-{
- return *(const int *)apr_hash_this_key(hi);
-}
-
-
-/* ====================================================================== */
-
-svn_array_t *
-svn_array_make(apr_pool_t *pool)
-{
- return apr_array_make(pool, 0, sizeof(void *));
-}
-
-svn_array_t *
-svn_array_make_n(apr_pool_t *pool, int elements)
-{
- return apr_array_make(pool, elements, sizeof(void *));
-}
-
-/* ### inefficient implementation */
-void
-svn_array_ensure(svn_array_t *array, int elements)
-{
- int old_nelts = array->nelts;
-
- while (array->nalloc < elements)
- apr_array_push(array);
- array->nelts = old_nelts;
-}
-
-apr_array_header_t *
-svn_array_dup_shallow(const apr_array_header_t *array,
- apr_pool_t *pool)
-{
- apr_array_header_t *new_array = apr_array_copy(pool, array);
-
- return new_array;
-}
-
-/* ### This implementation comes from ptr_array_dup(), a local helper
- * for svn_rangelist_dup(). */
-apr_array_header_t *
-svn_array_dup_simple(const apr_array_header_t *array,
- size_t object_size,
- apr_pool_t *pool)
-{
- apr_array_header_t *new_array = apr_array_make(pool, array->nelts,
- sizeof(void *));
-
- /* allocate target range buffer with a single operation */
- char *copy = apr_palloc(pool, object_size * array->nelts);
-
- /* for efficiency, directly address source and target reference buffers */
- void **source = (void **)(array->elts);
- void **target = (void **)(new_array->elts);
- int i;
-
- /* copy ranges iteratively and link them into the target range list */
- for (i = 0; i < array->nelts; i++)
- {
- target[i] = ©[i * object_size];
- memcpy(target[i], source[i], object_size);
- }
- new_array->nelts = array->nelts;
-
- return new_array;
-}
-
-apr_array_header_t *
-svn_array_dup_compound(const apr_array_header_t *array,
- void *(*element_dup_func)(const void *, apr_pool_t *),
- apr_pool_t *pool)
-{
- apr_array_header_t *new_array = apr_array_make(pool, array->nelts,
- sizeof(void *));
- int i;
-
- for (i = 0; i < array->nelts; i++)
- {
- svn_array_set(new_array, i,
- element_dup_func(svn_array_get(array, i), pool));
- }
- new_array->nelts = array->nelts;
-
- return new_array;
-}
-
-void *
-svn_array_get(const svn_array_t *array,
- int i)
-{
- return APR_ARRAY_IDX(array, i, void *);
-}
-
-void
-svn_array_set(svn_array_t *array,
- int i,
- const void *value)
-{
- APR_ARRAY_IDX(array, i, const void *) = value;
-}
-
-/* Clean up internal state of IT. */
-static void
-iter_cleanup(svn_iter_t *it)
-{
- if (it->iterpool)
- svn_pool_destroy(it->iterpool);
-#ifdef SVN_DEBUG
- memset(it, 0, sizeof(*it));
-#endif
-}
-
-svn_iter_t *
-svn_array__first(apr_pool_t *pool,
- const svn_array_t *array)
-{
- svn_iter_t *it;
-
- if (! array->nelts)
- return NULL;
-
- it = apr_pcalloc(pool, sizeof(*it));
- it->array = array;
- it->i = 0;
- it->val = svn_array_get(array, 0);
- it->iterpool = svn_pool_create(pool);
- return it;
-}
-
-svn_iter_t *
-svn_array__sorted_first(apr_pool_t *pool,
- const svn_array_t *array,
- int (*comparison_func)(const void *,
- const void *))
-{
- svn_array_t *new_array = svn_array_dup_shallow(array, pool);
-
- svn_sort__array(new_array, comparison_func);
- return svn_array__first(pool, new_array);
-}
-
-svn_iter_t *
-svn_array__next(svn_iter_t *it)
-{
- it->i++;
- if (it->i >= it->array->nelts)
- {
- iter_cleanup(it);
- return NULL;
- }
-
- it->val = svn_array_get(it->array, it->i);
- svn_pool_clear(it->iterpool);
- return it;
-}
-
-
-/* ====================================================================== */
-
-/* Exercise the svn_array API. */
-
-static void *test_dup_cstring(const void *s, apr_pool_t *pool)
-{
- return apr_pstrdup(pool, s);
-}
-
-static void
-test_array(apr_pool_t *pool)
-{
- svn_array_t *a = svn_array_make(pool);
- const char *str;
- const svn_array_t *b;
-
- /* get and set and push */
- SVN_ARRAY_PUSH(a) = "hello";
- str = svn_array_get(a, 0);
- svn_array_set(a, 1, str);
- SVN_ARRAY_PUSH(a) = str;
-
- /* duplication */
- b = svn_array_dup_shallow(a, pool);
- b = SVN_ARRAY_DUP_SIMPLE(b, char *, pool);
- b = svn_array_dup_compound(b, test_dup_cstring, pool);
-
- /* iteration with svn_array__[sorted_]first() */
- {
- svn_iter_t *i;
-
- for (i = svn_array__first(pool, a); i; i = svn_array__next(i))
- printf("%s", (char *)i->val);
- for (i = svn_array__sorted_first(pool, b, svn_sort_compare_paths);
- i; i = svn_array__next(i))
- printf("%s", (char *)i->val);
- }
-
- /* iteration, typed, with SVN_ARRAY_ITER[_SORTED]() */
- {
- SVN_ITER_T(char) *ia;
- SVN_CONST_ITER_T(char) *ib;
-
- for (SVN_ARRAY_ITER(ia, a, pool))
- printf("%s", ia->val);
- for (SVN_ARRAY_ITER_SORTED(ib, b, svn_sort_compare_paths, pool))
- printf("%s", ib->val);
- }
-}
-
-
-/* ====================================================================== */
-
-svn_iter_t *
-svn_hash__first(apr_pool_t *pool,
- apr_hash_t *ht)
-{
- svn_iter_t *hi = apr_pcalloc(pool, sizeof(*hi));
-
- hi->array = NULL;
-
- hi->apr_hi = apr_hash_first(pool, ht);
- if (! hi->apr_hi)
- return NULL;
-
- apr_hash_this(hi->apr_hi, (const void **)&hi->key, &hi->klen, &hi->val);
- hi->iterpool = svn_pool_create(pool);
- return hi;
-}
-
-svn_iter_t *
-svn_hash__sorted_first(apr_pool_t *pool,
- apr_hash_t *ht,
- int (*comparison_func)(const svn_sort__item_t *,
- const svn_sort__item_t *))
-{
- svn_iter_t *hi = apr_palloc(pool, sizeof(*hi));
-
- hi->apr_hi = NULL;
-
- if (apr_hash_count(ht) == 0)
- return NULL;
-
- hi->array = svn_sort__hash(ht, comparison_func, pool);
- hi->i = 0;
- hi->key = APR_ARRAY_IDX(hi->array, hi->i, svn_sort__item_t).key;
- hi->klen = APR_ARRAY_IDX(hi->array, hi->i, svn_sort__item_t).klen;
- hi->val = APR_ARRAY_IDX(hi->array, hi->i, svn_sort__item_t).value;
- hi->iterpool = svn_pool_create(pool);
- return hi;
-}
-
-svn_iter_t *
-svn_hash__next(svn_iter_t *hi)
-{
- if (hi->apr_hi) /* is an unsorted iterator */
- {
- hi->apr_hi = apr_hash_next(hi->apr_hi);
- if (! hi->apr_hi)
- {
- iter_cleanup(hi);
- return NULL;
- }
- apr_hash_this(hi->apr_hi, (const void **)&hi->key, &hi->klen, &hi->val);
- }
-
- if (hi->array) /* is a sorted iterator */
- {
- hi->i++;
- if (hi->i >= hi->array->nelts)
- {
- iter_cleanup(hi);
- return NULL;
- }
- hi->key = APR_ARRAY_IDX(hi->array, hi->i, svn_sort__item_t).key;
- hi->klen = APR_ARRAY_IDX(hi->array, hi->i, svn_sort__item_t).klen;
- hi->val = APR_ARRAY_IDX(hi->array, hi->i, svn_sort__item_t).value;
- }
-
- svn_pool_clear(hi->iterpool);
- return hi;
-}
-
-
-/* ====================================================================== */
-
-/* Exercise the svn_hash API. */
-static void
-test_hash(apr_pool_t *pool)
-{
- apr_hash_t *hash = apr_hash_make(pool);
- svn_iter_t *hi;
- SVN_ITER_T(const char) *it;
-
- svn_hash_sets(hash, "K1", "V1");
- svn_hash_sets(hash, "Key2", "Value2");
- svn_hash_sets(hash, "Key three", "Value three");
- svn_hash_sets(hash, "Fourth key", "Fourth value");
-
- printf("Hash iteration, unsorted:");
- for (hi = svn_hash__first(pool, hash); hi; hi = svn_hash__next(hi))
- {
- const char *k = apr_psprintf(hi->iterpool, "[%s]", hi->key);
- apr_ssize_t l = hi->klen;
- const char *v = hi->val;
-
- printf(" key[%d]: %-20s val: %s\n", (int)l, k, v);
- }
-
- printf("Hash iteration, sorted:");
- for (hi = svn_hash__sorted_first(pool, hash, svn_sort_compare_items_lexically);
- hi; hi = svn_hash__next(hi))
- {
- const char *k = apr_psprintf(hi->iterpool, "[%s]", hi->key);
- apr_ssize_t l = hi->klen;
- const char *v = hi->val;
-
- printf(" key[%d]: %-20s val: %s\n", (int)l, k, v);
- }
-
- printf("Hash iteration, typed, unsorted:");
- for (SVN_HASH_ITER(it, pool, hash))
- {
- printf(" key[%d]: %-20s val: %s\n",
- (int)it->klen,
- apr_psprintf(it->iterpool, "[%s]", it->key),
- it->val);
- }
-
- printf("Hash iteration, typed, sorted:");
- for (SVN_HASH_ITER_SORTED(it, hash, svn_sort_compare_items_lexically, pool))
- {
- printf(" key[%d]: %-20s val: %s\n",
- (int)it->klen,
- apr_psprintf(it->iterpool, "[%s]", it->key),
- it->val);
- }
-
-}
Modified: subversion/branches/move-tracking-2/subversion/svnmover/merge3.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnmover/merge3.c?rev=1713853&r1=1713852&r2=1713853&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/merge3.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/merge3.c Wed Nov 11 14:37:47 2015
@@ -47,18 +47,6 @@
#include "svn_private_config.h"
-/* */
-static int
-sort_compare_items_by_eid(const svn_sort__item_t *a,
- const svn_sort__item_t *b)
-{
- int eid_a = *(const int *)a->key;
- int eid_b = *(const int *)b->key;
-
- return eid_a - eid_b;
-}
-
-
/* ====================================================================== */
/* Return (left, right) pairs of element content that differ between
@@ -74,17 +62,18 @@ element_differences(apr_hash_t **diff_p,
apr_pool_t *scratch_pool)
{
apr_hash_t *diff = apr_hash_make(result_pool);
- SVN_ITER_T(int) *hi;
+ apr_hash_index_t *hi;
/*SVN_DBG(("svn_branch_subtree_differences(b%s r%ld, b%s r%ld, e%d)",
svn_branch_get_id(left->branch, scratch_pool), left->rev,
svn_branch_get_id(right->branch, scratch_pool), right->rev,
right->eid));*/
- for (SVN_HASH_ITER(hi, scratch_pool,
- hash_overlay(left->e_map, right->e_map)))
+ for (hi = apr_hash_first(scratch_pool,
+ hash_overlay(left->e_map, right->e_map));
+ hi; hi = apr_hash_next(hi))
{
- int e = svn_int_hash_this_key(hi->apr_hi);
+ int e = svn_eid_hash_this_key(hi);
svn_element_content_t *element_left
= svn_element_tree_get(left, e);
svn_element_content_t *element_right
@@ -98,7 +87,7 @@ element_differences(apr_hash_t **diff_p,
contents[0] = element_left;
contents[1] = element_right;
- svn_int_hash_set(diff, e, contents);
+ svn_eid_hash_set(diff, e, contents);
}
}
@@ -255,7 +244,7 @@ name_clash_conflict_str(name_clash_confl
for (hi2 = apr_hash_first(result_pool, c->elements);
hi2; hi2 = apr_hash_next(hi2))
{
- int eid = svn_int_hash_this_key(hi2);
+ int eid = svn_eid_hash_this_key(hi2);
apr_psprintf(result_pool, "%s\n element %d", s, eid);
}
@@ -290,7 +279,7 @@ cycle_conflict_str(cycle_conflict_t *c,
for (hi2 = apr_hash_first(result_pool, c->elements);
hi2; hi2 = apr_hash_next(hi2))
{
- int eid2 = svn_int_hash_this_key(hi2);
+ int eid2 = svn_eid_hash_this_key(hi2);
s = apr_psprintf(result_pool, "%s e%d", s, eid2);
}
@@ -349,7 +338,7 @@ svnmover_display_conflicts(conflict_stor
conflict_storage->single_element_conflicts);
hi; hi = apr_hash_next(hi))
{
- int eid = svn_int_hash_this_key(hi);
+ int eid = svn_eid_hash_this_key(hi);
element_merge3_conflict_t *c = apr_hash_this_val(hi);
svnmover_notify(" %s",
@@ -369,7 +358,7 @@ svnmover_display_conflicts(conflict_stor
conflict_storage->cycle_conflicts);
hi; hi = apr_hash_next(hi))
{
- int eid = svn_int_hash_this_key(hi);
+ int eid = svn_eid_hash_this_key(hi);
cycle_conflict_t *c = apr_hash_this_val(hi);
svnmover_notify(" %s",
@@ -379,7 +368,7 @@ svnmover_display_conflicts(conflict_stor
conflict_storage->orphan_conflicts);
hi; hi = apr_hash_next(hi))
{
- int eid = svn_int_hash_this_key(hi);
+ int eid = svn_eid_hash_this_key(hi);
orphan_conflict_t *c = apr_hash_this_val(hi);
svnmover_notify(" %s",
@@ -441,21 +430,21 @@ find_conflict(conflict_object_t **confli
{
int which_eid = atoi(id_string + 1);
- if (svn_int_hash_get(conflicts->single_element_conflicts, which_eid))
+ if (svn_eid_hash_get(conflicts->single_element_conflicts, which_eid))
{
*conflict_p
= conflict_object_create(conflict_kind_single_element,
conflicts->single_element_conflicts,
&which_eid, result_pool);
}
- if (svn_int_hash_get(conflicts->cycle_conflicts, which_eid))
+ if (svn_eid_hash_get(conflicts->cycle_conflicts, which_eid))
{
*conflict_p
= conflict_object_create(conflict_kind_cycle,
conflicts->cycle_conflicts,
&which_eid, result_pool);
}
- if (svn_int_hash_get(conflicts->orphan_conflicts, which_eid))
+ if (svn_eid_hash_get(conflicts->orphan_conflicts, which_eid))
{
*conflict_p
= conflict_object_create(conflict_kind_orphan,
@@ -835,16 +824,17 @@ detect_clashes(apr_hash_t **clashes_p,
{
apr_hash_t *clashes = apr_hash_make(result_pool);
svn_element_tree_t *elements;
- SVN_ITER_T(svn_element_content_t) *pi;
+ svn_eid__hash_iter_t *ei;
int prev_eid = -1;
svn_element_content_t *prev_element = NULL;
SVN_ERR(svn_branch_state_get_elements(branch, &elements, scratch_pool));
- for (SVN_HASH_ITER_SORTED(pi, elements->e_map,
- sort_compare_items_by_peid_and_name, scratch_pool))
+ for (SVN_EID__HASH_ITER_SORTED(ei, elements->e_map,
+ sort_compare_items_by_peid_and_name,
+ scratch_pool))
{
- int eid = *(const int *)(pi->key);
- svn_element_content_t *element = pi->val;
+ int eid = ei->eid;
+ svn_element_content_t *element = ei->val;
if (prev_element
&& element->parent_eid == prev_element->parent_eid
@@ -862,8 +852,8 @@ detect_clashes(apr_hash_t **clashes_p,
result_pool);
svn_hash_sets(clashes, key, c);
}
- svn_int_hash_set(c->elements, eid, &c);
- svn_int_hash_set(c->elements, prev_eid, &c);
+ svn_eid_hash_set(c->elements, eid, &c);
+ svn_eid_hash_set(c->elements, prev_eid, &c);
}
prev_eid = eid;
prev_element = element;
@@ -886,31 +876,32 @@ detect_cycles(apr_hash_t **cycles_p,
apr_pool_t *scratch_pool)
{
apr_hash_t *cycles = apr_hash_make(result_pool);
- SVN_ITER_T(svn_element_content_t) *pi;
+ apr_hash_index_t *hi;
svn_element_tree_t *elements;
SVN_ERR(svn_branch_state_get_elements(branch, &elements, scratch_pool));
- for (SVN_HASH_ITER(pi, scratch_pool, elements->e_map))
+ for (hi = apr_hash_first(scratch_pool, elements->e_map);
+ hi; hi = apr_hash_next(hi))
{
- int eid = *(const int *)(pi->key);
- svn_element_content_t *element = pi->val;
+ int eid = svn_eid_hash_this_key(hi);
+ svn_element_content_t *element = apr_hash_this_val(hi);
cycle_conflict_t *c = cycle_conflict_create(result_pool);
- svn_int_hash_set(c->elements, eid, c);
+ svn_eid_hash_set(c->elements, eid, c);
/* See if we can trace the parentage of EID back to the branch root
without finding a cycle. If we find a cycle, store a conflict. */
for (; element && (element->parent_eid != -1);
- element = svn_int_hash_get(elements->e_map, element->parent_eid))
+ element = svn_eid_hash_get(elements->e_map, element->parent_eid))
{
/* If this parent-eid is already in the path from EID to the root,
then we have found a cycle. */
- if (svn_int_hash_get(c->elements, element->parent_eid))
+ if (svn_eid_hash_get(c->elements, element->parent_eid))
{
- svn_int_hash_set(cycles, eid, c);
+ svn_eid_hash_set(cycles, eid, c);
break;
}
- svn_int_hash_set(c->elements, element->parent_eid, c);
+ svn_eid_hash_set(c->elements, element->parent_eid, c);
}
}
@@ -927,14 +918,15 @@ detect_orphans(apr_hash_t **orphans_p,
apr_pool_t *scratch_pool)
{
apr_hash_t *orphans = apr_hash_make(result_pool);
- SVN_ITER_T(svn_element_content_t) *pi;
+ apr_hash_index_t *hi;
svn_element_tree_t *elements;
SVN_ERR(svn_branch_state_get_elements(branch, &elements, scratch_pool));
- for (SVN_HASH_ITER(pi, scratch_pool, elements->e_map))
+ for (hi = apr_hash_first(scratch_pool, elements->e_map);
+ hi; hi = apr_hash_next(hi))
{
- int eid = *(const int *)(pi->key);
- svn_element_content_t *element = pi->val;
+ int eid = svn_eid_hash_this_key(hi);
+ svn_element_content_t *element = apr_hash_this_val(hi);
if (eid != elements->root_eid
&& ! svn_element_tree_get(elements, element->parent_eid))
@@ -942,7 +934,7 @@ detect_orphans(apr_hash_t **orphans_p,
orphan_conflict_t *c;
c = orphan_conflict_create(element, result_pool);
- svn_int_hash_set(orphans, eid, c);
+ svn_eid_hash_set(orphans, eid, c);
}
}
@@ -967,9 +959,9 @@ branch_merge_subtree_r(svn_branch_txn_t
apr_hash_t *diff_yca_src, *diff_yca_tgt;
apr_hash_t *e_conflicts = apr_hash_make(result_pool);
conflict_storage_t *conflict_storage = conflict_storage_create(result_pool);
- SVN_ITER_T(svn_element_content_t *) *pi;
svn_element_tree_t *src_elements, *tgt_elements, *yca_elements;
apr_hash_t *all_elements;
+ svn_eid__hash_iter_t *ei;
const merge_conflict_policy_t policy = { TRUE, TRUE, TRUE, TRUE, TRUE };
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
@@ -1016,14 +1008,13 @@ branch_merge_subtree_r(svn_branch_txn_t
tgt_elements->e_map);
all_elements = hash_overlay(yca_elements->e_map,
all_elements);
- for (SVN_HASH_ITER_SORTED(pi, all_elements,
- sort_compare_items_by_eid, scratch_pool))
+ for (SVN_EID__HASH_ITER_SORTED_BY_EID(ei, all_elements, scratch_pool))
{
- int eid = *(const int *)(pi->key);
+ int eid = ei->eid;
svn_element_content_t **e_yca_src
- = svn_int_hash_get(diff_yca_src, eid);
+ = svn_eid_hash_get(diff_yca_src, eid);
svn_element_content_t **e_yca_tgt
- = svn_int_hash_get(diff_yca_tgt, eid);
+ = svn_eid_hash_get(diff_yca_tgt, eid);
svn_element_content_t *e_yca;
svn_element_content_t *e_src;
svn_element_content_t *e_tgt;
@@ -1058,7 +1049,7 @@ branch_merge_subtree_r(svn_branch_txn_t
if (conflict)
{
svnmover_notify_v("! e%d <conflict>", eid);
- svn_int_hash_set(e_conflicts, eid,
+ svn_eid_hash_set(e_conflicts, eid,
element_merge3_conflict_dup(conflict, result_pool));
}
else if (e_tgt && result)
Modified: subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c?rev=1713853&r1=1713852&r2=1713853&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c Wed Nov 11 14:37:47 2015
@@ -323,17 +323,18 @@ element_differences(apr_hash_t **diff_p,
apr_pool_t *scratch_pool)
{
apr_hash_t *diff = apr_hash_make(result_pool);
- SVN_ITER_T(int) *hi;
+ apr_hash_index_t *hi;
/*SVN_DBG(("svn_branch_subtree_differences(b%s r%ld, b%s r%ld, e%d)",
svn_branch_get_id(left->branch, scratch_pool), left->rev,
svn_branch_get_id(right->branch, scratch_pool), right->rev,
right->eid));*/
- for (SVN_HASH_ITER(hi, scratch_pool,
- hash_overlay(left->e_map, right->e_map)))
+ for (hi = apr_hash_first(scratch_pool,
+ hash_overlay(left->e_map, right->e_map));
+ hi; hi = apr_hash_next(hi))
{
- int e = svn_int_hash_this_key(hi->apr_hi);
+ int e = svn_eid_hash_this_key(hi);
svn_element_content_t *element_left
= svn_element_tree_get(left, e);
svn_element_content_t *element_right
@@ -347,7 +348,7 @@ element_differences(apr_hash_t **diff_p,
contents[0] = element_left;
contents[1] = element_right;
- svn_int_hash_set(diff, e, contents);
+ svn_eid_hash_set(diff, e, contents);
}
}
@@ -363,7 +364,7 @@ txn_is_changed(svn_branch_txn_t *edit_tx
svn_boolean_t *is_changed,
apr_pool_t *scratch_pool)
{
- SVN_ITER_T(svn_branch_state_t) *bi;
+ int i;
svn_branch_txn_t *base_txn
= svn_branch_repos_get_base_revision_root(edit_txn);
apr_array_header_t *edit_branches
@@ -374,9 +375,9 @@ txn_is_changed(svn_branch_txn_t *edit_tx
*is_changed = FALSE;
/* If any previous branch is now missing, that's a change. */
- for (SVN_ARRAY_ITER(bi, base_branches, scratch_pool))
+ for (i = 0; i < base_branches->nelts; i++)
{
- svn_branch_state_t *base_branch = bi->val;
+ svn_branch_state_t *base_branch = APR_ARRAY_IDX(base_branches, i, void *);
svn_branch_state_t *edit_branch
= svn_branch_txn_get_branch_by_id(edit_txn, base_branch->bid,
scratch_pool);
@@ -389,9 +390,9 @@ txn_is_changed(svn_branch_txn_t *edit_tx
}
/* If any current branch is new or changed, that's a change. */
- for (SVN_ARRAY_ITER(bi, edit_branches, scratch_pool))
+ for (i = 0; i < edit_branches->nelts; i++)
{
- svn_branch_state_t *edit_branch = bi->val;
+ svn_branch_state_t *edit_branch = APR_ARRAY_IDX(edit_branches, i, void *);
svn_branch_state_t *base_branch
= svn_branch_txn_get_branch_by_id(base_txn, edit_branch->bid,
scratch_pool);
@@ -449,7 +450,7 @@ subtree_replay(svn_branch_state_t *edit_
for (hi = apr_hash_first(scratch_pool, diff_left_right);
hi; hi = apr_hash_next(hi))
{
- int eid = svn_int_hash_this_key(hi);
+ int eid = svn_eid_hash_this_key(hi);
svn_element_content_t **e_pair = apr_hash_this_val(hi);
svn_element_content_t *e0 = e_pair[0], *e1 = e_pair[1];
@@ -564,7 +565,7 @@ svn_branch_replay(svn_branch_txn_t *edit
for (hi = apr_hash_first(scratch_pool, all_subbranches);
hi; hi = apr_hash_next(hi))
{
- int this_eid = svn_int_hash_this_key(hi);
+ int this_eid = svn_eid_hash_this_key(hi);
svn_branch_state_t *left_subbranch = NULL;
svn_branch_state_t *right_subbranch = NULL;
svn_branch_state_t *edit_subbranch = NULL;
@@ -1036,6 +1037,16 @@ branch_peid_name_to_path(svn_branch_stat
return path;
}
+/*Â */
+static int
+sort_compare_eid_mappings_by_path(const svn_sort__item_t *a,
+ const svn_sort__item_t *b)
+{
+ const char *astr = a->value, *bstr = b->value;
+
+ return svn_path_compare_paths(astr, bstr);
+}
+
/* List the elements in BRANCH, in path notation.
*
* List only the elements for which a relpath is known -- that is, elements
@@ -1045,29 +1056,27 @@ static svn_error_t *
list_branch_elements(svn_branch_state_t *branch,
apr_pool_t *scratch_pool)
{
- apr_hash_t *paths_to_eid = apr_hash_make(scratch_pool);
+ apr_hash_t *eid_to_path = apr_hash_make(scratch_pool);
svn_element_tree_t *elements;
apr_hash_index_t *hi;
- SVN_ITER_T(int) *pi;
+ svn_eid__hash_iter_t *ei;
SVN_ERR(svn_branch_state_get_elements(branch, &elements, scratch_pool));
for (hi = apr_hash_first(scratch_pool, elements->e_map);
hi; hi = apr_hash_next(hi))
{
- int eid = svn_int_hash_this_key(hi);
+ int eid = svn_eid_hash_this_key(hi);
const char *relpath = svn_branch_get_path_by_eid(branch, eid,
scratch_pool);
- if (relpath)
- {
- svn_hash_sets(paths_to_eid, relpath, apr_pmemdup(scratch_pool,
- &eid, sizeof(eid)));
- }
+ svn_eid_hash_set(eid_to_path, eid, relpath);
}
- for (SVN_HASH_ITER_SORTED(pi, paths_to_eid, svn_sort_compare_items_as_paths, scratch_pool))
+ for (SVN_EID__HASH_ITER_SORTED(ei, eid_to_path,
+ sort_compare_eid_mappings_by_path,
+ scratch_pool))
{
- const char *relpath = pi->key;
- int eid = *pi->val;
+ int eid = ei->eid;
+ const char *relpath = ei->val;
svnmover_notify(" %-20s%s",
relpath[0] ? relpath : ".",
@@ -1110,15 +1119,14 @@ list_branch_elements_by_eid(svn_branch_s
apr_pool_t *scratch_pool)
{
svn_element_tree_t *elements;
- SVN_ITER_T(svn_element_content_t) *pi;
+ svn_eid__hash_iter_t *ei;
svnmover_notify_v("%s", elements_by_eid_header);
SVN_ERR(svn_branch_state_get_elements(branch, &elements, scratch_pool));
- for (SVN_HASH_ITER_SORTED(pi, elements->e_map,
- sort_compare_items_by_eid, scratch_pool))
+ for (SVN_EID__HASH_ITER_SORTED_BY_EID(ei, elements->e_map, scratch_pool))
{
- int eid = *(const int *)(pi->key);
- svn_element_content_t *element = pi->val;
+ int eid = ei->eid;
+ svn_element_content_t *element = ei->val;
if (element)
{
@@ -1223,28 +1231,28 @@ list_branches(svn_branch_txn_t *txn,
apr_pool_t *scratch_pool)
{
const apr_array_header_t *branches;
- SVN_ITER_T(svn_branch_state_t) *bi;
+ int i;
svn_boolean_t printed_header = FALSE;
svnmover_notify_v("%s", branch_id_header_str(" ", scratch_pool));
branches = svn_branch_txn_get_branches(txn, scratch_pool);
- for (SVN_ARRAY_ITER(bi, branches, scratch_pool))
+ for (i = 0; i < branches->nelts; i++)
{
- svn_branch_state_t *branch = bi->val;
+ svn_branch_state_t *branch = APR_ARRAY_IDX(branches, i, void *);
if (svn_branch_root_eid(branch) != eid)
continue;
- SVN_ERR(list_branch(branch, with_elements, bi->iterpool));
+ SVN_ERR(list_branch(branch, with_elements, scratch_pool));
if (with_elements) /* separate branches by a blank line */
svnmover_notify("");
}
- for (SVN_ARRAY_ITER(bi, branches, scratch_pool))
+ for (i = 0; i < branches->nelts; i++)
{
- svn_branch_state_t *branch = bi->val;
+ svn_branch_state_t *branch = APR_ARRAY_IDX(branches, i, void *);
svn_element_content_t *element;
SVN_ERR(svn_branch_state_get_element(branch, &element,
@@ -1261,7 +1269,7 @@ list_branches(svn_branch_txn_t *txn,
svnmover_notify_v("branches containing but not rooted at e%d:", eid);
printed_header = TRUE;
}
- SVN_ERR(list_branch(branch, with_elements, bi->iterpool));
+ SVN_ERR(list_branch(branch, with_elements, scratch_pool));
if (with_elements) /* separate branches by a blank line */
svnmover_notify("");
}
@@ -1278,17 +1286,17 @@ list_all_branches(svn_branch_txn_t *txn,
apr_pool_t *scratch_pool)
{
const apr_array_header_t *branches;
- SVN_ITER_T(svn_branch_state_t) *bi;
+ int i;
branches = svn_branch_txn_get_branches(txn, scratch_pool);
svnmover_notify_v("branches:");
- for (SVN_ARRAY_ITER(bi, branches, scratch_pool))
+ for (i = 0; i < branches->nelts; i++)
{
- svn_branch_state_t *branch = bi->val;
+ svn_branch_state_t *branch = APR_ARRAY_IDX(branches, i, void *);
- SVN_ERR(list_branch(branch, with_elements, bi->iterpool));
+ SVN_ERR(list_branch(branch, with_elements, scratch_pool));
if (with_elements) /* separate branches by a blank line */
svnmover_notify("");
}
@@ -1407,7 +1415,7 @@ subtree_diff(apr_hash_t **diff_changes,
for (hi = apr_hash_first(scratch_pool, diff_left_right);
hi; hi = apr_hash_next(hi))
{
- int eid = svn_int_hash_this_key(hi);
+ int eid = svn_eid_hash_this_key(hi);
svn_element_content_t **e_pair = apr_hash_this_val(hi);
svn_element_content_t *e0 = e_pair[0], *e1 = e_pair[1];
@@ -1425,7 +1433,7 @@ subtree_diff(apr_hash_t **diff_changes,
item->reparented = (e0 && e1 && e0->parent_eid != e1->parent_eid);
item->renamed = (e0 && e1 && strcmp(e0->name, e1->name) != 0);
- svn_int_hash_set(*diff_changes, eid, item);
+ svn_eid_hash_set(*diff_changes, eid, item);
}
}
@@ -1477,7 +1485,7 @@ show_subtree_diff(svn_branch_subtree_t *
apr_pool_t *scratch_pool)
{
apr_hash_t *diff_changes;
- SVN_ITER_T(diff_item_t) *ai;
+ svn_eid__hash_iter_t *ei;
SVN_ERR_ASSERT(left && left->tree->root_eid != -1
&& right && right->tree->root_eid != -1);
@@ -1488,13 +1496,13 @@ show_subtree_diff(svn_branch_subtree_t *
if (header && apr_hash_count(diff_changes))
svnmover_notify("%s%s", prefix, header);
- for (SVN_HASH_ITER_SORTED(ai, diff_changes,
- (the_ui_mode == UI_MODE_EIDS)
- ? sort_compare_items_by_eid
- : diff_ordering_major_paths,
- scratch_pool))
+ for (SVN_EID__HASH_ITER_SORTED(ei, diff_changes,
+ (the_ui_mode == UI_MODE_EIDS)
+ ? sort_compare_items_by_eid
+ : diff_ordering_major_paths,
+ scratch_pool))
{
- diff_item_t *item = ai->val;
+ diff_item_t *item = ei->val;
svn_element_content_t *e0 = item->e0, *e1 = item->e1;
char status_mod = (e0 && e1) ? 'M' : e0 ? 'D' : 'A';
@@ -1503,7 +1511,7 @@ show_subtree_diff(svn_branch_subtree_t *
if (status_mod == 'D')
{
diff_item_t *parent_item
- = svn_int_hash_get(diff_changes, e0->parent_eid);
+ = svn_eid_hash_get(diff_changes, e0->parent_eid);
if (parent_item && ! parent_item->e1)
status_mod = 'd';
@@ -1645,7 +1653,7 @@ subtree_diff_r(svn_branch_subtree_t *lef
for (hi = apr_hash_first(scratch_pool, subbranches_all);
hi; hi = apr_hash_next(hi))
{
- int e = svn_int_hash_this_key(hi);
+ int e = svn_eid_hash_this_key(hi);
svn_branch_subtree_t *sub_left = NULL, *sub_right = NULL;
const char *sub_left_bid = NULL, *sub_right_bid = NULL;
const char *sub_left_rrpath = NULL, *sub_right_rrpath = NULL;