You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2011/05/27 08:18:00 UTC

svn commit: r1128164 - in /subversion/trunk/subversion/libsvn_ra_serf: commit.c property.c replay.c serf.c

Author: gstein
Date: Fri May 27 06:18:00 2011
New Revision: 1128164

URL: http://svn.apache.org/viewvc?rev=1128164&view=rev
Log:
Clean up the callpoints for svn_ra_serf__deliver_props(). Remove need to
initialize the OUT param to NULL. Remove test for NULL upon return (that
never happens).

* subversion/libsvn_ra_serf/serf.c:
  (fetch_path_props): remove init of PROP_CTX and its post-call test.
    leave marker about using retrieve_props().

* subversion/libsvn_ra_serf/commit.c:
  (get_version_url): remove init of PROPFIND_CTX. leave marker about using
    retrieve_props().
  (svn_ra_serf__change_rev_prop): move PROPFIND_CTX to a tighter scope. no
    need to initialize. leave marker about retrieve_props().

* subversion/libsvn_ra_serf/property.c:
  (svn_ra_serf__deliver_props): remove dup docstring (ref: ra_serf.h).
    remove the assert. toss inner block. no functional change.
  (svn_ra_serf__retrieve_props): remove init of PROP_CTX and post-call test.

* subversion/libsvn_ra_serf/replay.c:
  (svn_ra_serf__replay_range): remove PROP_CTX and store the result of
    deliver_props directly into the REPLAY_CTX.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/commit.c
    subversion/trunk/subversion/libsvn_ra_serf/property.c
    subversion/trunk/subversion/libsvn_ra_serf/replay.c
    subversion/trunk/subversion/libsvn_ra_serf/serf.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/commit.c?rev=1128164&r1=1128163&r2=1128164&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/commit.c Fri May 27 06:18:00 2011
@@ -494,7 +494,6 @@ get_version_url(const char **checked_in_
 
       props = apr_hash_make(pool);
 
-      propfind_ctx = NULL;
       if (SVN_IS_VALID_REVNUM(base_revision))
         {
           const char *bc_url, *bc_relpath;
@@ -515,10 +514,10 @@ get_version_url(const char **checked_in_
           propfind_url = session->session_url.path;
         }
 
+      /* ### switch to svn_ra_serf__retrieve_props  */
       SVN_ERR(svn_ra_serf__deliver_props(&propfind_ctx, props, session, conn,
                                          propfind_url, base_revision, "0",
                                          checked_in_props, NULL, pool));
-
       SVN_ERR(svn_ra_serf__wait_for_props(propfind_ctx, session, pool));
 
       /* We wouldn't get here if the url wasn't found (404), so the checked-in
@@ -2374,7 +2373,6 @@ svn_ra_serf__change_rev_prop(svn_ra_sess
                              apr_pool_t *pool)
 {
   svn_ra_serf__session_t *session = ra_session->priv;
-  svn_ra_serf__propfind_context_t *propfind_ctx;
   proppatch_context_t *proppatch_ctx;
   commit_context_t *commit;
   const char *vcc_url, *proppatch_target, *ns;
@@ -2405,16 +2403,17 @@ svn_ra_serf__change_rev_prop(svn_ra_sess
     }
   else
     {
+      svn_ra_serf__propfind_context_t *propfind_ctx;
+
       SVN_ERR(svn_ra_serf__discover_vcc(&vcc_url, commit->session,
                                         commit->conn, pool));
 
       props = apr_hash_make(pool);
 
-      propfind_ctx = NULL;
+      /* ### switch to svn_ra_serf__retrieve_props  */
       SVN_ERR(svn_ra_serf__deliver_props(&propfind_ctx, props, commit->session,
                                          commit->conn, vcc_url, rev, "0",
                                          checked_in_props, NULL, pool));
-
       SVN_ERR(svn_ra_serf__wait_for_props(propfind_ctx, commit->session, pool));
 
       proppatch_target = svn_ra_serf__get_ver_prop(props, vcc_url, rev,

Modified: subversion/trunk/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/property.c?rev=1128164&r1=1128163&r2=1128164&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/property.c Fri May 27 06:18:00 2011
@@ -518,16 +518,7 @@ create_propfind_body(serf_bucket_t **bkt
   return SVN_NO_ERROR;
 }
 
-/*
- * This function will deliver a PROP_CTX PROPFIND request in the SESS
- * serf context for the properties listed in LOOKUP_PROPS at URL for
- * DEPTH ("0","1","infinity").
- *
- * This function will not block waiting for the response.  If the
- * request can be satisfied from a local cache, set PROP_CTX to NULL
- * as a signal to callers of that fact.  Otherwise, callers are
- * expected to call svn_ra_serf__wait_for_props().
- */
+
 svn_error_t *
 svn_ra_serf__deliver_props(svn_ra_serf__propfind_context_t **prop_ctx,
                            apr_hash_t *ret_props,
@@ -541,71 +532,66 @@ svn_ra_serf__deliver_props(svn_ra_serf__
                            apr_pool_t *pool)
 {
   svn_ra_serf__propfind_context_t *new_prop_ctx;
+  svn_ra_serf__handler_t *handler;
+  svn_ra_serf__xml_parser_t *parser_ctx;
 
-  SVN_ERR_ASSERT(*prop_ctx == NULL);
-
-    {
-      svn_ra_serf__handler_t *handler;
-      svn_ra_serf__xml_parser_t *parser_ctx;
+  new_prop_ctx = apr_pcalloc(pool, sizeof(*new_prop_ctx));
 
-      new_prop_ctx = apr_pcalloc(pool, sizeof(*new_prop_ctx));
-
-      new_prop_ctx->pool = apr_hash_pool_get(ret_props);
-      new_prop_ctx->path = path;
-      new_prop_ctx->find_props = find_props;
-      new_prop_ctx->ret_props = ret_props;
-      new_prop_ctx->depth = depth;
-      new_prop_ctx->done = FALSE;
-      new_prop_ctx->sess = sess;
-      new_prop_ctx->conn = conn;
-      new_prop_ctx->rev = rev;
-      new_prop_ctx->done_list = done_list;
-
-      if (SVN_IS_VALID_REVNUM(rev))
-        {
-          new_prop_ctx->label = apr_ltoa(pool, rev);
-        }
-      else
-        {
-          new_prop_ctx->label = NULL;
-        }
+  new_prop_ctx->pool = apr_hash_pool_get(ret_props);
+  new_prop_ctx->path = path;
+  new_prop_ctx->find_props = find_props;
+  new_prop_ctx->ret_props = ret_props;
+  new_prop_ctx->depth = depth;
+  new_prop_ctx->done = FALSE;
+  new_prop_ctx->sess = sess;
+  new_prop_ctx->conn = conn;
+  new_prop_ctx->rev = rev;
+  new_prop_ctx->done_list = done_list;
 
-      handler = apr_pcalloc(pool, sizeof(*handler));
+  if (SVN_IS_VALID_REVNUM(rev))
+    {
+      new_prop_ctx->label = apr_ltoa(pool, rev);
+    }
+  else
+    {
+      new_prop_ctx->label = NULL;
+    }
 
-      handler->method = "PROPFIND";
-      handler->path = path;
-      handler->body_delegate = create_propfind_body;
-      handler->body_type = "text/xml";
-      handler->body_delegate_baton = new_prop_ctx;
-      handler->header_delegate = setup_propfind_headers;
-      handler->header_delegate_baton = new_prop_ctx;
-
-      handler->session = new_prop_ctx->sess;
-      handler->conn = new_prop_ctx->conn;
-
-      new_prop_ctx->handler = handler;
-
-      parser_ctx = apr_pcalloc(pool, sizeof(*new_prop_ctx->parser_ctx));
-      parser_ctx->pool = pool;
-      parser_ctx->user_data = new_prop_ctx;
-      parser_ctx->start = start_propfind;
-      parser_ctx->end = end_propfind;
-      parser_ctx->cdata = cdata_propfind;
-      parser_ctx->status_code = &new_prop_ctx->status_code;
-      parser_ctx->done = &new_prop_ctx->done;
-      parser_ctx->done_list = new_prop_ctx->done_list;
-      parser_ctx->done_item = &new_prop_ctx->done_item;
+  handler = apr_pcalloc(pool, sizeof(*handler));
 
-      new_prop_ctx->parser_ctx = parser_ctx;
+  handler->method = "PROPFIND";
+  handler->path = path;
+  handler->body_delegate = create_propfind_body;
+  handler->body_type = "text/xml";
+  handler->body_delegate_baton = new_prop_ctx;
+  handler->header_delegate = setup_propfind_headers;
+  handler->header_delegate_baton = new_prop_ctx;
+
+  handler->session = new_prop_ctx->sess;
+  handler->conn = new_prop_ctx->conn;
+
+  new_prop_ctx->handler = handler;
+
+  parser_ctx = apr_pcalloc(pool, sizeof(*new_prop_ctx->parser_ctx));
+  parser_ctx->pool = pool;
+  parser_ctx->user_data = new_prop_ctx;
+  parser_ctx->start = start_propfind;
+  parser_ctx->end = end_propfind;
+  parser_ctx->cdata = cdata_propfind;
+  parser_ctx->status_code = &new_prop_ctx->status_code;
+  parser_ctx->done = &new_prop_ctx->done;
+  parser_ctx->done_list = new_prop_ctx->done_list;
+  parser_ctx->done_item = &new_prop_ctx->done_item;
 
-      handler->response_handler = svn_ra_serf__handle_xml_parser;
-      handler->response_baton = parser_ctx;
+  new_prop_ctx->parser_ctx = parser_ctx;
 
-      *prop_ctx = new_prop_ctx;
-    }
+  handler->response_handler = svn_ra_serf__handle_xml_parser;
+  handler->response_baton = parser_ctx;
 
   /* create request */
-  svn_ra_serf__request_create((*prop_ctx)->handler);
+  svn_ra_serf__request_create(new_prop_ctx->handler);
+
+  *prop_ctx = new_prop_ctx;
 
   return SVN_NO_ERROR;
 }
@@ -659,14 +645,11 @@ svn_ra_serf__retrieve_props(apr_hash_t *
                             const svn_ra_serf__dav_props_t *props,
                             apr_pool_t *pool)
 {
-  svn_ra_serf__propfind_context_t *prop_ctx = NULL;
+  svn_ra_serf__propfind_context_t *prop_ctx;
 
   SVN_ERR(svn_ra_serf__deliver_props(&prop_ctx, prop_vals, sess, conn, url,
                                      rev, depth, props, NULL, pool));
-  if (prop_ctx)
-    {
-      SVN_ERR(svn_ra_serf__wait_for_props(prop_ctx, sess, pool));
-    }
+  SVN_ERR(svn_ra_serf__wait_for_props(prop_ctx, sess, pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/libsvn_ra_serf/replay.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/replay.c?rev=1128164&r1=1128163&r2=1128164&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/replay.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/replay.c Fri May 27 06:18:00 2011
@@ -757,7 +757,6 @@ svn_ra_serf__replay_range(svn_ra_session
          requests to MAX_OUTSTANDING_REQUESTS. */
       if (rev <= end_revision  && active_reports < MAX_OUTSTANDING_REQUESTS)
         {
-          svn_ra_serf__propfind_context_t *prop_ctx = NULL;
           svn_ra_serf__handler_t *handler;
           svn_ra_serf__xml_parser_t *parser_ctx;
           apr_pool_t *ctx_pool = svn_pool_create(pool);
@@ -789,7 +788,7 @@ svn_ra_serf__replay_range(svn_ra_session
               replay_ctx->revprop_rev = rev;
             }
 
-          SVN_ERR(svn_ra_serf__deliver_props(&prop_ctx,
+          SVN_ERR(svn_ra_serf__deliver_props(&replay_ctx->prop_ctx,
                                              replay_ctx->revs_props, session,
                                              session->conns[0],
                                              replay_ctx->revprop_target,
@@ -798,8 +797,6 @@ svn_ra_serf__replay_range(svn_ra_session
                                              NULL,
                                              replay_ctx->src_rev_pool));
 
-          replay_ctx->prop_ctx = prop_ctx;
-
           /* Send the replay report request. */
           handler = apr_pcalloc(replay_ctx->src_rev_pool, sizeof(*handler));
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1128164&r1=1128163&r2=1128164&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Fri May 27 06:18:00 2011
@@ -588,8 +588,6 @@ fetch_path_props(svn_ra_serf__propfind_c
 
   props = apr_hash_make(pool);
 
-  prop_ctx = NULL;
-
   /* If we were given a specific revision, we have to fetch the VCC and
    * do a PROPFIND off of that.
    */
@@ -612,7 +610,6 @@ fetch_path_props(svn_ra_serf__propfind_c
        * technically an unversioned resource because we are accessing
        * the revision's baseline-collection.
        */
-      prop_ctx = NULL;
       path = svn_path_url_add_component2(basecoll_url, relative_url, pool);
       revision = SVN_INVALID_REVNUM;
       SVN_ERR(svn_ra_serf__deliver_props(&prop_ctx, props, session,
@@ -621,10 +618,8 @@ fetch_path_props(svn_ra_serf__propfind_c
                                          pool));
     }
 
-  if (prop_ctx)
-    {
-      SVN_ERR(svn_ra_serf__wait_for_props(prop_ctx, session, pool));
-    }
+  /* ### switch to svn_ra_serf__retrieve_props?  */
+  SVN_ERR(svn_ra_serf__wait_for_props(prop_ctx, session, pool));
 
   *ret_path = path;
   *ret_prop_ctx = prop_ctx;