subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1700855 - in /subversion/trunk/subversion: include/private/svn_ra_svn_private.h libsvn_ra_svn/client.c libsvn_ra_svn/cyrus_auth.c libsvn_ra_svn/internal_auth.c libsvn_ra_svn/marshal.c svnserve/serve.c
Date Wed, 02 Sep 2015 17:40:02 GMT
Author: stefan2
Date: Wed Sep  2 17:40:02 2015
New Revision: 1700855

URL: http://svn.apache.org/r1700855
Log:
Continue work towards using a specialized list type for ra_svn items.

This introduces a typesafe access macro replacing APR_ARRAY_IDX for
svn_ra_svn__list_t.  The generated code is still the same but specifics
of the list data type are now hidden in that new macro.

* subversion/include/private/svn_ra_svn_private.h
  (SVN_RA_SVN__LIST_ITEM): Declare new macro.

* subversion/libsvn_ra_svn/client.c
  (parse_prop_diffs,
   parse_iproplist,
   ra_svn_get_dir,
   perform_ra_svn_log,
   ra_svn_get_locks): Use the new macro to access for svn_ra_svn__list_t
                      throughout the code.

* subversion/libsvn_ra_svn/cyrus_auth.c
  (svn_ra_svn__do_cyrus_auth): Same.

* subversion/libsvn_ra_svn/internal_auth.c
  (svn_ra_svn__find_mech): Same.

* subversion/libsvn_ra_svn/marshal.c
  (svn_ra_svn__to_public_array,
   svn_ra_svn__set_capabilities,
   vparse_tuple,
   svn_ra_svn__parse_proplist,
   svn_ra_svn__handle_failure_status,
   svn_ra_svn__read_string,
   svn_ra_svn__read_cstring,
   svn_ra_svn__read_word,
   svn_ra_svn__read_revision,
   svn_ra_svn__read_boolean,
   svn_ra_svn__read_list): Same.

* subversion/svnserve/serve.c
  (add_lock_tokens,
   unlock_paths,
   construct_server_baton): Same.

Modified:
    subversion/trunk/subversion/include/private/svn_ra_svn_private.h
    subversion/trunk/subversion/libsvn_ra_svn/client.c
    subversion/trunk/subversion/libsvn_ra_svn/cyrus_auth.c
    subversion/trunk/subversion/libsvn_ra_svn/internal_auth.c
    subversion/trunk/subversion/libsvn_ra_svn/marshal.c
    subversion/trunk/subversion/svnserve/serve.c

Modified: subversion/trunk/subversion/include/private/svn_ra_svn_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_ra_svn_private.h?rev=1700855&r1=1700854&r2=1700855&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_ra_svn_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_ra_svn_private.h Wed Sep  2 17:40:02 2015
@@ -37,6 +37,11 @@ extern "C" {
 /* A list of svn_ra_svn__item_t objects. */
 typedef apr_array_header_t svn_ra_svn__list_t;
 
+/* List element access macro.  This is for transitional usage only.
+ * Once svn_ra_svn__list_t is finalized, this macro will become obsolete. */
+#define SVN_RA_SVN__LIST_ITEM(list, idx) \
+  APR_ARRAY_IDX(list, idx, svn_ra_svn__item_t)
+
 /** Memory representation of an on-the-wire data item. */
 typedef struct svn_ra_svn__item_t
 {

Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/client.c?rev=1700855&r1=1700854&r2=1700855&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/client.c Wed Sep  2 17:40:02 2015
@@ -198,7 +198,7 @@ static svn_error_t *parse_prop_diffs(con
   for (i = 0; i < list->nelts; i++)
     {
       svn_prop_t *prop;
-      svn_ra_svn__item_t *elt = &APR_ARRAY_IDX(list, i, svn_ra_svn__item_t);
+      svn_ra_svn__item_t *elt = &SVN_RA_SVN__LIST_ITEM(list, i);
 
       if (elt->kind != SVN_RA_SVN_LIST)
         return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
@@ -1220,8 +1220,7 @@ parse_iproplist(apr_array_header_t **inh
       apr_hash_index_t *hi;
       svn_prop_inherited_item_t *new_iprop =
         apr_palloc(result_pool, sizeof(*new_iprop));
-      svn_ra_svn__item_t *elt = &APR_ARRAY_IDX(iproplist, i,
-                                               svn_ra_svn__item_t);
+      svn_ra_svn__item_t *elt = &SVN_RA_SVN__LIST_ITEM(iproplist, i);
       if (elt->kind != SVN_RA_SVN_LIST)
         return svn_error_create(
           SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
@@ -1385,7 +1384,7 @@ static svn_error_t *ra_svn_get_dir(svn_r
       svn_dirent_t *dirent;
       apr_uint64_t size;
       svn_revnum_t crev;
-      svn_ra_svn__item_t *elt = &APR_ARRAY_IDX(dirlist, i, svn_ra_svn__item_t);
+      svn_ra_svn__item_t *elt = &SVN_RA_SVN__LIST_ITEM(dirlist, i);
 
       if (elt->kind != SVN_RA_SVN_LIST)
         return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
@@ -1478,7 +1477,7 @@ static svn_error_t *ra_svn_get_mergeinfo
           svn_mergeinfo_t for_path;
           const char *to_parse;
 
-          elt = &((svn_ra_svn__item_t *) mergeinfo_tuple->elts)[i];
+          elt = &SVN_RA_SVN__LIST_ITEM(mergeinfo_tuple, i);
           if (elt->kind != SVN_RA_SVN_LIST)
             return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
                                     _("Mergeinfo element is not a list"));
@@ -1743,8 +1742,7 @@ perform_ra_svn_log(svn_error_t **outer_e
               const char *copy_path, *action, *kind_str;
               apr_uint64_t text_mods, prop_mods;
               svn_revnum_t copy_rev;
-              svn_ra_svn__item_t *elt = &APR_ARRAY_IDX(cplist, i,
-                                                       svn_ra_svn__item_t);
+              svn_ra_svn__item_t *elt = &SVN_RA_SVN__LIST_ITEM(cplist, i);
 
               if (elt->kind != SVN_RA_SVN_LIST)
                 return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
@@ -2658,7 +2656,7 @@ static svn_error_t *ra_svn_get_locks(svn
   for (i = 0; i < list->nelts; ++i)
     {
       svn_lock_t *lock;
-      svn_ra_svn__item_t *elt = &APR_ARRAY_IDX(list, i, svn_ra_svn__item_t);
+      svn_ra_svn__item_t *elt = &SVN_RA_SVN__LIST_ITEM(list, i);
 
       if (elt->kind != SVN_RA_SVN_LIST)
         return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,

Modified: subversion/trunk/subversion/libsvn_ra_svn/cyrus_auth.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/cyrus_auth.c?rev=1700855&r1=1700854&r2=1700855&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/cyrus_auth.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/cyrus_auth.c Wed Sep  2 17:40:02 2015
@@ -856,8 +856,7 @@ svn_ra_svn__do_cyrus_auth(svn_ra_svn__se
       /* Create a string containing the list of mechanisms, separated by spaces. */
       for (i = 0; i < mechlist->nelts; i++)
         {
-          svn_ra_svn__item_t *elt = &APR_ARRAY_IDX(mechlist, i,
-                                                   svn_ra_svn__item_t);
+          svn_ra_svn__item_t *elt = &SVN_RA_SVN__LIST_ITEM(mechlist, i);
           mechstring = apr_pstrcat(pool,
                                    mechstring,
                                    i == 0 ? "" : " ",

Modified: subversion/trunk/subversion/libsvn_ra_svn/internal_auth.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/internal_auth.c?rev=1700855&r1=1700854&r2=1700855&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/internal_auth.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/internal_auth.c Wed Sep  2 17:40:02 2015
@@ -45,7 +45,7 @@ svn_boolean_t svn_ra_svn__find_mech(cons
 
   for (i = 0; i < mechlist->nelts; i++)
     {
-      elt = &APR_ARRAY_IDX(mechlist, i, svn_ra_svn__item_t);
+      elt = &SVN_RA_SVN__LIST_ITEM(mechlist, i);
       if (elt->kind == SVN_RA_SVN_WORD && strcmp(elt->u.word, mech) == 0)
         return TRUE;
     }

Modified: subversion/trunk/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/marshal.c?rev=1700855&r1=1700854&r2=1700855&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/marshal.c Wed Sep  2 17:40:02 2015
@@ -117,8 +117,7 @@ svn_ra_svn__to_public_array(const svn_ra
   for (i = 0; i < source->nelts; ++i)
     {
       svn_ra_svn_item_t *sub_target = apr_array_push(result);
-      svn_ra_svn__item_t *sub_source = &APR_ARRAY_IDX(source, i,
-                                                      svn_ra_svn__item_t);
+      svn_ra_svn__item_t *sub_source = &SVN_RA_SVN__LIST_ITEM(source, i);
 
       svn_ra_svn__to_public_item(sub_target, sub_source, result_pool);
     }
@@ -242,7 +241,7 @@ svn_ra_svn__set_capabilities(svn_ra_svn_
 
   for (i = 0; i < list->nelts; i++)
     {
-      item = &APR_ARRAY_IDX(list, i, svn_ra_svn__item_t);
+      item = &SVN_RA_SVN__LIST_ITEM(list, i);
       if (item->kind != SVN_RA_SVN_WORD)
         return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
                                 _("Capability entry is not a word"));
@@ -1468,7 +1467,7 @@ vparse_tuple(const svn_ra_svn__list_t *i
       /* '?' just means the tuple may stop; skip past it. */
       if (**fmt == '?')
         (*fmt)++;
-      elt = &APR_ARRAY_IDX(items, count, svn_ra_svn__item_t);
+      elt = &SVN_RA_SVN__LIST_ITEM(items, count);
       if (**fmt == '(' && elt->kind == SVN_RA_SVN_LIST)
         {
           (*fmt)++;
@@ -1624,7 +1623,7 @@ svn_ra_svn__parse_proplist(const svn_ra_
   *props = svn_hash__make(pool);
   for (i = 0; i < list->nelts; i++)
     {
-      elt = &APR_ARRAY_IDX(list, i, svn_ra_svn__item_t);
+      elt = &SVN_RA_SVN__LIST_ITEM(list, i);
       if (elt->kind != SVN_RA_SVN_LIST)
         return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
                                 _("Proplist element not a list"));
@@ -1673,7 +1672,7 @@ svn_ra_svn__handle_failure_status(const
   for (i = params->nelts - 1; i >= 0; i--)
     {
       svn_pool_clear(subpool);
-      elt = &APR_ARRAY_IDX(params, i, svn_ra_svn__item_t);
+      elt = &SVN_RA_SVN__LIST_ITEM(params, i);
       if (elt->kind != SVN_RA_SVN_LIST)
         return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
                                 _("Malformed error list"));
@@ -2774,7 +2773,7 @@ svn_ra_svn__read_string(const svn_ra_svn
                         int idx,
                         svn_string_t **result)
 {
-  svn_ra_svn__item_t *elt = &APR_ARRAY_IDX(items, idx, svn_ra_svn__item_t);
+  svn_ra_svn__item_t *elt = &SVN_RA_SVN__LIST_ITEM(items, idx);
   CHECK_PROTOCOL_COND(elt->kind == SVN_RA_SVN_STRING);
   *result = elt->u.string;
 
@@ -2788,7 +2787,7 @@ svn_ra_svn__read_cstring(const svn_ra_sv
                          int idx,
                          const char **result)
 {
-  svn_ra_svn__item_t *elt = &APR_ARRAY_IDX(items, idx, svn_ra_svn__item_t);
+  svn_ra_svn__item_t *elt = &SVN_RA_SVN__LIST_ITEM(items, idx);
   CHECK_PROTOCOL_COND(elt->kind == SVN_RA_SVN_STRING);
   *result = elt->u.string->data;
 
@@ -2802,7 +2801,7 @@ svn_ra_svn__read_word(const svn_ra_svn__
                       int idx,
                       const char **result)
 {
-  svn_ra_svn__item_t *elt = &APR_ARRAY_IDX(items, idx, svn_ra_svn__item_t);
+  svn_ra_svn__item_t *elt = &SVN_RA_SVN__LIST_ITEM(items, idx);
   CHECK_PROTOCOL_COND(elt->kind == SVN_RA_SVN_WORD);
   *result = elt->u.word;
 
@@ -2816,7 +2815,7 @@ svn_ra_svn__read_revision(const svn_ra_s
                           int idx,
                           svn_revnum_t *result)
 {
-  svn_ra_svn__item_t *elt = &APR_ARRAY_IDX(items, idx, svn_ra_svn__item_t);
+  svn_ra_svn__item_t *elt = &SVN_RA_SVN__LIST_ITEM(items, idx);
   CHECK_PROTOCOL_COND(elt->kind == SVN_RA_SVN_NUMBER);
   *result = (svn_revnum_t)elt->u.number;
 
@@ -2830,7 +2829,7 @@ svn_ra_svn__read_boolean(const svn_ra_sv
                          int idx,
                          apr_uint64_t *result)
 {
-  svn_ra_svn__item_t *elt = &APR_ARRAY_IDX(items, idx, svn_ra_svn__item_t);
+  svn_ra_svn__item_t *elt = &SVN_RA_SVN__LIST_ITEM(items, idx);
   CHECK_PROTOCOL_COND(elt->kind == SVN_RA_SVN_WORD);
   if (elt->u.word[0] == 't' && strcmp(elt->u.word, "true") == 0)
     *result = TRUE;
@@ -2849,7 +2848,7 @@ svn_ra_svn__read_list(const svn_ra_svn__
                       int idx,
                       const svn_ra_svn__list_t **result)
 {
-  svn_ra_svn__item_t *elt  = &APR_ARRAY_IDX(items, idx, svn_ra_svn__item_t);
+  svn_ra_svn__item_t *elt  = &SVN_RA_SVN__LIST_ITEM(items, idx);
   CHECK_PROTOCOL_COND(elt->kind == SVN_RA_SVN_LIST);
 
   *result = elt->u.list;

Modified: subversion/trunk/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/serve.c?rev=1700855&r1=1700854&r2=1700855&view=diff
==============================================================================
--- subversion/trunk/subversion/svnserve/serve.c (original)
+++ subversion/trunk/subversion/svnserve/serve.c Wed Sep  2 17:40:02 2015
@@ -1338,18 +1338,17 @@ add_lock_tokens(const svn_ra_svn__list_t
     {
       const char *path, *token, *full_path;
       svn_ra_svn__item_t *path_item, *token_item;
-      svn_ra_svn__item_t *item = &APR_ARRAY_IDX(lock_tokens, i,
-                                                svn_ra_svn__item_t);
+      svn_ra_svn__item_t *item = &SVN_RA_SVN__LIST_ITEM(lock_tokens, i);
       if (item->kind != SVN_RA_SVN_LIST)
         return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
                                 "Lock tokens aren't a list of lists");
 
-      path_item = &APR_ARRAY_IDX(item->u.list, 0, svn_ra_svn__item_t);
+      path_item = &SVN_RA_SVN__LIST_ITEM(item->u.list, 0);
       if (path_item->kind != SVN_RA_SVN_STRING)
         return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
                                 "Lock path isn't a string");
 
-      token_item = &APR_ARRAY_IDX(item->u.list, 1, svn_ra_svn__item_t);
+      token_item = &SVN_RA_SVN__LIST_ITEM(item->u.list, 1);
       if (token_item->kind != SVN_RA_SVN_STRING)
         return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
                                 "Lock token isn't a string");
@@ -1402,9 +1401,9 @@ unlock_paths(const svn_ra_svn__list_t *l
       svn_ra_svn__item_t *item, *path_item, *token_item;
       const char *path, *token, *full_path;
 
-      item = &APR_ARRAY_IDX(lock_tokens, i, svn_ra_svn__item_t);
-      path_item = &APR_ARRAY_IDX(item->u.list, 0, svn_ra_svn__item_t);
-      token_item = &APR_ARRAY_IDX(item->u.list, 1, svn_ra_svn__item_t);
+      item = &SVN_RA_SVN__LIST_ITEM(lock_tokens, i);
+      path_item = &SVN_RA_SVN__LIST_ITEM(item->u.list, 0);
+      token_item = &SVN_RA_SVN__LIST_ITEM(item->u.list, 1);
 
       path = path_item->u.string->data;
       full_path = svn_fspath__join(sb->repository->fs_path->data,
@@ -3954,7 +3953,7 @@ construct_server_baton(server_baton_t **
                                                  sizeof(const char *));
     for (i = 0; i < caplist->nelts; i++)
       {
-        item = &APR_ARRAY_IDX(caplist, i, svn_ra_svn__item_t);
+        item = &SVN_RA_SVN__LIST_ITEM(caplist, i);
         /* ra_svn_set_capabilities() already type-checked for us */
         if (strcmp(item->u.word, SVN_RA_SVN_CAP_MERGEINFO) == 0)
           {



Mime
View raw message