subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1621358 - /subversion/branches/authzperf/subversion/libsvn_repos/authz.c
Date Fri, 29 Aug 2014 18:47:57 GMT
Author: stefan2
Date: Fri Aug 29 18:47:56 2014
New Revision: 1621358

URL: http://svn.apache.org/r1621358
Log:
On the authzperf branch:  Fix segfault introduced in r1618875.
We perform prefix lookups using two different types of parameters,
segments during model construction, C strings during path lookup.

* subversion/libsvn_repos/authz.c
  (compare_segment): Rename to ...
  (compare_node_rule_segment): ... this.
  (compare_node_path_segment): New variant, re-instantiating
                               the pre-r1618875 code.
  (ensure_node_in_array,
   add_prefix_matches): Use the respective correct compare function.

Modified:
    subversion/branches/authzperf/subversion/libsvn_repos/authz.c

Modified: subversion/branches/authzperf/subversion/libsvn_repos/authz.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_repos/authz.c?rev=1621358&r1=1621357&r2=1621358&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_repos/authz.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_repos/authz.c Fri Aug 29 18:47:56 2014
@@ -205,11 +205,11 @@ ensure_node(node_t **node,
 }
 
 /* compare_func comparing segment names. It takes a node_t** as VOID_LHS
- * and a const char * as VOID_RHS.
+ * and a const authz_rule_segment_t * as VOID_RHS.
  */
 static int
-compare_segment(const void *void_lhs,
-                const void *void_rhs)
+compare_node_rule_segment(const void *void_lhs,
+                          const void *void_rhs)
 {
   const node_t *node = *(const node_t **)void_lhs;
   const authz_rule_segment_t *segment = void_rhs;
@@ -217,6 +217,19 @@ compare_segment(const void *void_lhs,
   return strcmp(node->segment.data, segment->pattern.data);
 }
 
+/* compare_func comparing segment names. It takes a node_t** as VOID_LHS
+ * and a const char * as VOID_RHS.
+ */
+static int
+compare_node_path_segment(const void *void_lhs,
+                          const void *void_rhs)
+{
+  const node_t *node = *(const node_t **)void_lhs;
+  const char *segment = void_rhs;
+
+  return strcmp(node->segment.data, segment);
+}
+
 /* Make sure a node_t* for SEGMENT exists in *ARRAY and return it.
  * Auto-create either if they don't exist.  Entries in *ARRAY are
  * sorted by their segment strings.
@@ -238,7 +251,8 @@ ensure_node_in_array(apr_array_header_t 
    * Initialize IDX such that we won't attempt a hinted lookup (likely
    * to fail and therefore pure overhead). */
   idx = (*array)->nelts;
-  node_ref = svn_sort__array_lookup(*array, segment, &idx, compare_segment);
+  node_ref = svn_sort__array_lookup(*array, segment, &idx,
+                                    compare_node_rule_segment);
   if (node_ref)
     return *node_ref;
 
@@ -622,7 +636,7 @@ add_prefix_matches(lookup_state_t *state
   /* Index of the first node that might be a match.  All matches will
    * be at this and the immediately following indexes. */
   int i = svn_sort__bsearch_lower_bound(prefixes, segment->data,
-                                        compare_segment);
+                                        compare_node_path_segment);
   for (; i < prefixes->nelts; ++i)
     {
       node_t *node = APR_ARRAY_IDX(prefixes, i, node_t *);



Mime
View raw message