subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@apache.org
Subject svn commit: r1334339 - /subversion/trunk/subversion/libsvn_ra_serf/util.c
Date Sat, 05 May 2012 08:02:35 GMT
Author: gstein
Date: Sat May  5 08:02:35 2012
New Revision: 1334339

URL: http://svn.apache.org/viewvc?rev=1334339&view=rev
Log:
The serf acceptor and handler callbacks are essentially constant
(after removal of SETUP/BATON in r1303280), so we can set them in the
outer callback.

* subversoin/libsvn_ra_serf/util.c:
  (setup_request): remove acceptor/handler callback and baton OUT
    parameters.
  (setup_request_cb): adjust the serf callback to directly set the
    acceptor and handler callbacks/batons (with care for HEAD requests)

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/util.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1334339&r1=1334338&r2=1334339&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Sat May  5 08:02:35 2012
@@ -1820,25 +1820,12 @@ static svn_error_t *
 setup_request(serf_request_t *request,
               svn_ra_serf__handler_t *ctx,
               serf_bucket_t **req_bkt,
-              serf_response_acceptor_t *acceptor,
-              void **acceptor_baton,
-              serf_response_handler_t *handler,
-              void **handler_baton,
               apr_pool_t *request_pool,
               apr_pool_t *scratch_pool)
 {
   serf_bucket_t *body_bkt;
   serf_bucket_t *headers_bkt;
 
-  /* Default response acceptor.  */
-  *acceptor = accept_response;
-  *acceptor_baton = ctx->session;
-
-  if (strcmp(ctx->method, "HEAD") == 0)
-    {
-      *acceptor = accept_head;
-    }
-
   if (ctx->body_delegate)
     {
       serf_bucket_alloc_t *bkt_alloc = serf_request_get_alloc(request);
@@ -1864,9 +1851,6 @@ setup_request(serf_request_t *request,
                                    request_pool));
     }
 
-  *handler = handle_response_cb;
-  *handler_baton = ctx;
-
   return APR_SUCCESS;
 }
 
@@ -1890,10 +1874,16 @@ setup_request_cb(serf_request_t *request
      ### the duration of the request.  */
   apr_pool_t *scratch_pool = pool;
 
-  err = svn_error_trace(setup_request(request, ctx,
-                                      req_bkt,
-                                      acceptor, acceptor_baton,
-                                      handler, handler_baton,
+  if (strcmp(ctx->method, "HEAD") == 0)
+    *acceptor = accept_head;
+  else
+    *acceptor = accept_response;
+  *acceptor_baton = ctx->session;
+
+  *handler = handle_response_cb;
+  *handler_baton = ctx;
+
+  err = svn_error_trace(setup_request(request, ctx, req_bkt,
                                       pool /* request_pool */, scratch_pool));
 
   return save_error(ctx->session, err);



Mime
View raw message