You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2012/03/30 15:55:31 UTC

svn commit: r1307424 [5/11] - in /subversion/branches/revprop-packing: ./ build/ac-macros/ notes/ notes/directory-index/ notes/wc-ng/ subversion/bindings/javahl/ subversion/bindings/swig/python/svn/ subversion/bindings/swig/python/tests/ subversion/bin...

Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/property.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/property.c Fri Mar 30 13:55:26 2012
@@ -33,6 +33,7 @@
 
 #include "private/svn_dav_protocol.h"
 #include "private/svn_fspath.h"
+#include "private/svn_string_private.h"
 #include "svn_private_config.h"
 
 #include "ra_serf.h"
@@ -51,11 +52,8 @@ typedef struct prop_info_t {
 
   /* Current ns, attribute name, and value of the property we're parsing */
   const char *ns;
-
   const char *name;
-
-  const char *val;
-  apr_size_t val_len;
+  svn_stringbuf_t *value;
 
   const char *encoding;
 
@@ -243,6 +241,7 @@ push_state(svn_ra_serf__xml_parser_t *pa
 
       info = apr_pcalloc(parser->state->pool, sizeof(*info));
       info->pool = parser->state->pool;
+      info->value = svn_stringbuf_create_empty(info->pool);
 
       parser->state->private = info;
     }
@@ -255,11 +254,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
  */
 static svn_error_t *
 start_propfind(svn_ra_serf__xml_parser_t *parser,
-               void *userData,
                svn_ra_serf__dav_props_t name,
-               const char **attrs)
+               const char **attrs,
+               apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__propfind_context_t *ctx = userData;
+  svn_ra_serf__propfind_context_t *ctx = parser->user_data;
   prop_state_e state;
   prop_info_t *info;
 
@@ -273,7 +272,7 @@ start_propfind(svn_ra_serf__xml_parser_t
     {
       info = push_state(parser, ctx, PROPVAL);
       info->ns = name.namespace;
-      info->name = apr_pstrdup(info->pool, name.name);
+      info->name = "href";
     }
   else if (state == RESPONSE && strcmp(name.name, "prop") == 0)
     {
@@ -296,10 +295,10 @@ start_propfind(svn_ra_serf__xml_parser_t
  */
 static svn_error_t *
 end_propfind(svn_ra_serf__xml_parser_t *parser,
-             void *userData,
-             svn_ra_serf__dav_props_t name)
+             svn_ra_serf__dav_props_t name,
+             apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__propfind_context_t *ctx = userData;
+  svn_ra_serf__propfind_context_t *ctx = parser->user_data;
   prop_state_e state;
   prop_info_t *info;
 
@@ -316,24 +315,20 @@ end_propfind(svn_ra_serf__xml_parser_t *
     }
   else if (state == PROPVAL)
     {
-      const char *ns, *pname, *val;
-      svn_string_t *val_str;
+      const char *ns;
+      const char *pname;
+      const svn_string_t *val_str = NULL;
 
       /* if we didn't see a CDATA element, we may want the tag name
        * as long as it isn't equivalent to the property name.
        */
-      if (!info->val)
+      /* ### gstein sez: I have no idea what this is about.  */
+      if (*info->value->data == '\0')
         {
           if (strcmp(info->name, name.name) != 0)
-            {
-              info->val = name.name;
-              info->val_len = strlen(info->val);
-            }
+            val_str = svn_string_create(name.name, ctx->pool);
           else
-            {
-              info->val = "";
-              info->val_len = 0;
-            }
+            val_str = svn_string_create_empty(ctx->pool);
         }
 
       if (parser->state->prev->current_state == RESPONSE &&
@@ -342,7 +337,7 @@ end_propfind(svn_ra_serf__xml_parser_t *
           if (strcmp(ctx->depth, "1") == 0)
             {
               ctx->current_path =
-                svn_urlpath__canonicalize(info->val, ctx->pool);
+                svn_urlpath__canonicalize(info->value->data, ctx->pool);
             }
           else
             {
@@ -353,15 +348,13 @@ end_propfind(svn_ra_serf__xml_parser_t *
         {
           if (strcmp(info->encoding, "base64") == 0)
             {
-              svn_string_t encoded;
-              const svn_string_t *decoded;
-
-              encoded.data = info->val;
-              encoded.len = info->val_len;
+              const svn_string_t *morph;
 
-              decoded = svn_base64_decode_string(&encoded, parser->state->pool);
-              info->val = decoded->data;
-              info->val_len = decoded->len;
+              morph = svn_stringbuf__morph_into_string(info->value);
+#ifdef SVN_DEBUG
+              info->value = NULL;  /* morph killed the stringbuf.  */
+#endif
+              val_str = svn_base64_decode_string(morph, ctx->pool);
             }
           else
             {
@@ -372,10 +365,13 @@ end_propfind(svn_ra_serf__xml_parser_t *
             }
         }
 
+      /* ### there may be better logic to ensure this is set above, but just
+         ### going for the easy win here.  */
+      if (val_str == NULL)
+        val_str = svn_string_create_from_buf(info->value, ctx->pool);
+
       ns = apr_pstrdup(ctx->pool, info->ns);
       pname = apr_pstrdup(ctx->pool, info->name);
-      val = apr_pmemdup(ctx->pool, info->val, info->val_len);
-      val_str = svn_string_ncreate(val, info->val_len, ctx->pool);
 
       /* set the return props and update our cache too. */
       svn_ra_serf__set_ver_prop(ctx->ret_props,
@@ -396,11 +392,11 @@ end_propfind(svn_ra_serf__xml_parser_t *
  */
 static svn_error_t *
 cdata_propfind(svn_ra_serf__xml_parser_t *parser,
-               void *userData,
                const char *data,
-               apr_size_t len)
+               apr_size_t len,
+               apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__propfind_context_t *ctx = userData;
+  svn_ra_serf__propfind_context_t *ctx = parser->user_data;
   prop_state_e state;
   prop_info_t *info;
 
@@ -410,10 +406,7 @@ cdata_propfind(svn_ra_serf__xml_parser_t
   info = parser->state->private;
 
   if (state == PROPVAL)
-    {
-      svn_ra_serf__expand_string(&info->val, &info->val_len, data, len,
-                                 info->pool);
-    }
+    svn_stringbuf_appendbytes(info->value, data, len);
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/ra_serf.h?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/ra_serf.h Fri Mar 30 13:55:26 2012
@@ -39,6 +39,7 @@
 #include "svn_dirent_uri.h"
 
 #include "private/svn_dav_protocol.h"
+#include "private/svn_subr_private.h"
 
 #include "blncache.h"
 
@@ -70,6 +71,10 @@ typedef struct svn_ra_serf__connection_t
   /* Our connection to a server. */
   serf_connection_t *conn;
 
+  /* The server is not Apache/mod_dav_svn (directly) and only supports
+     HTTP/1.0. Thus, we cannot send chunked requests.  */
+  svn_boolean_t http10;
+
   /* Bucket allocator for this connection. */
   serf_bucket_alloc_t *bkt_alloc;
 
@@ -319,12 +324,6 @@ svn_ra_serf__conn_setup(apr_socket_t *so
                         void *baton,
                         apr_pool_t *pool);
 
-serf_bucket_t*
-svn_ra_serf__accept_response(serf_request_t *request,
-                             serf_bucket_t *stream,
-                             void *acceptor_baton,
-                             apr_pool_t *pool);
-
 void
 svn_ra_serf__conn_closed(serf_connection_t *conn,
                          void *closed_baton,
@@ -351,24 +350,6 @@ svn_ra_serf__handle_client_cert_pw(void 
                                    const char *cert_path,
                                    const char **password);
 
-/*
- * Create a REQUEST with an associated REQ_BKT in the SESSION.
- *
- * If HDRS_BKT is not-NULL, it will be set to a headers_bucket that
- * corresponds to the new request.
- *
- * The request will be METHOD at URL.
- *
- * If BODY_BKT is not-NULL, it will be sent as the request body.
- *
- * If CONTENT_TYPE is not-NULL, it will be sent as the Content-Type header.
- */
-svn_error_t *
-svn_ra_serf__setup_serf_req(serf_request_t *request,
-                            serf_bucket_t **req_bkt, serf_bucket_t **hdrs_bkt,
-                            svn_ra_serf__connection_t *conn,
-                            const char *method, const char *url,
-                            serf_bucket_t *body_bkt, const char *content_type);
 
 /*
  * This function will run the serf context in SESS until *DONE is TRUE.
@@ -385,29 +366,20 @@ typedef svn_error_t *
                                    void *handler_baton,
                                    apr_pool_t *pool);
 
-/* Callback for setting up a complete serf request */
-typedef svn_error_t *
-(*svn_ra_serf__request_setup_t)(serf_request_t *request,
-                                void *setup_baton,
-                                serf_bucket_t **req_bkt,
-                                serf_response_acceptor_t *acceptor,
-                                void **acceptor_baton,
-                                svn_ra_serf__response_handler_t *handler,
-                                void **handler_baton,
-                                apr_pool_t *pool);
-
 /* Callback for when a request body is needed. */
+/* ### should pass a scratch_pool  */
 typedef svn_error_t *
 (*svn_ra_serf__request_body_delegate_t)(serf_bucket_t **body_bkt,
                                         void *baton,
                                         serf_bucket_alloc_t *alloc,
-                                        apr_pool_t *pool);
+                                        apr_pool_t *request_pool);
 
 /* Callback for when request headers are needed. */
+/* ### should pass a scratch_pool  */
 typedef svn_error_t *
 (*svn_ra_serf__request_header_delegate_t)(serf_bucket_t *headers,
                                           void *baton,
-                                          apr_pool_t *pool);
+                                          apr_pool_t *request_pool);
 
 /* Callback for when a response has an error. */
 typedef svn_error_t *
@@ -441,15 +413,6 @@ typedef struct svn_ra_serf__handler_t {
   svn_ra_serf__response_error_t response_error;
   void *response_error_baton;
 
-  /* This function and baton will be executed when the request is about
-   * to be delivered by serf.
-   *
-   * This just passes through serf's raw request creation parameters.
-   * None of the other parameters will be utilized if this field is set.
-   */
-  svn_ra_serf__request_setup_t setup;
-  void *setup_baton;
-
   /* This function and baton pair allows for custom request headers to
    * be set.
    *
@@ -513,30 +476,28 @@ typedef struct svn_ra_serf__xml_parser_t
  */
 typedef svn_error_t *
 (*svn_ra_serf__xml_start_element_t)(svn_ra_serf__xml_parser_t *parser,
-                                    void *baton,
                                     svn_ra_serf__dav_props_t name,
-                                    const char **attrs);
+                                    const char **attrs,
+                                    apr_pool_t *scratch_pool);
 
 /* Callback invoked with @a baton by our XML @a parser when an element with
  * the @a name is closed.
  */
 typedef svn_error_t *
 (*svn_ra_serf__xml_end_element_t)(svn_ra_serf__xml_parser_t *parser,
-                                  void *baton,
-                                  svn_ra_serf__dav_props_t name);
+                                  svn_ra_serf__dav_props_t name,
+                                  apr_pool_t *scratch_pool);
 
 /* Callback invoked with @a baton by our XML @a parser when a CDATA portion
  * of @a data with size @a len is encountered.
  *
  * This may be invoked multiple times for the same tag.
- *
- * @see svn_ra_serf__expand_string
  */
 typedef svn_error_t *
 (*svn_ra_serf__xml_cdata_chunk_handler_t)(svn_ra_serf__xml_parser_t *parser,
-                                          void *baton,
                                           const char *data,
-                                          apr_size_t len);
+                                          apr_size_t len,
+                                          apr_pool_t *scratch_pool);
 
 /*
  * Helper structure associated with handle_xml_parser handler that will
@@ -885,16 +846,6 @@ svn_ra_serf__expand_ns(svn_ra_serf__dav_
                        svn_ra_serf__ns_t *ns_list,
                        const char *name);
 
-/*
- * Expand the string represented by @a cur with a current size of @a
- * cur_len by appending @a new with a size of @a new_len.
- *
- * The reallocated string is made in @a pool.
- */
-void
-svn_ra_serf__expand_string(const char **cur, apr_size_t *cur_len,
-                           const char *new, apr_size_t new_len,
-                           apr_pool_t *pool);
 
 /** PROPFIND-related functions **/
 
@@ -1462,6 +1413,18 @@ svn_ra_serf__register_editor_shim_callba
                                     svn_delta_shim_callbacks_t *callbacks);
 
 
+svn_error_t *
+svn_ra_serf__copy_into_spillbuf(svn_spillbuf_t **spillbuf,
+                                serf_bucket_t *bkt,
+                                apr_pool_t *result_pool,
+                                apr_pool_t *scratch_pool);
+serf_bucket_t *
+svn_ra_serf__create_sb_bucket(svn_spillbuf_t *spillbuf,
+                              serf_bucket_alloc_t *allocator,
+                              apr_pool_t *result_pool,
+                              apr_pool_t *scratch_pool);
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/replay.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/replay.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/replay.c Fri Mar 30 13:55:26 2012
@@ -40,6 +40,8 @@
 #include "svn_path.h"
 #include "svn_private_config.h"
 
+#include "private/svn_string_private.h"
+
 #include "ra_serf.h"
 
 
@@ -83,8 +85,7 @@ typedef struct prop_info_t {
   const char *name;
   svn_boolean_t del_prop;
 
-  const char *data;
-  apr_size_t len;
+  svn_stringbuf_t *prop_value;
 
   replay_info_t *parent;
 } prop_info_t;
@@ -165,6 +166,7 @@ push_state(svn_ra_serf__xml_parser_t *pa
 
       info->pool = replay_ctx->dst_rev_pool;
       info->parent = parser->state->private;
+      info->prop_value = svn_stringbuf_create_empty(info->pool);
 
       parser->state->private = info;
     }
@@ -174,11 +176,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
 
 static svn_error_t *
 start_replay(svn_ra_serf__xml_parser_t *parser,
-             void *userData,
              svn_ra_serf__dav_props_t name,
-             const char **attrs)
+             const char **attrs,
+             apr_pool_t *scratch_pool)
 {
-  replay_context_t *ctx = userData;
+  replay_context_t *ctx = parser->user_data;
   replay_state_e state;
 
   state = parser->state->current_state;
@@ -471,14 +473,12 @@ start_replay(svn_ra_serf__xml_parser_t *
 
 static svn_error_t *
 end_replay(svn_ra_serf__xml_parser_t *parser,
-           void *userData,
-           svn_ra_serf__dav_props_t name)
+           svn_ra_serf__dav_props_t name,
+           apr_pool_t *scratch_pool)
 {
-  replay_context_t *ctx = userData;
+  replay_context_t *ctx = parser->user_data;
   replay_state_e state;
 
-  UNUSED_CTX(ctx);
-
   state = parser->state->current_state;
 
   if (state == REPORT &&
@@ -535,15 +535,17 @@ end_replay(svn_ra_serf__xml_parser_t *pa
         }
       else
         {
-          svn_string_t tmp_prop;
+          const svn_string_t *morph;
 
-          tmp_prop.data = info->data;
-          tmp_prop.len = info->len;
+          morph = svn_stringbuf__morph_into_string(info->prop_value);
+#ifdef SVN_DEBUG
+          info->prop_value = NULL;  /* morph killed the stringbuf.  */
+#endif
 
           if (strcmp(name.name, "change-file-prop") == 0)
-            prop_val = svn_base64_decode_string(&tmp_prop, ctx->file_pool);
+            prop_val = svn_base64_decode_string(morph, ctx->file_pool);
           else
-            prop_val = svn_base64_decode_string(&tmp_prop, ctx->dst_rev_pool);
+            prop_val = svn_base64_decode_string(morph, ctx->dst_rev_pool);
         }
 
       SVN_ERR(info->change(info->parent->baton, info->name, prop_val,
@@ -556,11 +558,11 @@ end_replay(svn_ra_serf__xml_parser_t *pa
 
 static svn_error_t *
 cdata_replay(svn_ra_serf__xml_parser_t *parser,
-             void *userData,
              const char *data,
-             apr_size_t len)
+             apr_size_t len,
+             apr_pool_t *scratch_pool)
 {
-  replay_context_t *replay_ctx = userData;
+  replay_context_t *replay_ctx = parser->user_data;
   replay_state_e state;
 
   UNUSED_CTX(replay_ctx);
@@ -584,8 +586,7 @@ cdata_replay(svn_ra_serf__xml_parser_t *
     {
       prop_info_t *info = parser->state->private;
 
-      svn_ra_serf__expand_string(&info->data, &info->len,
-                                 data, len, parser->state->pool);
+      svn_stringbuf_appendbytes(info->prop_value, data, len);
     }
 
   return SVN_NO_ERROR;
@@ -845,7 +846,26 @@ svn_ra_serf__replay_range(svn_ra_session
 
       /* Run the serf loop, send outgoing and process incoming requests.
          This request will block when there are no more requests to send or
-         responses to receive, so we have to be careful on our bookkeeping. */
+         responses to receive, so we have to be careful on our bookkeeping.
+
+         ### we should probably adjust this timeout. if we get (say) 3
+         ### requests completed, then we want to exit immediately rather
+         ### than block for a few seconds. that will allow us to clear up
+         ### those 3 requests. if we have queued all of our revisions,
+         ### then we may want to block until timeout since we really don't
+         ### have much work other than destroying memory. (though that
+         ### is important, as we could end up with 50 src_rev_pool pools)
+
+         ### idea: when a revision is marked DONE, we can probably destroy
+         ### most of the memory. that will reduce pressue to have serf
+         ### return control to us, to complete the major memory disposal.
+
+         ### theoretically, we should use an iterpool here, but it turns
+         ### out that serf doesn't even use the pool param. if we grow
+         ### an iterpool in this loop for other purposes, then yeah: go
+         ### ahead and apply it here, too, in case serf eventually uses
+         ### that parameter.
+      */
       status = serf_context_run(session->context, session->timeout,
                                 pool);
 

Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/serf.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/serf.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/serf.c Fri Mar 30 13:55:26 2012
@@ -397,16 +397,16 @@ svn_ra_serf__open(svn_ra_session_t *sess
 
   serf_sess->conns[0] = apr_pcalloc(serf_sess->pool,
                                     sizeof(*serf_sess->conns[0]));
+  serf_sess->conns[0]->http10 = TRUE;  /* until we confirm HTTP/1.1  */
+  serf_sess->conns[0]->http10 = FALSE; /* ### don't change behavior yet  */
   serf_sess->conns[0]->bkt_alloc =
           serf_bucket_allocator_create(serf_sess->pool, NULL, NULL);
   serf_sess->conns[0]->session = serf_sess;
   serf_sess->conns[0]->last_status_code = -1;
 
   serf_sess->conns[0]->using_ssl = serf_sess->using_ssl;
-  serf_sess->conns[0]->server_cert_failures = 0;
   serf_sess->conns[0]->using_compression = serf_sess->using_compression;
   serf_sess->conns[0]->hostname = url.hostname;
-  serf_sess->conns[0]->useragent = NULL;
 
   /* create the user agent string */
   if (callbacks->get_client_string)
@@ -1196,6 +1196,7 @@ svn_ra_serf__init(const svn_version_t *l
       || serf_minor < SERF_MINOR_VERSION)
     {
       return svn_error_createf(
+         /* ### should return a unique error  */
          SVN_ERR_VERSION_MISMATCH, NULL,
          _("ra_serf was compiled for serf %d.%d.%d but loaded "
            "an incompatible %d.%d.%d library"),

Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/update.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/update.c Fri Mar 30 13:55:26 2012
@@ -43,6 +43,7 @@
 #include "svn_private_config.h"
 #include "private/svn_dep_compat.h"
 #include "private/svn_fspath.h"
+#include "private/svn_string_private.h"
 
 #include "ra_serf.h"
 #include "../libsvn_ra/ra_loader.h"
@@ -241,8 +242,7 @@ typedef struct report_info_t
    */
   const char *prop_ns;
   const char *prop_name;
-  const char *prop_val;
-  apr_size_t prop_val_len;
+  svn_stringbuf_t *prop_value;
   const char *prop_encoding;
 } report_info_t;
 
@@ -397,6 +397,7 @@ push_state(svn_ra_serf__xml_parser_t *pa
       new_info = apr_pcalloc(info_parent_pool, sizeof(*new_info));
       new_info->pool = svn_pool_create(info_parent_pool);
       new_info->lock_token = NULL;
+      new_info->prop_value = svn_stringbuf_create_empty(new_info->pool);
 
       new_info->dir = apr_pcalloc(new_info->pool, sizeof(*new_info->dir));
       new_info->dir->pool = new_info->pool;
@@ -441,6 +442,7 @@ push_state(svn_ra_serf__xml_parser_t *pa
       new_info->file_baton = NULL;
       new_info->lock_token = NULL;
       new_info->fetch_file = FALSE;
+      new_info->prop_value = svn_stringbuf_create_empty(new_info->pool);
 
       /* Point at our parent's directory state. */
       new_info->dir = info->dir;
@@ -1327,11 +1329,11 @@ fetch_file(report_context_t *ctx, report
 
 static svn_error_t *
 start_report(svn_ra_serf__xml_parser_t *parser,
-             void *userData,
              svn_ra_serf__dav_props_t name,
-             const char **attrs)
+             const char **attrs,
+             apr_pool_t *scratch_pool)
 {
-  report_context_t *ctx = userData;
+  report_context_t *ctx = parser->user_data;
   report_state_e state;
 
   state = parser->state->current_state;
@@ -1645,8 +1647,7 @@ start_report(svn_ra_serf__xml_parser_t *
           info->prop_ns = name.namespace;
           info->prop_name = apr_pstrdup(parser->state->pool, name.name);
           info->prop_encoding = NULL;
-          info->prop_val = NULL;
-          info->prop_val_len = 0;
+          svn_stringbuf_setempty(info->prop_value);
         }
       else if (strcmp(name.name, "set-prop") == 0 ||
                strcmp(name.name, "remove-prop") == 0)
@@ -1675,8 +1676,7 @@ start_report(svn_ra_serf__xml_parser_t *
                                          colon - full_prop_name);
           info->prop_name = apr_pstrdup(parser->state->pool, colon);
           info->prop_encoding = svn_xml_get_attr_value("encoding", attrs);
-          info->prop_val = NULL;
-          info->prop_val_len = 0;
+          svn_stringbuf_setempty(info->prop_value);
         }
       else if (strcmp(name.name, "prop") == 0)
         {
@@ -1707,8 +1707,7 @@ start_report(svn_ra_serf__xml_parser_t *
           info->prop_ns = name.namespace;
           info->prop_name = apr_pstrdup(parser->state->pool, name.name);
           info->prop_encoding = NULL;
-          info->prop_val = NULL;
-          info->prop_val_len = 0;
+          svn_stringbuf_setempty(info->prop_value);
         }
       else if (strcmp(name.name, "prop") == 0)
         {
@@ -1763,8 +1762,7 @@ start_report(svn_ra_serf__xml_parser_t *
                                          colon - full_prop_name);
           info->prop_name = apr_pstrdup(parser->state->pool, colon);
           info->prop_encoding = svn_xml_get_attr_value("encoding", attrs);
-          info->prop_val = NULL;
-          info->prop_val_len = 0;
+          svn_stringbuf_setempty(info->prop_value);
         }
       else
         {
@@ -1787,8 +1785,7 @@ start_report(svn_ra_serf__xml_parser_t *
       info->prop_ns = name.namespace;
       info->prop_name = apr_pstrdup(parser->state->pool, name.name);
       info->prop_encoding = svn_xml_get_attr_value("encoding", attrs);
-      info->prop_val = NULL;
-      info->prop_val_len = 0;
+      svn_stringbuf_setempty(info->prop_value);
     }
 
   return SVN_NO_ERROR;
@@ -1796,10 +1793,10 @@ start_report(svn_ra_serf__xml_parser_t *
 
 static svn_error_t *
 end_report(svn_ra_serf__xml_parser_t *parser,
-           void *userData,
-           svn_ra_serf__dav_props_t name)
+           svn_ra_serf__dav_props_t name,
+           apr_pool_t *scratch_pool)
 {
-  report_context_t *ctx = userData;
+  report_context_t *ctx = parser->user_data;
   report_state_e state;
 
   state = parser->state->current_state;
@@ -1950,7 +1947,7 @@ end_report(svn_ra_serf__xml_parser_t *pa
     }
   else if (state == PROP)
     {
-      /* We need to move the prop_ns, prop_name, and prop_val into the
+      /* We need to move the prop_ns, prop_name, and prop_value into the
        * same lifetime as the dir->pool.
        */
       svn_ra_serf__ns_t *ns, *ns_name_match;
@@ -1958,8 +1955,7 @@ end_report(svn_ra_serf__xml_parser_t *pa
       report_info_t *info;
       report_dir_t *dir;
       apr_hash_t *props;
-      const char *set_val;
-      svn_string_t *set_val_str;
+      const svn_string_t *set_val_str;
       apr_pool_t *pool;
 
       info = parser->state->private;
@@ -2009,24 +2005,21 @@ end_report(svn_ra_serf__xml_parser_t *pa
         {
           props = dir->removed_props;
           pool = dir->pool;
-          info->prop_val = "";
-          info->prop_val_len = 1;
+          svn_stringbuf_setempty(info->prop_value);
         }
 
       if (info->prop_encoding)
         {
           if (strcmp(info->prop_encoding, "base64") == 0)
             {
-              svn_string_t encoded;
-              const svn_string_t *decoded;
+              svn_string_t tmp;
 
-              encoded.data = info->prop_val;
-              encoded.len = info->prop_val_len;
+              /* Don't use morph_info_string cuz we need prop_value to
+                 remain usable.  */
+              tmp.data = info->prop_value->data;
+              tmp.len = info->prop_value->len;
 
-              decoded = svn_base64_decode_string(&encoded, parser->state->pool);
-
-              info->prop_val = decoded->data;
-              info->prop_val_len = decoded->len;
+              set_val_str = svn_base64_decode_string(&tmp, pool);
             }
           else
             {
@@ -2035,11 +2028,11 @@ end_report(svn_ra_serf__xml_parser_t *pa
                                        _("Got unrecognized encoding '%s'"),
                                        info->prop_encoding);
             }
-
         }
-
-      set_val = apr_pmemdup(pool, info->prop_val, info->prop_val_len);
-      set_val_str = svn_string_ncreate(set_val, info->prop_val_len, pool);
+      else
+        {
+          set_val_str = svn_string_create_from_buf(info->prop_value, pool);
+        }
 
       svn_ra_serf__set_ver_prop(props, info->base_name, info->base_rev,
                                 ns->namespace, ns->url, set_val_str, pool);
@@ -2055,11 +2048,11 @@ end_report(svn_ra_serf__xml_parser_t *pa
 
 static svn_error_t *
 cdata_report(svn_ra_serf__xml_parser_t *parser,
-             void *userData,
              const char *data,
-             apr_size_t len)
+             apr_size_t len,
+             apr_pool_t *scratch_pool)
 {
-  report_context_t *ctx = userData;
+  report_context_t *ctx = parser->user_data;
 
   UNUSED_CTX(ctx);
 
@@ -2067,8 +2060,7 @@ cdata_report(svn_ra_serf__xml_parser_t *
     {
       report_info_t *info = parser->state->private;
 
-      svn_ra_serf__expand_string(&info->prop_val, &info->prop_val_len,
-                                 data, len, parser->state->pool);
+      svn_stringbuf_appendbytes(info->prop_value, data, len);
     }
 
   return SVN_NO_ERROR;
@@ -2226,16 +2218,17 @@ open_connection_if_needed(svn_ra_serf__s
       int cur = sess->num_conns;
       apr_status_t status;
 
-      sess->conns[cur] = apr_palloc(sess->pool, sizeof(*sess->conns[cur]));
+      sess->conns[cur] = apr_pcalloc(sess->pool, sizeof(*sess->conns[cur]));
+      sess->conns[cur]->http10 = TRUE;  /* until we confirm HTTP/1.1  */
+      sess->conns[cur]->http10 = FALSE; /* ### don't change behavior yet  */
       sess->conns[cur]->bkt_alloc = serf_bucket_allocator_create(sess->pool,
                                                                  NULL, NULL);
       sess->conns[cur]->hostname  = sess->conns[0]->hostname;
       sess->conns[cur]->using_ssl = sess->conns[0]->using_ssl;
       sess->conns[cur]->using_compression = sess->conns[0]->using_compression;
-      sess->conns[cur]->useragent = sess->conns[0]->useragent;
       sess->conns[cur]->last_status_code = -1;
-      sess->conns[cur]->ssl_context = NULL;
       sess->conns[cur]->session = sess;
+      sess->conns[cur]->useragent = sess->conns[0]->useragent;
       status = serf_connection_create2(&sess->conns[cur]->conn,
                                        sess->context,
                                        sess->session_url,

Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/util.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/util.c Fri Mar 30 13:55:26 2012
@@ -103,75 +103,7 @@ struct svn_ra_serf__pending_t {
    into a temporary file.  */
 #define SPILL_SIZE 1000000
 
-/* See notes/ra-serf-testing.txt for some information on testing this
-   new "paused" feature (aka network pushback).
 
-   Define PBTEST_ACTIVE, if you would like to run the pushback tests.  */
-#undef PBTEST_ACTIVE
-#ifdef PBTEST_ACTIVE
-
-static int pbtest_step = 0;
-
-/* Note: this cannot resolve states 5 and 7.  */
-#define PBTEST_STATE(p) \
-  ((p) == NULL ? 1                                                 \
-               : ((p)->spill == NULL ? ((p)->head == NULL ? 2 : 3) \
-                                     : ((p)->head == NULL ? 6 : 4)))
-
-/* Note: INJECT and COMPLETED are only used for debug output.  */
-typedef struct {
-  svn_boolean_t paused;   /* pause the parser on this step?  */
-  svn_boolean_t inject;   /* inject pending content on this step?  */
-  int when_next;          /* when to move to the next step?  */
-  const char *completed;  /* what test was completed?  */
-} pbtest_desc_t;
-
-static const pbtest_desc_t pbtest_description[] = {
-  { 0 }, /* unused */
-  { TRUE,  FALSE, 3, "1.1" },
-  { TRUE,  FALSE, 3, "1.3" },
-  { FALSE, FALSE, 3, "2.3" },
-  { FALSE, TRUE,  2, "3.3" },  /* WHEN_NEXT is ignored due to INJECT  */
-  { TRUE,  FALSE, 3, "1.2" },
-  { TRUE,  FALSE, 4, NULL  },
-  { TRUE,  FALSE, 4, "1.4" },
-  { FALSE, FALSE, 4, "2.4" },
-  { FALSE, TRUE,  6, "3.4" },  /* WHEN_NEXT is ignored due to INJECT  */
-  { TRUE,  FALSE, 6, "1.6" },
-  { FALSE, FALSE, 6, "2.6" },
-  { FALSE, TRUE,  7, "3.6" },  /* WHEN_NEXT is ignored due to INJECT  */
-  { TRUE,  FALSE, 6, "1.7" },
-  { 0 } /* unused */
-};
-
-#define PBTEST_SET_PAUSED(ctx) \
-  (PBTEST_THIS_REQ(ctx) && pbtest_step < 14                  \
-   ? (ctx)->paused = pbtest_description[pbtest_step].paused  \
-   : FALSE)
-
-#define PBTEST_MAYBE_STEP(ctx, force) maybe_next_step(ctx, force)
-
-#define PBTEST_FORCE_SPILL(ctx) (PBTEST_THIS_REQ(ctx) && pbtest_step == 6)
-
-#define PBTEST_THIS_REQ(ctx) \
-  ((ctx)->response_type != NULL \
-   && strcmp((ctx)->response_type, "update-report") == 0)
-
-#else /* PBTEST_ACTIVE  */
-
-/* Be wary with the definition of these macros so that we don't
-   end up with "statement with no effect" warnings. Obviously, this
-   depends upon particular usage, which is easy to verify.  */
-#define PBTEST_SET_PAUSED(ctx)  /* empty */
-#define PBTEST_MAYBE_STEP(ctx, force)  /* empty */
-
-#define PBTEST_FORCE_SPILL(ctx) FALSE
-#define PBTEST_THIS_REQ(ctx) FALSE
-
-#endif /* PBTEST_ACTIVE  */
-
-
-
 static const apr_uint32_t serf_failure_map[][2] =
 {
   { SERF_SSL_CERT_NOTYETVALID,   SVN_AUTH_SSL_NOTYETVALID },
@@ -504,11 +436,13 @@ svn_ra_serf__conn_setup(apr_socket_t *so
   return status;
 }
 
-serf_bucket_t*
-svn_ra_serf__accept_response(serf_request_t *request,
-                             serf_bucket_t *stream,
-                             void *acceptor_baton,
-                             apr_pool_t *pool)
+
+/* Our default serf response acceptor.  */
+static serf_bucket_t *
+accept_response(serf_request_t *request,
+                serf_bucket_t *stream,
+                void *acceptor_baton,
+                apr_pool_t *pool)
 {
   serf_bucket_t *c;
   serf_bucket_alloc_t *bkt_alloc;
@@ -519,7 +453,9 @@ svn_ra_serf__accept_response(serf_reques
   return serf_bucket_response_create(c, bkt_alloc);
 }
 
-static serf_bucket_t*
+
+/* Custom response acceptor for HEAD requests.  */
+static serf_bucket_t *
 accept_head(serf_request_t *request,
             serf_bucket_t *stream,
             void *acceptor_baton,
@@ -527,8 +463,7 @@ accept_head(serf_request_t *request,
 {
   serf_bucket_t *response;
 
-  response = svn_ra_serf__accept_response(request, stream, acceptor_baton,
-                                          pool);
+  response = accept_response(request, stream, acceptor_baton, pool);
 
   /* We know we shouldn't get a response body. */
   serf_bucket_response_set_head(response);
@@ -698,41 +633,91 @@ apr_status_t svn_ra_serf__handle_client_
 }
 
 
-svn_error_t *
-svn_ra_serf__setup_serf_req(serf_request_t *request,
-                            serf_bucket_t **req_bkt,
-                            serf_bucket_t **ret_hdrs_bkt,
-                            svn_ra_serf__connection_t *conn,
-                            const char *method, const char *url,
-                            serf_bucket_t *body_bkt, const char *content_type)
-{
-  serf_bucket_t *hdrs_bkt;
+/*
+ * Given a REQUEST on connection CONN, construct a request bucket for it,
+ * returning the bucket in *REQ_BKT.
+ *
+ * If HDRS_BKT is not-NULL, it will be set to a headers_bucket that
+ * corresponds to the new request.
+ *
+ * The request will be METHOD at URL.
+ *
+ * If BODY_BKT is not-NULL, it will be sent as the request body.
+ *
+ * If CONTENT_TYPE is not-NULL, it will be sent as the Content-Type header.
+ *
+ * REQUEST_POOL should live for the duration of the request. Serf will
+ * construct this and provide it to the request_setup callback, so we
+ * should just use that one.
+ */
+static svn_error_t *
+setup_serf_req(serf_request_t *request,
+               serf_bucket_t **req_bkt,
+               serf_bucket_t **hdrs_bkt,
+               svn_ra_serf__connection_t *conn,
+               const char *method, const char *url,
+               serf_bucket_t *body_bkt, const char *content_type,
+               apr_pool_t *request_pool,
+               apr_pool_t *scratch_pool)
+{
+  serf_bucket_alloc_t *allocator = serf_request_get_alloc(request);
+
+#if SERF_VERSION_AT_LEAST(1, 1, 0)
+  svn_spillbuf_t *buf;
+
+  if (conn->http10 && body_bkt != NULL)
+    {
+      /* Ugh. Use HTTP/1.0 to talk to the server because we don't know if
+         it speaks HTTP/1.1 (and thus, chunked requests), or because the
+         server actually responded as only supporting HTTP/1.0.
+
+         We'll take the existing body_bkt, spool it into a spillbuf, and
+         then wrap a bucket around that spillbuf. The spillbuf will give
+         us the Content-Length value.  */
+      SVN_ERR(svn_ra_serf__copy_into_spillbuf(&buf, body_bkt,
+                                              request_pool,
+                                              scratch_pool));
+      body_bkt = svn_ra_serf__create_sb_bucket(buf, allocator,
+                                               request_pool,
+                                               scratch_pool);
+    }
+#endif
 
   /* Create a request bucket.  Note that this sucker is kind enough to
      add a "Host" header for us.  */
-  *req_bkt =
-    serf_request_bucket_request_create(request, method, url, body_bkt,
-                                       serf_request_get_alloc(request));
+  *req_bkt = serf_request_bucket_request_create(request, method, url,
+                                                body_bkt, allocator);
 
-  hdrs_bkt = serf_bucket_request_get_headers(*req_bkt);
-  serf_bucket_headers_setn(hdrs_bkt, "User-Agent", conn->useragent);
+  /* Set the Content-Length value. This will also trigger an HTTP/1.0
+     request (rather than the default chunked request).  */
+#if SERF_VERSION_AT_LEAST(1, 1, 0)
+  if (conn->http10)
+    {
+      if (body_bkt == NULL)
+        serf_bucket_request_set_CL(*req_bkt, 0);
+      else
+        serf_bucket_request_set_CL(*req_bkt, svn_spillbuf__get_size(buf));
+    }
+#endif
+
+  *hdrs_bkt = serf_bucket_request_get_headers(*req_bkt);
+
+  /* We use serf_bucket_headers_setn() because the string below have a
+     lifetime longer than this bucket. Thus, there is no need to copy
+     the header values.  */
+  serf_bucket_headers_setn(*hdrs_bkt, "User-Agent", conn->useragent);
 
   if (content_type)
     {
-      serf_bucket_headers_setn(hdrs_bkt, "Content-Type", content_type);
+      serf_bucket_headers_setn(*hdrs_bkt, "Content-Type", content_type);
     }
 
   /* These headers need to be sent with every request; see issue #3255
      ("mod_dav_svn does not pass client capabilities to start-commit
      hooks") for why. */
-  serf_bucket_headers_set(hdrs_bkt, "DAV", SVN_DAV_NS_DAV_SVN_DEPTH);
-  serf_bucket_headers_set(hdrs_bkt, "DAV", SVN_DAV_NS_DAV_SVN_MERGEINFO);
-  serf_bucket_headers_set(hdrs_bkt, "DAV", SVN_DAV_NS_DAV_SVN_LOG_REVPROPS);
-
-  if (ret_hdrs_bkt)
-    {
-      *ret_hdrs_bkt = hdrs_bkt;
-    }
+  serf_bucket_headers_setn(*hdrs_bkt, "DAV", SVN_DAV_NS_DAV_SVN_DEPTH);
+  serf_bucket_headers_setn(*hdrs_bkt, "DAV", SVN_DAV_NS_DAV_SVN_MERGEINFO);
+  serf_bucket_headers_setn(*hdrs_bkt, "DAV", SVN_DAV_NS_DAV_SVN_LOG_REVPROPS);
 
   return SVN_NO_ERROR;
 }
@@ -801,11 +786,11 @@ svn_ra_serf__context_run_wait(svn_boolea
  */
 static svn_error_t *
 start_error(svn_ra_serf__xml_parser_t *parser,
-            void *userData,
             svn_ra_serf__dav_props_t name,
-            const char **attrs)
+            const char **attrs,
+            apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__server_error_t *ctx = userData;
+  svn_ra_serf__server_error_t *ctx = parser->user_data;
 
   if (!ctx->in_error &&
       strcmp(name.namespace, "DAV:") == 0 &&
@@ -843,10 +828,10 @@ start_error(svn_ra_serf__xml_parser_t *p
  */
 static svn_error_t *
 end_error(svn_ra_serf__xml_parser_t *parser,
-          void *userData,
-          svn_ra_serf__dav_props_t name)
+          svn_ra_serf__dav_props_t name,
+          apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__server_error_t *ctx = userData;
+  svn_ra_serf__server_error_t *ctx = parser->user_data;
 
   if (ctx->in_error &&
       strcmp(name.namespace, "DAV:") == 0 &&
@@ -881,11 +866,11 @@ end_error(svn_ra_serf__xml_parser_t *par
  */
 static svn_error_t *
 cdata_error(svn_ra_serf__xml_parser_t *parser,
-            void *userData,
             const char *data,
-            apr_size_t len)
+            apr_size_t len,
+            apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__server_error_t *ctx = userData;
+  svn_ra_serf__server_error_t *ctx = parser->user_data;
 
   if (ctx->collect_cdata)
     {
@@ -1068,11 +1053,11 @@ parse_dav_status(int *status_code_out, s
  */
 static svn_error_t *
 start_207(svn_ra_serf__xml_parser_t *parser,
-          void *userData,
           svn_ra_serf__dav_props_t name,
-          const char **attrs)
+          const char **attrs,
+          apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__server_error_t *ctx = userData;
+  svn_ra_serf__server_error_t *ctx = parser->user_data;
 
   if (!ctx->in_error &&
       strcmp(name.namespace, "DAV:") == 0 &&
@@ -1103,10 +1088,10 @@ start_207(svn_ra_serf__xml_parser_t *par
  */
 static svn_error_t *
 end_207(svn_ra_serf__xml_parser_t *parser,
-        void *userData,
-        svn_ra_serf__dav_props_t name)
+        svn_ra_serf__dav_props_t name,
+        apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__server_error_t *ctx = userData;
+  svn_ra_serf__server_error_t *ctx = parser->user_data;
 
   if (ctx->in_error &&
       strcmp(name.namespace, "DAV:") == 0 &&
@@ -1147,11 +1132,11 @@ end_207(svn_ra_serf__xml_parser_t *parse
  */
 static svn_error_t *
 cdata_207(svn_ra_serf__xml_parser_t *parser,
-          void *userData,
           const char *data,
-          apr_size_t len)
+          apr_size_t len,
+          apr_pool_t *scratch_pool)
 {
-  svn_ra_serf__server_error_t *ctx = userData;
+  svn_ra_serf__server_error_t *ctx = parser->user_data;
 
   if (ctx->collect_cdata)
     {
@@ -1252,11 +1237,14 @@ svn_ra_serf__handle_multistatus_only(ser
   return svn_error_trace(err);
 }
 
+
+/* Conforms to Expat's XML_StartElementHandler  */
 static void
 start_xml(void *userData, const char *raw_name, const char **attrs)
 {
   svn_ra_serf__xml_parser_t *parser = userData;
   svn_ra_serf__dav_props_t name;
+  apr_pool_t *scratch_pool;
 
   if (parser->error)
     return;
@@ -1264,31 +1252,43 @@ start_xml(void *userData, const char *ra
   if (!parser->state)
     svn_ra_serf__xml_push_state(parser, 0);
 
+  /* ### get a real scratch_pool  */
+  scratch_pool = parser->state->pool;
+
   svn_ra_serf__define_ns(&parser->state->ns_list, attrs, parser->state->pool);
 
   svn_ra_serf__expand_ns(&name, parser->state->ns_list, raw_name);
 
-  parser->error = parser->start(parser, parser->user_data, name, attrs);
+  parser->error = parser->start(parser, name, attrs, scratch_pool);
 }
 
+
+/* Conforms to Expat's XML_EndElementHandler  */
 static void
 end_xml(void *userData, const char *raw_name)
 {
   svn_ra_serf__xml_parser_t *parser = userData;
   svn_ra_serf__dav_props_t name;
+  apr_pool_t *scratch_pool;
 
   if (parser->error)
     return;
 
+  /* ### get a real scratch_pool  */
+  scratch_pool = parser->state->pool;
+
   svn_ra_serf__expand_ns(&name, parser->state->ns_list, raw_name);
 
-  parser->error = parser->end(parser, parser->user_data, name);
+  parser->error = parser->end(parser, name, scratch_pool);
 }
 
+
+/* Conforms to Expat's XML_CharacterDataHandler  */
 static void
 cdata_xml(void *userData, const char *data, int len)
 {
   svn_ra_serf__xml_parser_t *parser = userData;
+  apr_pool_t *scratch_pool;
 
   if (parser->error)
     return;
@@ -1296,7 +1296,10 @@ cdata_xml(void *userData, const char *da
   if (!parser->state)
     svn_ra_serf__xml_push_state(parser, 0);
 
-  parser->error = parser->cdata(parser, parser->user_data, data, len);
+  /* ### get a real scratch_pool  */
+  scratch_pool = parser->state->pool;
+
+  parser->error = parser->cdata(parser, data, len, scratch_pool);
 }
 
 /* Flip the requisite bits in CTX to indicate that processing of the
@@ -1319,54 +1322,6 @@ add_done_item(svn_ra_serf__xml_parser_t 
 }
 
 
-#ifdef PBTEST_ACTIVE
-
-/* Determine whether we should move to the next step. Print out the
-   transition for debugging purposes. If FORCE is TRUE, then we
-   definitely make a step (injection has completed).  */
-static void
-maybe_next_step(svn_ra_serf__xml_parser_t *parser, svn_boolean_t force)
-{
-  const pbtest_desc_t *desc;
-  int state;
-
-  /* This would fail the state transition, but for clarity... just return
-     when the testing has completed.  */
-  if (pbtest_step == 14)
-    return;
-
-  /* If this is not the request running the test, then exit.  */
-  if (!PBTEST_THIS_REQ(parser))
-    return;
-
-  desc = &pbtest_description[pbtest_step];
-  state = PBTEST_STATE(parser->pending);
-
-  /* Forced? ... or reached target state?  */
-  if (force || state == desc->when_next)
-    {
-      ++pbtest_step;
-
-      if (desc->completed != NULL)
-        SVN_DBG(("PBTEST: completed TEST %s\n", desc->completed));
-
-      /* Pause the parser based on the new step's config.  */
-      ++desc;
-      parser->paused = desc->paused;
-
-      SVN_DBG(("PBTEST: advanced: step=%d  paused=%d  inject=%d  state=%d\n",
-               pbtest_step, desc->paused, desc->inject, state));
-    }
-  else
-    {
-      SVN_DBG(("PBTEST: step[%d]: state=%d  waiting_for=%d\n",
-               pbtest_step, state, desc->when_next));
-    }
-}
-
-#endif /* PBTEST_ACTIVE  */
-
-
 /* Get a buffer from the parsing context. It will come from the free list,
    or allocated as necessary.  */
 static struct pending_buffer_t *
@@ -1410,18 +1365,10 @@ write_to_pending(svn_ra_serf__xml_parser
 
   /* We do not (yet) have a spill file, but the amount stored in memory
      has grown too large. Create the file and place the pending data into
-     the temporary file.
-
-     For testing purposes, there are points when we may want to
-     create the spill file, regardless.  */
-  if (PBTEST_FORCE_SPILL(ctx)
-      || (ctx->pending->spill == NULL
-          && ctx->pending->memory_size > SPILL_SIZE))
-    {
-#ifdef PBTEST_ACTIVE
-      /* Only allow a spill file for steps 6 or later.  */
-      if (!PBTEST_THIS_REQ(ctx) || pbtest_step >= 6)
-#endif
+     the temporary file.  */
+  if (ctx->pending->spill == NULL
+      && ctx->pending->memory_size > SPILL_SIZE)
+    {
       SVN_ERR(svn_io_open_unique_file3(&ctx->pending->spill,
                                        NULL /* temp_path */,
                                        NULL /* dirpath */,
@@ -1496,10 +1443,6 @@ inject_to_parser(svn_ra_serf__xml_parser
   if (ctx->error && !ctx->ignore_errors)
     return svn_error_trace(ctx->error);
 
-  /* We may want to ignore the callbacks choice for the PAUSED flag.
-     Set this value, as appropriate.  */
-  PBTEST_SET_PAUSED(ctx);
-
   return SVN_NO_ERROR;
 }
 
@@ -1527,19 +1470,6 @@ svn_ra_serf__process_pending(svn_ra_serf
   svn_error_t *err;
   apr_off_t output_unused;
 
-  /* We may need to repair the PAUSED state when testing.  */
-  PBTEST_SET_PAUSED(parser);
-
-#ifdef PBTEST_ACTIVE
-  /* If this step should not inject content, then fast-path exit.  */
-  if (PBTEST_THIS_REQ(parser)
-      && pbtest_step < 14 && !pbtest_description[pbtest_step].inject)
-    {
-      SVN_DBG(("PBTEST: process: injection disabled\n"));
-      return SVN_NO_ERROR;
-    }
-#endif
-
   /* Fast path exit: already paused, nothing to do, or already done.  */
   if (parser->paused || parser->pending == NULL || *parser->done)
     return SVN_NO_ERROR;
@@ -1577,18 +1507,6 @@ svn_ra_serf__process_pending(svn_ra_serf
         return SVN_NO_ERROR;
     }
 
-#ifdef PBTEST_ACTIVE
-  /* For steps 4 and 9, we wait until all of the memory content has been
-     injected. At that point, we can take another step which will pause
-     the parser, and we'll need to exit.  */
-  if (PBTEST_THIS_REQ(parser)
-      && (pbtest_step == 4 || pbtest_step == 9))
-    {
-      PBTEST_MAYBE_STEP(parser, TRUE);
-      return SVN_NO_ERROR;
-    }
-#endif
-
   /* If we don't have a spill file, then we've exhausted all
      pending content.  */
   if (parser->pending->spill == NULL)
@@ -1643,11 +1561,6 @@ svn_ra_serf__process_pending(svn_ra_serf
      the network, then we're completely done with the parsing.  */
   if (parser->pending->network_eof)
     {
-#ifdef PBTEST_ACTIVE
-      if (PBTEST_THIS_REQ(parser))
-        SVN_DBG(("process: terminating parse.\n"));
-#endif
-
       SVN_ERR_ASSERT(parser->xmlp != NULL);
 
       /* Tell the parser that no more content will be parsed. Ignore the
@@ -1659,10 +1572,6 @@ svn_ra_serf__process_pending(svn_ra_serf
       add_done_item(parser);
     }
 
-  /* For testing step 12, we have written all of the disk content. This
-     will advance to step 13 and pause the parser again.  */
-  PBTEST_MAYBE_STEP(parser, TRUE);
-
   return SVN_NO_ERROR;
 }
 
@@ -1738,13 +1647,6 @@ svn_ra_serf__handle_xml_parser(serf_requ
         {
           XML_SetCharacterDataHandler(ctx->xmlp, cdata_xml);
         }
-
-      /* This is the first invocation. If we're looking at an update
-         report, then move to step 1 of the testing sequence.  */
-#ifdef PBTEST_ACTIVE
-      if (PBTEST_THIS_REQ(ctx))
-        PBTEST_MAYBE_STEP(ctx, TRUE);
-#endif
     }
 
   /* If we are storing content into a spill file, then move to the end of
@@ -1800,24 +1702,6 @@ svn_ra_serf__handle_xml_parser(serf_requ
           ctx->skip_size = 0;
         }
 
-      /* Ensure that the parser's PAUSED state is correct before we test
-         the flag.  */
-      PBTEST_SET_PAUSED(ctx);
-
-#ifdef PBTEST_ACTIVE
-      if (PBTEST_THIS_REQ(ctx))
-        {
-          SVN_DBG(("response: len=%d  paused=%d  status=%08x\n",
-                   (int)len, ctx->paused, status));
-#if 0
-          /* ### DATA is not necessarily NUL-terminated, but this
-             ### generally works. so if you want to see content... */
-          if (len > 0)
-            SVN_DBG(("content=%s\n", data));
-#endif
-        }
-#endif
-
       /* Note: once the callbacks invoked by inject_to_parser() sets the
          PAUSED flag, then it will not be cleared. write_to_pending() will
          only save the content. Logic outside of serf_context_run() will
@@ -1830,13 +1714,6 @@ svn_ra_serf__handle_xml_parser(serf_requ
       if (ctx->paused || HAS_PENDING_DATA(ctx->pending))
         {
           err = write_to_pending(ctx, data, len, pool);
-
-          /* We may have a transition to a next step.
-
-             Note: this only happens on writing to PENDING. If the
-             parser is unpaused, then we will never change state within
-             this network-reading loop.  */
-          PBTEST_MAYBE_STEP(ctx, FALSE);
         }
       else
         {
@@ -1866,20 +1743,10 @@ svn_ra_serf__handle_xml_parser(serf_requ
           if (ctx->pending != NULL)
             ctx->pending->network_eof = TRUE;
 
-#ifdef PBTEST_ACTIVE
-          if (PBTEST_THIS_REQ(ctx))
-            SVN_DBG(("network: reached EOF.\n"));
-#endif
-
           /* We just hit the end of the network content. If we have nothing
              in the PENDING structures, then we're completely done.  */
           if (!HAS_PENDING_DATA(ctx->pending))
             {
-#ifdef PBTEST_ACTIVE
-              if (PBTEST_THIS_REQ(ctx))
-                SVN_DBG(("network: terminating parse.\n"));
-#endif
-
               SVN_ERR_ASSERT(ctx->xmlp != NULL);
 
               /* Ignore the return status. We just don't care.  */
@@ -2153,40 +2020,26 @@ handle_response_cb(serf_request_t *reque
   return serf_status;
 }
 
-/* If the CTX->setup() callback is non-NULL, invoke it to carry out the
-   majority of the serf_request_setup_t implementation.  Otherwise, perform
-   default setup, with special handling for HEAD requests, and finer-grained
-   callbacks invoked (if non-NULL) to produce the request headers and
-   body. */
+/* Perform basic request setup, with special handling for HEAD requests,
+   and finer-grained callbacks invoked (if non-NULL) to produce the request
+   headers and body. */
 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 *pool)
+              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 *headers_bkt;
 
-  *acceptor = svn_ra_serf__accept_response;
+  /* Default response acceptor.  */
+  *acceptor = accept_response;
   *acceptor_baton = ctx->session;
 
-  if (ctx->setup)
-    {
-      svn_ra_serf__response_handler_t response_handler;
-      void *response_baton;
-
-      SVN_ERR(ctx->setup(request, ctx->setup_baton, req_bkt,
-                         acceptor, acceptor_baton,
-                         &response_handler, &response_baton,
-                         pool));
-
-      ctx->response_handler = response_handler;
-      ctx->response_baton = response_baton;
-    }
-  else
     {
       serf_bucket_t *body_bkt;
       serf_bucket_alloc_t *bkt_alloc = serf_request_get_alloc(request);
@@ -2198,22 +2051,25 @@ setup_request(serf_request_t *request,
 
       if (ctx->body_delegate)
         {
+          /* ### should pass the scratch_pool  */
           SVN_ERR(ctx->body_delegate(&body_bkt, ctx->body_delegate_baton,
-                                     bkt_alloc, pool));
+                                     bkt_alloc, request_pool));
         }
       else
         {
           body_bkt = NULL;
         }
 
-      SVN_ERR(svn_ra_serf__setup_serf_req(request, req_bkt, &headers_bkt,
-                                          ctx->conn, ctx->method, ctx->path,
-                                          body_bkt, ctx->body_type));
+      SVN_ERR(setup_serf_req(request, req_bkt, &headers_bkt,
+                             ctx->conn, ctx->method, ctx->path,
+                             body_bkt, ctx->body_type,
+                             request_pool, scratch_pool));
 
       if (ctx->header_delegate)
         {
+          /* ### should pass the scratch_pool  */
           SVN_ERR(ctx->header_delegate(headers_bkt, ctx->header_delegate_baton,
-                                       pool));
+                                       request_pool));
         }
     }
 
@@ -2239,11 +2095,15 @@ setup_request_cb(serf_request_t *request
   svn_ra_serf__handler_t *ctx = setup_baton;
   svn_error_t *err;
 
+  /* ### construct a scratch_pool? serf gives us a pool that will live for
+     ### the duration of the request.  */
+  apr_pool_t *scratch_pool = pool;
+
   err = setup_request(request, ctx,
                       req_bkt,
                       acceptor, acceptor_baton,
                       handler, handler_baton,
-                      pool);
+                      pool /* request_pool */, scratch_pool);
 
   if (err)
     {

Modified: subversion/branches/revprop-packing/subversion/libsvn_ra_serf/xml.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_ra_serf/xml.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_ra_serf/xml.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_ra_serf/xml.c Fri Mar 30 13:55:26 2012
@@ -124,34 +124,6 @@ svn_ra_serf__expand_ns(svn_ra_serf__dav_
   return;
 }
 
-void
-svn_ra_serf__expand_string(const char **cur, apr_size_t *cur_len,
-                           const char *new, apr_size_t new_len,
-                           apr_pool_t *pool)
-{
-  if (!*cur)
-    {
-      *cur = apr_pstrmemdup(pool, new, new_len);
-      *cur_len = new_len;
-    }
-  else
-    {
-      char *new_cur;
-
-      /* append the data we received before. */
-      new_cur = apr_palloc(pool, *cur_len + new_len + 1);
-
-      memcpy(new_cur, *cur, *cur_len);
-      memcpy(new_cur + *cur_len, new, new_len);
-
-      /* NULL-term our new string */
-      new_cur[*cur_len + new_len] = '\0';
-
-      /* update our length */
-      *cur_len += new_len;
-      *cur = new_cur;
-    }
-}
 
 #define XML_HEADER "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
 

Modified: subversion/branches/revprop-packing/subversion/libsvn_repos/fs-wrap.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_repos/fs-wrap.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_repos/fs-wrap.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_repos/fs-wrap.c Fri Mar 30 13:55:26 2012
@@ -162,7 +162,7 @@ svn_repos__validate_prop(const char *nam
                          const svn_string_t *value,
                          apr_pool_t *pool)
 {
-  svn_prop_kind_t kind = svn_property_kind(NULL, name);
+  svn_prop_kind_t kind = svn_property_kind2(name);
 
   /* Disallow setting non-regular properties. */
   if (kind != svn_prop_regular_kind)

Modified: subversion/branches/revprop-packing/subversion/libsvn_repos/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_repos/log.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_repos/log.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_repos/log.c Fri Mar 30 13:55:26 2012
@@ -1742,7 +1742,7 @@ reduce_search(apr_array_header_t *paths,
       if (!ranges)
         continue;
 
-      /* ranges is ordered, could we use some sort of binay search
+      /* ranges is ordered, could we use some sort of binary search
          rather than iterating? */
       for (j = 0; j < ranges->nelts; ++j)
         {

Modified: subversion/branches/revprop-packing/subversion/libsvn_repos/rev_hunt.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_repos/rev_hunt.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_repos/rev_hunt.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_repos/rev_hunt.c Fri Mar 30 13:55:26 2012
@@ -154,6 +154,8 @@ svn_repos_get_committed_info(svn_revnum_
                              const char *path,
                              apr_pool_t *pool)
 {
+  apr_hash_t *revprops;
+  
   svn_fs_t *fs = svn_fs_root_fs(root);
 
   /* ### It might be simpler just to declare that revision
@@ -164,13 +166,16 @@ svn_repos_get_committed_info(svn_revnum_
   /* Get the CR field out of the node's skel. */
   SVN_ERR(svn_fs_node_created_rev(committed_rev, root, path, pool));
 
-  /* Get the date property of this revision. */
-  SVN_ERR(svn_fs_revision_prop(&committed_date_s, fs, *committed_rev,
-                               SVN_PROP_REVISION_DATE, pool));
-
-  /* Get the author property of this revision. */
-  SVN_ERR(svn_fs_revision_prop(&last_author_s, fs, *committed_rev,
-                               SVN_PROP_REVISION_AUTHOR, pool));
+  /* Get the revision properties of this revision. */
+  SVN_ERR(svn_fs_revision_proplist(&revprops, fs, *committed_rev, pool));
+
+  /* Extract date and author from these revprops. */
+  committed_date_s = apr_hash_get(revprops,
+                                  SVN_PROP_REVISION_DATE,
+                                  sizeof(SVN_PROP_REVISION_DATE)-1);
+  last_author_s = apr_hash_get(revprops,
+                               SVN_PROP_REVISION_AUTHOR,
+                               sizeof(SVN_PROP_REVISION_AUTHOR)-1);
 
   *committed_date = committed_date_s ? committed_date_s->data : NULL;
   *last_author = last_author_s ? last_author_s->data : NULL;

Modified: subversion/branches/revprop-packing/subversion/libsvn_subr/gpg_agent.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_subr/gpg_agent.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_subr/gpg_agent.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_subr/gpg_agent.c Fri Mar 30 13:55:26 2012
@@ -413,12 +413,11 @@ simple_gpg_agent_first_creds(void **cred
                              const char *realmstring,
                              apr_pool_t *pool)
 {
-  return svn_auth__simple_first_creds_helper(credentials,
-                                             iter_baton, provider_baton,
-                                             parameters, realmstring,
-                                             password_get_gpg_agent,
-                                             SVN_AUTH__GPG_AGENT_PASSWORD_TYPE,
-                                             pool);
+  return svn_auth__simple_creds_cache_get(credentials, iter_baton,
+                                          provider_baton, parameters,
+                                          realmstring, password_get_gpg_agent,
+                                          SVN_AUTH__GPG_AGENT_PASSWORD_TYPE,
+                                          pool);
 }
 
 
@@ -431,12 +430,11 @@ simple_gpg_agent_save_creds(svn_boolean_
                             const char *realmstring,
                             apr_pool_t *pool)
 {
-  return svn_auth__simple_save_creds_helper(saved, credentials,
-                                            provider_baton, parameters,
-                                            realmstring,
-                                            password_set_gpg_agent,
-                                            SVN_AUTH__GPG_AGENT_PASSWORD_TYPE,
-                                            pool);
+  return svn_auth__simple_creds_cache_set(saved, credentials,
+                                          provider_baton, parameters,
+                                          realmstring, password_set_gpg_agent,
+                                          SVN_AUTH__GPG_AGENT_PASSWORD_TYPE,
+                                          pool);
 }
 
 

Modified: subversion/branches/revprop-packing/subversion/libsvn_subr/macos_keychain.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_subr/macos_keychain.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_subr/macos_keychain.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_subr/macos_keychain.c Fri Mar 30 13:55:26 2012
@@ -160,14 +160,14 @@ keychain_simple_first_creds(void **crede
                             const char *realmstring,
                             apr_pool_t *pool)
 {
-  return svn_auth__simple_first_creds_helper(credentials,
-                                             iter_baton,
-                                             provider_baton,
-                                             parameters,
-                                             realmstring,
-                                             keychain_password_get,
-                                             SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
-                                             pool);
+  return svn_auth__simple_creds_cache_get(credentials,
+                                          iter_baton,
+                                          provider_baton,
+                                          parameters,
+                                          realmstring,
+                                          keychain_password_get,
+                                          SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
+                                          pool);
 }
 
 /* Save encrypted credentials to the simple provider's cache. */
@@ -179,13 +179,13 @@ keychain_simple_save_creds(svn_boolean_t
                            const char *realmstring,
                            apr_pool_t *pool)
 {
-  return svn_auth__simple_save_creds_helper(saved, credentials,
-                                            provider_baton,
-                                            parameters,
-                                            realmstring,
-                                            keychain_password_set,
-                                            SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
-                                            pool);
+  return svn_auth__simple_creds_cache_set(saved, credentials,
+                                          provider_baton,
+                                          parameters,
+                                          realmstring,
+                                          keychain_password_set,
+                                          SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
+                                          pool);
 }
 
 static const svn_auth_provider_t keychain_simple_provider = {
@@ -205,13 +205,12 @@ keychain_ssl_client_cert_pw_first_creds(
                                         const char *realmstring,
                                         apr_pool_t *pool)
 {
-  return svn_auth__ssl_client_cert_pw_file_first_creds_helper
-           (credentials,
-            iter_baton, provider_baton,
-            parameters, realmstring,
-            keychain_password_get,
-            SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
-            pool);
+  return svn_auth__ssl_client_cert_pw_cache_get(credentials,
+                                                iter_baton, provider_baton,
+                                                parameters, realmstring,
+                                                keychain_password_get,
+                                                SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
+                                                pool);
 }
 
 /* Save encrypted credentials to the ssl client cert password provider's
@@ -224,13 +223,12 @@ keychain_ssl_client_cert_pw_save_creds(s
                                        const char *realmstring,
                                        apr_pool_t *pool)
 {
-  return svn_auth__ssl_client_cert_pw_file_save_creds_helper
-           (saved, credentials,
-            provider_baton, parameters,
-            realmstring,
-            keychain_password_set,
-            SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
-            pool);
+  return svn_auth__ssl_client_cert_pw_cache_set(saved, credentials,
+                                                provider_baton, parameters,
+                                                realmstring,
+                                                keychain_password_set,
+                                                SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
+                                                pool);
 }
 
 static const svn_auth_provider_t keychain_ssl_client_cert_pw_provider = {

Modified: subversion/branches/revprop-packing/subversion/libsvn_subr/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_subr/mergeinfo.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_subr/mergeinfo.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_subr/mergeinfo.c Fri Mar 30 13:55:26 2012
@@ -2111,7 +2111,6 @@ svn_mergeinfo__remove_prefix_from_catalo
                                           apr_pool_t *pool)
 {
   apr_hash_index_t *hi;
-  apr_ssize_t prefix_len = strlen(prefix_path);
 
   SVN_ERR_ASSERT(prefix_path[0] == '/');
 
@@ -2120,23 +2119,13 @@ svn_mergeinfo__remove_prefix_from_catalo
   for (hi = apr_hash_first(pool, in_catalog); hi; hi = apr_hash_next(hi))
     {
       const char *original_path = svn__apr_hash_index_key(hi);
-      apr_ssize_t klen = svn__apr_hash_index_klen(hi);
       svn_mergeinfo_t value = svn__apr_hash_index_val(hi);
-      apr_ssize_t padding = 0;
+      const char *new_path;
 
-      SVN_ERR_ASSERT(klen >= prefix_len);
-      SVN_ERR_ASSERT(svn_fspath__skip_ancestor(prefix_path, original_path));
+      new_path = svn_fspath__skip_ancestor(prefix_path, original_path);
+      SVN_ERR_ASSERT(new_path);
 
-      /* If the ORIGINAL_PATH doesn't match the PREFIX_PATH exactly
-         and we're not simply removing a single leading slash (such as
-         when PREFIX_PATH is "/"), we advance our string offset by an
-         extra character (to get past the directory separator that
-         follows the prefix).  */
-      if ((strcmp(original_path, prefix_path) != 0) && (prefix_len != 1))
-        padding = 1;
-
-      apr_hash_set(*out_catalog, original_path + prefix_len + padding,
-                   klen - prefix_len - padding, value);
+      apr_hash_set(*out_catalog, new_path, APR_HASH_KEY_STRING, value);
     }
 
   return SVN_NO_ERROR;

Modified: subversion/branches/revprop-packing/subversion/libsvn_subr/properties.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_subr/properties.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_subr/properties.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_subr/properties.c Fri Mar 30 13:55:26 2012
@@ -62,31 +62,42 @@ svn_prop_has_svn_prop(const apr_hash_t *
 }
 
 
+#define SIZEOF_WC_PREFIX (sizeof(SVN_PROP_WC_PREFIX) - 1)
+#define SIZEOF_ENTRY_PREFIX (sizeof(SVN_PROP_ENTRY_PREFIX) - 1)
+
+svn_prop_kind_t
+svn_property_kind2(const char *prop_name)
+{
+
+  if (strncmp(prop_name, SVN_PROP_WC_PREFIX, SIZEOF_WC_PREFIX) == 0)
+    return svn_prop_wc_kind;
+
+  if (strncmp(prop_name, SVN_PROP_ENTRY_PREFIX, SIZEOF_ENTRY_PREFIX) == 0)
+    return svn_prop_entry_kind;
+
+  return svn_prop_regular_kind;
+}
+
+
+/* NOTE: this function is deprecated, but we cannot move it to deprecated.c
+   because we need the SIZEOF_*_PREFIX constant symbols defined above.  */
 svn_prop_kind_t
 svn_property_kind(int *prefix_len,
                   const char *prop_name)
 {
-  apr_size_t wc_prefix_len = sizeof(SVN_PROP_WC_PREFIX) - 1;
-  apr_size_t entry_prefix_len = sizeof(SVN_PROP_ENTRY_PREFIX) - 1;
+  svn_prop_kind_t kind = svn_property_kind2(prop_name);
 
-  if (strncmp(prop_name, SVN_PROP_WC_PREFIX, wc_prefix_len) == 0)
-    {
-      if (prefix_len)
-        *prefix_len = (int) wc_prefix_len;
-      return svn_prop_wc_kind;
-    }
-
-  if (strncmp(prop_name, SVN_PROP_ENTRY_PREFIX, entry_prefix_len) == 0)
+  if (prefix_len)
     {
-      if (prefix_len)
-        *prefix_len = (int) entry_prefix_len;
-      return svn_prop_entry_kind;
+      if (kind == svn_prop_wc_kind)
+        *prefix_len = SIZEOF_WC_PREFIX;
+      else if (kind == svn_prop_entry_kind)
+        *prefix_len = SIZEOF_ENTRY_PREFIX;
+      else
+        *prefix_len = 0;
     }
 
-  /* else... */
-  if (prefix_len)
-    *prefix_len = 0;
-  return svn_prop_regular_kind;
+  return kind;
 }
 
 

Modified: subversion/branches/revprop-packing/subversion/libsvn_subr/simple_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_subr/simple_providers.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_subr/simple_providers.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_subr/simple_providers.c Fri Mar 30 13:55:26 2012
@@ -127,20 +127,16 @@ simple_username_get(const char **usernam
   return FALSE;
 }
 
-/* Common implementation for simple_first_creds. Uses PARAMETERS, REALMSTRING
-   and the simple auth provider's username and password cache to fill a set of
-   CREDENTIALS. PASSWORD_GET is used to obtain the password value.
-   PASSTYPE identifies the type of the cached password. CREDENTIALS are
-   allocated from POOL. */
+
 svn_error_t *
-svn_auth__simple_first_creds_helper(void **credentials,
-                                    void **iter_baton,
-                                    void *provider_baton,
-                                    apr_hash_t *parameters,
-                                    const char *realmstring,
-                                    svn_auth__password_get_t password_get,
-                                    const char *passtype,
-                                    apr_pool_t *pool)
+svn_auth__simple_creds_cache_get(void **credentials,
+                                 void **iter_baton,
+                                 void *provider_baton,
+                                 apr_hash_t *parameters,
+                                 const char *realmstring,
+                                 svn_auth__password_get_t password_get,
+                                 const char *passtype,
+                                 apr_pool_t *pool)
 {
   const char *config_dir = apr_hash_get(parameters,
                                         SVN_AUTH_PARAM_CONFIG_DIR,
@@ -307,19 +303,15 @@ svn_auth__simple_first_creds_helper(void
 }
 
 
-/* Common implementation for simple_save_creds. Uses PARAMETERS and
-   REALMSTRING to save a set of CREDENTIALS to the simple auth provider's
-   username and password cache. PASSWORD_SET is used to store the password.
-   PASSTYPE identifies the type of the cached password. Allocates from POOL. */
 svn_error_t *
-svn_auth__simple_save_creds_helper(svn_boolean_t *saved,
-                                   void *credentials,
-                                   void *provider_baton,
-                                   apr_hash_t *parameters,
-                                   const char *realmstring,
-                                   svn_auth__password_set_t password_set,
-                                   const char *passtype,
-                                   apr_pool_t *pool)
+svn_auth__simple_creds_cache_set(svn_boolean_t *saved,
+                                 void *credentials,
+                                 void *provider_baton,
+                                 apr_hash_t *parameters,
+                                 const char *realmstring,
+                                 svn_auth__password_set_t password_set,
+                                 const char *passtype,
+                                 apr_pool_t *pool)
 {
   svn_auth_cred_simple_t *creds = credentials;
   apr_hash_t *creds_hash = NULL;
@@ -501,14 +493,12 @@ simple_first_creds(void **credentials,
                    const char *realmstring,
                    apr_pool_t *pool)
 {
-  return svn_auth__simple_first_creds_helper(credentials,
-                                             iter_baton,
-                                             provider_baton,
-                                             parameters,
-                                             realmstring,
-                                             svn_auth__simple_password_get,
-                                             SVN_AUTH__SIMPLE_PASSWORD_TYPE,
-                                             pool);
+  return svn_auth__simple_creds_cache_get(credentials, iter_baton,
+                                          provider_baton, parameters,
+                                          realmstring,
+                                          svn_auth__simple_password_get,
+                                          SVN_AUTH__SIMPLE_PASSWORD_TYPE,
+                                          pool);
 }
 
 /* Save (unencrypted) credentials to the simple provider's cache. */
@@ -520,13 +510,11 @@ simple_save_creds(svn_boolean_t *saved,
                   const char *realmstring,
                   apr_pool_t *pool)
 {
-  return svn_auth__simple_save_creds_helper(saved, credentials,
-                                            provider_baton,
-                                            parameters,
-                                            realmstring,
-                                            svn_auth__simple_password_set,
-                                            SVN_AUTH__SIMPLE_PASSWORD_TYPE,
-                                            pool);
+  return svn_auth__simple_creds_cache_set(saved, credentials, provider_baton,
+                                          parameters, realmstring,
+                                          svn_auth__simple_password_set,
+                                          SVN_AUTH__SIMPLE_PASSWORD_TYPE,
+                                          pool);
 }
 
 static const svn_auth_provider_t simple_provider = {

Modified: subversion/branches/revprop-packing/subversion/libsvn_subr/spillbuf.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_subr/spillbuf.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_subr/spillbuf.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_subr/spillbuf.c Fri Mar 30 13:55:26 2012
@@ -579,7 +579,8 @@ write_handler_spillbuf(void *baton, cons
 {
   struct spillbuf_baton *sb = baton;
 
-  SVN_ERR(svn_spillbuf__reader_write(sb->reader, data, *len, sb->scratch_pool));
+  SVN_ERR(svn_spillbuf__reader_write(sb->reader, data, *len,
+                                     sb->scratch_pool));
 
   svn_pool_clear(sb->scratch_pool);
   return SVN_NO_ERROR;
@@ -592,7 +593,7 @@ svn_stream__from_spillbuf(apr_size_t blo
                           apr_pool_t *result_pool)
 {
   svn_stream_t *stream;
-  struct spillbuf_baton *sb = apr_pcalloc(result_pool, sizeof(*sb));
+  struct spillbuf_baton *sb = apr_palloc(result_pool, sizeof(*sb));
 
   sb->reader = svn_spillbuf__reader_create(blocksize, maxsize, result_pool);
   sb->scratch_pool = svn_pool_create(result_pool);
@@ -602,6 +603,5 @@ svn_stream__from_spillbuf(apr_size_t blo
   svn_stream_set_read(stream, read_handler_spillbuf);
   svn_stream_set_write(stream, write_handler_spillbuf);
 
-
   return stream;
 }

Modified: subversion/branches/revprop-packing/subversion/libsvn_subr/ssl_client_cert_pw_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_subr/ssl_client_cert_pw_providers.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_subr/ssl_client_cert_pw_providers.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_subr/ssl_client_cert_pw_providers.c Fri Mar 30 13:55:26 2012
@@ -104,15 +104,14 @@ svn_auth__ssl_client_cert_pw_set(svn_boo
 }
 
 svn_error_t *
-svn_auth__ssl_client_cert_pw_file_first_creds_helper
-  (void **credentials_p,
-   void **iter_baton,
-   void *provider_baton,
-   apr_hash_t *parameters,
-   const char *realmstring,
-   svn_auth__password_get_t passphrase_get,
-   const char *passtype,
-   apr_pool_t *pool)
+svn_auth__ssl_client_cert_pw_cache_get(void **credentials_p,
+                                       void **iter_baton,
+                                       void *provider_baton,
+                                       apr_hash_t *parameters,
+                                       const char *realmstring,
+                                       svn_auth__password_get_t passphrase_get,
+                                       const char *passtype,
+                                       apr_pool_t *pool)
 {
   svn_config_t *cfg = apr_hash_get(parameters,
                                    SVN_AUTH_PARAM_CONFIG_CATEGORY_SERVERS,
@@ -166,15 +165,14 @@ svn_auth__ssl_client_cert_pw_file_first_
 
 
 svn_error_t *
-svn_auth__ssl_client_cert_pw_file_save_creds_helper
-  (svn_boolean_t *saved,
-   void *credentials,
-   void *provider_baton,
-   apr_hash_t *parameters,
-   const char *realmstring,
-   svn_auth__password_set_t passphrase_set,
-   const char *passtype,
-   apr_pool_t *pool)
+svn_auth__ssl_client_cert_pw_cache_set(svn_boolean_t *saved,
+                                       void *credentials,
+                                       void *provider_baton,
+                                       apr_hash_t *parameters,
+                                       const char *realmstring,
+                                       svn_auth__password_set_t passphrase_set,
+                                       const char *passtype,
+                                       apr_pool_t *pool)
 {
   svn_auth_cred_ssl_client_cert_pw_t *creds = credentials;
   apr_hash_t *creds_hash = NULL;
@@ -348,15 +346,12 @@ ssl_client_cert_pw_file_first_credential
                                           const char *realmstring,
                                           apr_pool_t *pool)
 {
-  return svn_auth__ssl_client_cert_pw_file_first_creds_helper
-           (credentials_p,
-            iter_baton,
-            provider_baton,
-            parameters,
-            realmstring,
-            svn_auth__ssl_client_cert_pw_get,
-            SVN_AUTH__SIMPLE_PASSWORD_TYPE,
-            pool);
+  return svn_auth__ssl_client_cert_pw_cache_get(credentials_p, iter_baton,
+                                                provider_baton, parameters,
+                                                realmstring,
+                                                svn_auth__ssl_client_cert_pw_get,
+                                                SVN_AUTH__SIMPLE_PASSWORD_TYPE,
+                                                pool);
 }
 
 
@@ -370,14 +365,13 @@ ssl_client_cert_pw_file_save_credentials
                                          const char *realmstring,
                                          apr_pool_t *pool)
 {
-  return svn_auth__ssl_client_cert_pw_file_save_creds_helper
-           (saved, credentials,
-            provider_baton,
-            parameters,
-            realmstring,
-            svn_auth__ssl_client_cert_pw_set,
-            SVN_AUTH__SIMPLE_PASSWORD_TYPE,
-            pool);
+  return svn_auth__ssl_client_cert_pw_cache_set(saved, credentials,
+                                                provider_baton,
+                                                parameters,
+                                                realmstring,
+                                                svn_auth__ssl_client_cert_pw_set,
+                                                SVN_AUTH__SIMPLE_PASSWORD_TYPE,
+                                                pool);
 }
 
 

Modified: subversion/branches/revprop-packing/subversion/libsvn_subr/svn_string.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_subr/svn_string.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_subr/svn_string.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_subr/svn_string.c Fri Mar 30 13:55:26 2012
@@ -259,8 +259,8 @@ svn_stringbuf__morph_into_string(svn_str
 #endif
 
   /* Both, svn_string_t and svn_stringbuf_t are public API structures
-   * since a couple of releases now. Thus, we can rely on their precise
-   * layout not to change.
+   * since the svn epoch. Thus, we can rely on their precise layout not
+   * to change.
    *
    * It just so happens that svn_string_t is structurally equivalent
    * to the (data, len) sub-set of svn_stringbuf_t. There is also no

Modified: subversion/branches/revprop-packing/subversion/libsvn_subr/win32_crypto.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_subr/win32_crypto.c?rev=1307424&r1=1307423&r2=1307424&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_subr/win32_crypto.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_subr/win32_crypto.c Fri Mar 30 13:55:26 2012
@@ -135,14 +135,14 @@ windows_simple_first_creds(void **creden
                            const char *realmstring,
                            apr_pool_t *pool)
 {
-  return svn_auth__simple_first_creds_helper(credentials,
-                                             iter_baton,
-                                             provider_baton,
-                                             parameters,
-                                             realmstring,
-                                             windows_password_decrypter,
-                                             SVN_AUTH__WINCRYPT_PASSWORD_TYPE,
-                                             pool);
+  return svn_auth__simple_creds_cache_get(credentials,
+                                          iter_baton,
+                                          provider_baton,
+                                          parameters,
+                                          realmstring,
+                                          windows_password_decrypter,
+                                          SVN_AUTH__WINCRYPT_PASSWORD_TYPE,
+                                          pool);
 }
 
 /* Save encrypted credentials to the simple provider's cache. */
@@ -154,13 +154,13 @@ windows_simple_save_creds(svn_boolean_t 
                           const char *realmstring,
                           apr_pool_t *pool)
 {
-  return svn_auth__simple_save_creds_helper(saved, credentials,
-                                            provider_baton,
-                                            parameters,
-                                            realmstring,
-                                            windows_password_encrypter,
-                                            SVN_AUTH__WINCRYPT_PASSWORD_TYPE,
-                                            pool);
+  return svn_auth__simple_creds_cache_set(saved, credentials,
+                                          provider_baton,
+                                          parameters,
+                                          realmstring,
+                                          windows_password_encrypter,
+                                          SVN_AUTH__WINCRYPT_PASSWORD_TYPE,
+                                          pool);
 }
 
 static const svn_auth_provider_t windows_simple_provider = {
@@ -274,15 +274,10 @@ windows_ssl_client_cert_pw_first_creds(v
                                        const char *realmstring,
                                        apr_pool_t *pool)
 {
-    return svn_auth__ssl_client_cert_pw_file_first_creds_helper
-              (credentials,
-               iter_baton,
-               provider_baton,
-               parameters,
-               realmstring,
-               windows_ssl_client_cert_pw_decrypter,
-               SVN_AUTH__WINCRYPT_PASSWORD_TYPE,
-               pool);
+  return svn_auth__ssl_client_cert_pw_cache_get(
+             credentials, iter_baton, provider_baton, parameters, realmstring,
+             windows_ssl_client_cert_pw_decrypter,
+             SVN_AUTH__WINCRYPT_PASSWORD_TYPE, pool);
 }
 
 /* Save encrypted credentials to the simple provider's cache. */
@@ -294,15 +289,10 @@ windows_ssl_client_cert_pw_save_creds(sv
                                       const char *realmstring,
                                       apr_pool_t *pool)
 {
-    return svn_auth__ssl_client_cert_pw_file_save_creds_helper
-              (saved,
-               credentials,
-               provider_baton,
-               parameters,
-               realmstring,
-               windows_ssl_client_cert_pw_encrypter,
-               SVN_AUTH__WINCRYPT_PASSWORD_TYPE,
-               pool);
+  return svn_auth__ssl_client_cert_pw_cache_set(
+             saved, credentials, provider_baton, parameters, realmstring,
+             windows_ssl_client_cert_pw_encrypter,
+             SVN_AUTH__WINCRYPT_PASSWORD_TYPE, pool);
 }
 
 static const svn_auth_provider_t windows_ssl_client_cert_pw_provider = {