You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2013/05/10 16:58:56 UTC

svn commit: r1481041 [20/38] - in /subversion/branches/master-passphrase: ./ build/ build/ac-macros/ build/generator/ build/generator/templates/ contrib/client-side/svncopy/ contrib/hook-scripts/ contrib/server-side/fsfsfixer/ contrib/server-side/fsfsf...

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/deprecated.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/deprecated.c Fri May 10 14:58:47 2013
@@ -32,6 +32,7 @@
    deprecated functions in this file. */
 #define SVN_DEPRECATED
 
+#include "svn_hash.h"
 #include "svn_subst.h"
 #include "svn_path.h"
 #include "svn_opt.h"
@@ -72,38 +73,28 @@ kwstruct_to_kwhash(const svn_subst_keywo
 
   if (kwstruct->revision)
     {
-      apr_hash_set(kwhash, SVN_KEYWORD_REVISION_LONG,
-                   APR_HASH_KEY_STRING, kwstruct->revision);
-      apr_hash_set(kwhash, SVN_KEYWORD_REVISION_MEDIUM,
-                   APR_HASH_KEY_STRING, kwstruct->revision);
-      apr_hash_set(kwhash, SVN_KEYWORD_REVISION_SHORT,
-                   APR_HASH_KEY_STRING, kwstruct->revision);
+      svn_hash_sets(kwhash, SVN_KEYWORD_REVISION_LONG, kwstruct->revision);
+      svn_hash_sets(kwhash, SVN_KEYWORD_REVISION_MEDIUM, kwstruct->revision);
+      svn_hash_sets(kwhash, SVN_KEYWORD_REVISION_SHORT, kwstruct->revision);
     }
   if (kwstruct->date)
     {
-      apr_hash_set(kwhash, SVN_KEYWORD_DATE_LONG,
-                   APR_HASH_KEY_STRING, kwstruct->date);
-      apr_hash_set(kwhash, SVN_KEYWORD_DATE_SHORT,
-                   APR_HASH_KEY_STRING, kwstruct->date);
+      svn_hash_sets(kwhash, SVN_KEYWORD_DATE_LONG, kwstruct->date);
+      svn_hash_sets(kwhash, SVN_KEYWORD_DATE_SHORT, kwstruct->date);
     }
   if (kwstruct->author)
     {
-      apr_hash_set(kwhash, SVN_KEYWORD_AUTHOR_LONG,
-                   APR_HASH_KEY_STRING, kwstruct->author);
-      apr_hash_set(kwhash, SVN_KEYWORD_AUTHOR_SHORT,
-                   APR_HASH_KEY_STRING, kwstruct->author);
+      svn_hash_sets(kwhash, SVN_KEYWORD_AUTHOR_LONG, kwstruct->author);
+      svn_hash_sets(kwhash, SVN_KEYWORD_AUTHOR_SHORT, kwstruct->author);
     }
   if (kwstruct->url)
     {
-      apr_hash_set(kwhash, SVN_KEYWORD_URL_LONG,
-                   APR_HASH_KEY_STRING, kwstruct->url);
-      apr_hash_set(kwhash, SVN_KEYWORD_URL_SHORT,
-                   APR_HASH_KEY_STRING, kwstruct->url);
+      svn_hash_sets(kwhash, SVN_KEYWORD_URL_LONG, kwstruct->url);
+      svn_hash_sets(kwhash, SVN_KEYWORD_URL_SHORT, kwstruct->url);
     }
   if (kwstruct->id)
     {
-      apr_hash_set(kwhash, SVN_KEYWORD_ID,
-                   APR_HASH_KEY_STRING, kwstruct->id);
+      svn_hash_sets(kwhash, SVN_KEYWORD_ID, kwstruct->id);
     }
 
   return kwhash;
@@ -1185,16 +1176,39 @@ svn_mergeinfo_intersect(svn_mergeinfo_t 
 }
 
 /*** From config.c ***/
+svn_error_t *
+svn_config_create(svn_config_t **cfgp,
+                  svn_boolean_t section_names_case_sensitive,
+                  apr_pool_t *result_pool)
+{
+  return svn_error_trace(svn_config_create2(cfgp,
+                                            section_names_case_sensitive,
+                                            FALSE,
+                                            result_pool));
+}
+
+svn_error_t *
+svn_config_read2(svn_config_t **cfgp, const char *file,
+                 svn_boolean_t must_exist,
+                 svn_boolean_t section_names_case_sensitive,
+                 apr_pool_t *result_pool)
+{
+  return svn_error_trace(svn_config_read3(cfgp, file,
+                                          must_exist,
+                                          section_names_case_sensitive,
+                                          FALSE,
+                                          result_pool));
+}
 
 svn_error_t *
 svn_config_read(svn_config_t **cfgp, const char *file,
                 svn_boolean_t must_exist,
-                apr_pool_t *pool)
+                apr_pool_t *result_pool)
 {
-  return svn_error_trace(svn_config_read2(cfgp, file,
+  return svn_error_trace(svn_config_read3(cfgp, file,
                                           must_exist,
-                                          FALSE,
-                                          pool));
+                                          FALSE, FALSE,
+                                          result_pool));
 }
 
 #ifdef SVN_DISABLE_FULL_VERSION_MATCH
@@ -1243,3 +1257,48 @@ svn_utf_initialize(apr_pool_t *pool)
 {
   svn_utf_initialize2(pool, FALSE);
 }
+
+svn_error_t *
+svn_subst_build_keywords(svn_subst_keywords_t *kw,
+                         const char *keywords_val,
+                         const char *rev,
+                         const char *url,
+                         apr_time_t date,
+                         const char *author,
+                         apr_pool_t *pool)
+{
+  apr_hash_t *kwhash;
+  const svn_string_t *val;
+
+  SVN_ERR(svn_subst_build_keywords2(&kwhash, keywords_val, rev,
+                                    url, date, author, pool));
+
+  /* The behaviour of pre-1.3 svn_subst_build_keywords, which we are
+   * replicating here, is to write to a slot in the svn_subst_keywords_t
+   * only if the relevant keyword was present in keywords_val, otherwise
+   * leaving that slot untouched. */
+
+  val = svn_hash_gets(kwhash, SVN_KEYWORD_REVISION_LONG);
+  if (val)
+    kw->revision = val;
+
+  val = svn_hash_gets(kwhash, SVN_KEYWORD_DATE_LONG);
+  if (val)
+    kw->date = val;
+
+  val = svn_hash_gets(kwhash, SVN_KEYWORD_AUTHOR_LONG);
+  if (val)
+    kw->author = val;
+
+  val = svn_hash_gets(kwhash, SVN_KEYWORD_URL_LONG);
+  if (val)
+    kw->url = val;
+
+  val = svn_hash_gets(kwhash, SVN_KEYWORD_ID);
+  if (val)
+    kw->id = val;
+
+  return SVN_NO_ERROR;
+}
+
+

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/dirent_uri.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/dirent_uri.c Fri May 10 14:58:47 2013
@@ -359,8 +359,24 @@ canonicalize(path_type_t type, const cha
             src = seg;
 
           /* Found a hostname, convert to lowercase and copy to dst. */
-          while (*src && (*src != '/') && (*src != ':'))
-            *(dst++) = canonicalize_to_lower((*src++));
+          if (*src == '[')
+            {
+             *(dst++) = *(src++); /* Copy '[' */
+
+              while (*src == ':'
+                     || (*src >= '0' && (*src <= '9'))
+                     || (*src >= 'a' && (*src <= 'f'))
+                     || (*src >= 'A' && (*src <= 'F')))
+                {
+                  *(dst++) = canonicalize_to_lower((*src++));
+                }
+
+              if (*src == ']')
+                *(dst++) = *(src++); /* Copy ']' */
+            }
+          else
+            while (*src && (*src != '/') && (*src != ':'))
+              *(dst++) = canonicalize_to_lower((*src++));
 
           if (*src == ':')
             {
@@ -1774,12 +1790,28 @@ svn_uri_is_canonical(const char *uri, ap
 
   /* Found a hostname, check that it's all lowercase. */
   ptr = seg;
-  while (*ptr && *ptr != '/' && *ptr != ':')
+
+  if (*ptr == '[')
     {
-      if (*ptr >= 'A' && *ptr <= 'Z')
+      ptr++;
+      while (*ptr == ':'
+             || (*ptr >= '0' && *ptr <= '9')
+             || (*ptr >= 'a' && *ptr <= 'f'))
+        {
+          ptr++;
+        }
+
+      if (*ptr != ']')
         return FALSE;
       ptr++;
     }
+  else
+    while (*ptr && *ptr != '/' && *ptr != ':')
+      {
+        if (*ptr >= 'A' && *ptr <= 'Z')
+          return FALSE;
+        ptr++;
+      }
 
   /* Found a portnumber */
   if (*ptr == ':')

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/dso.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/dso.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/dso.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/dso.c Fri May 10 14:58:47 2013
@@ -22,6 +22,7 @@
 #include <apr_thread_mutex.h>
 #include <apr_hash.h>
 
+#include "svn_hash.h"
 #include "svn_dso.h"
 #include "svn_pools.h"
 #include "svn_private_config.h"
@@ -64,7 +65,7 @@ svn_dso_initialize2(void)
 static svn_error_t *
 svn_dso_load_internal(apr_dso_handle_t **dso, const char *fname)
 {
-  *dso = apr_hash_get(dso_cache, fname, APR_HASH_KEY_STRING);
+  *dso = svn_hash_gets(dso_cache, fname);
 
   /* First check to see if we've been through this before...  We do this
      to avoid calling apr_dso_load multiple times for a given library,
@@ -91,19 +92,13 @@ svn_dso_load_internal(apr_dso_handle_t *
           *dso = NULL;
 
           /* It wasn't found, so set the special "we didn't find it" value. */
-          apr_hash_set(dso_cache,
-                       apr_pstrdup(dso_pool, fname),
-                       APR_HASH_KEY_STRING,
-                       NOT_THERE);
+          svn_hash_sets(dso_cache, apr_pstrdup(dso_pool, fname), NOT_THERE);
 
           return SVN_NO_ERROR;
         }
 
       /* Stash the dso so we can use it next time. */
-      apr_hash_set(dso_cache,
-                   apr_pstrdup(dso_pool, fname),
-                   APR_HASH_KEY_STRING,
-                   *dso);
+      svn_hash_sets(dso_cache, apr_pstrdup(dso_pool, fname), *dso);
     }
 
   return SVN_NO_ERROR;

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/error.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/error.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/error.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/error.c Fri May 10 14:58:47 2013
@@ -30,6 +30,9 @@
 
 #include <zlib.h>
 
+#ifndef SVN_ERR__TRACING
+#define SVN_ERR__TRACING
+#endif
 #include "svn_cmdline.h"
 #include "svn_error.h"
 #include "svn_pools.h"
@@ -451,6 +454,8 @@ svn_error_purge_tracing(svn_error_t *err
 #endif /* SVN_ERR__TRACING */
 }
 
+/* ### The logic around omitting (sic) apr_err= in maintainer mode is tightly
+   ### coupled to the current sole caller.*/
 static void
 print_error(svn_error_t *err, FILE *stream, const char *prefix)
 {
@@ -478,8 +483,18 @@ print_error(svn_error_t *err, FILE *stre
       svn_error_clear(temp_err);
     }
 
-  svn_error_clear(svn_cmdline_fprintf(stream, err->pool,
-                                      ": (apr_err=%d)\n", err->apr_err));
+  {
+    const char *symbolic_name;
+    if (svn_error__is_tracing_link(err))
+      /* Skip it; the error code will be printed by the real link. */
+      svn_error_clear(svn_cmdline_fprintf(stream, err->pool, ",\n"));
+    else if ((symbolic_name = svn_error_symbolic_name(err->apr_err)))
+      svn_error_clear(svn_cmdline_fprintf(stream, err->pool,
+                                          ": (apr_err=%s)\n", symbolic_name));
+    else
+      svn_error_clear(svn_cmdline_fprintf(stream, err->pool,
+                                          ": (apr_err=%d)\n", err->apr_err));
+  }
 #endif /* SVN_DEBUG */
 
   /* "traced call" */
@@ -603,6 +618,16 @@ void
 svn_handle_warning2(FILE *stream, svn_error_t *err, const char *prefix)
 {
   char buf[256];
+#ifdef SVN_DEBUG
+  const char *symbolic_name = svn_error_symbolic_name(err->apr_err);
+#endif
+
+#ifdef SVN_DEBUG
+  if (symbolic_name)
+    svn_error_clear(
+      svn_cmdline_fprintf(stream, err->pool, "%swarning: apr_err=%s\n",
+                          prefix, symbolic_name));
+#endif
 
   svn_error_clear(svn_cmdline_fprintf
                   (stream, err->pool,
@@ -627,9 +652,11 @@ svn_err_best_message(svn_error_t *err, c
 
 /* svn_strerror() and helpers */
 
+/* Duplicate of the same typedef in tests/libsvn_subr/error-code-test.c */
 typedef struct err_defn {
-  svn_errno_t errcode;
-  const char *errdesc;
+  svn_errno_t errcode; /* 160004 */
+  const char *errname; /* SVN_ERR_FS_CORRUPT */
+  const char *errdesc; /* default message */
 } err_defn;
 
 /* To understand what is going on here, read svn_error_codes.h. */
@@ -651,6 +678,50 @@ svn_strerror(apr_status_t statcode, char
   return apr_strerror(statcode, buf, bufsize);
 }
 
+#ifdef SVN_DEBUG
+/* Defines svn__errno and svn__apr_errno */
+#include "errorcode.inc"
+#endif
+
+const char *
+svn_error_symbolic_name(apr_status_t statcode)
+{
+  const err_defn *defn;
+#ifdef SVN_DEBUG
+  int i;
+#endif /* SVN_DEBUG */
+
+  for (defn = error_table; defn->errdesc != NULL; ++defn)
+    if (defn->errcode == (svn_errno_t)statcode)
+      return defn->errname;
+
+  /* "No error" is not in error_table. */
+  if (statcode == SVN_NO_ERROR)
+    return "SVN_NO_ERROR";
+
+#ifdef SVN_DEBUG
+  /* Try errno.h symbols. */
+  /* Linear search through a sorted array */
+  for (i = 0; i < sizeof(svn__errno) / sizeof(svn__errno[0]); i++)
+    if (svn__errno[i].errcode == (int)statcode)
+      return svn__errno[i].errname;
+
+  /* Try APR errors. */
+  /* Linear search through a sorted array */
+  for (i = 0; i < sizeof(svn__apr_errno) / sizeof(svn__apr_errno[0]); i++)
+    if (svn__apr_errno[i].errcode == (int)statcode)
+      return svn__apr_errno[i].errname;
+#endif /* SVN_DEBUG */
+
+  /* ### TODO: do we need APR_* error macros?  What about APR_TO_OS_ERROR()? */
+
+  return NULL;
+}
+
+
+
+/* Malfunctions. */
+
 svn_error_t *
 svn_error_raise_on_malfunction(svn_boolean_t can_return,
                                const char *file, int line,
@@ -710,6 +781,9 @@ svn_error__malfunction(svn_boolean_t can
   return malfunction_handler(can_return, file, line, expr);
 }
 
+
+/* Misc. */
+
 svn_error_t *
 svn_error__wrap_zlib(int zerr, const char *function, const char *message)
 {

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/hash.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/hash.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/hash.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/hash.c Fri May 10 14:58:47 2013
@@ -96,11 +96,14 @@ hash_read(apr_hash_t *hash, svn_stream_t
   svn_stringbuf_t *buf;
   svn_boolean_t eof;
   apr_size_t len, keylen, vallen;
-  char c, *end, *keybuf, *valbuf;
+  char c, *keybuf, *valbuf;
   apr_pool_t *iterpool = svn_pool_create(pool);
 
   while (1)
     {
+      svn_error_t *err;
+      apr_uint64_t ui64;
+
       svn_pool_clear(iterpool);
 
       /* Read a key length line.  Might be END, though. */
@@ -119,10 +122,12 @@ hash_read(apr_hash_t *hash, svn_stream_t
       if ((buf->len >= 3) && (buf->data[0] == 'K') && (buf->data[1] == ' '))
         {
           /* Get the length of the key */
-          keylen = (size_t) strtoul(buf->data + 2, &end, 10);
-          if (keylen == (size_t) ULONG_MAX || *end != '\0')
-            return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
+          err = svn_cstring_strtoui64(&ui64, buf->data + 2,
+                                      0, APR_SIZE_MAX, 10);
+          if (err)
+            return svn_error_create(SVN_ERR_MALFORMED_FILE, err,
                                     _("Serialized hash malformed"));
+          keylen = (apr_size_t)ui64;
 
           /* Now read that much into a buffer. */
           keybuf = apr_palloc(pool, keylen + 1);
@@ -141,10 +146,12 @@ hash_read(apr_hash_t *hash, svn_stream_t
 
           if ((buf->data[0] == 'V') && (buf->data[1] == ' '))
             {
-              vallen = (size_t) strtoul(buf->data + 2, &end, 10);
-              if (vallen == (size_t) ULONG_MAX || *end != '\0')
-                return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
+              err = svn_cstring_strtoui64(&ui64, buf->data + 2,
+                                          0, APR_SIZE_MAX, 10);
+              if (err)
+                return svn_error_create(SVN_ERR_MALFORMED_FILE, err,
                                         _("Serialized hash malformed"));
+              vallen = (apr_size_t)ui64;
 
               valbuf = apr_palloc(iterpool, vallen + 1);
               SVN_ERR(svn_stream_read(stream, valbuf, &vallen));
@@ -169,10 +176,12 @@ hash_read(apr_hash_t *hash, svn_stream_t
                && (buf->data[0] == 'D') && (buf->data[1] == ' '))
         {
           /* Get the length of the key */
-          keylen = (size_t) strtoul(buf->data + 2, &end, 10);
-          if (keylen == (size_t) ULONG_MAX || *end != '\0')
-            return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
+          err = svn_cstring_strtoui64(&ui64, buf->data + 2,
+                                      0, APR_SIZE_MAX, 10);
+          if (err)
+            return svn_error_create(SVN_ERR_MALFORMED_FILE, err,
                                     _("Serialized hash malformed"));
+          keylen = (apr_size_t)ui64;
 
           /* Now read that much into a buffer. */
           keybuf = apr_palloc(iterpool, keylen + 1);
@@ -230,11 +239,16 @@ hash_write(apr_hash_t *hash, apr_hash_t 
             continue;
         }
 
+      if (item->klen < 0)
+        return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
+                                _("Cannot serialize negative length"));
+
       /* Write it out. */
       SVN_ERR(svn_stream_printf(stream, subpool,
-                                "K %" APR_SSIZE_T_FMT "\n%s\n"
+                                "K %" APR_SIZE_T_FMT "\n%s\n"
                                 "V %" APR_SIZE_T_FMT "\n",
-                                item->klen, (const char *) item->key,
+                                (apr_size_t) item->klen,
+                                (const char *) item->key,
                                 valstr->len));
       len = valstr->len;
       SVN_ERR(svn_stream_write(stream, valstr->data, &len));
@@ -501,31 +515,28 @@ svn_hash_from_cstring_keys(apr_hash_t **
     {
       const char *key =
         apr_pstrdup(pool, APR_ARRAY_IDX(keys, i, const char *));
-      apr_hash_set(hash, key, APR_HASH_KEY_STRING, key);
+      svn_hash_sets(hash, key, key);
     }
   *hash_p = hash;
   return SVN_NO_ERROR;
 }
 
 
-svn_error_t *
-svn_hash__clear(apr_hash_t *hash, apr_pool_t *pool)
+#if !APR_VERSION_AT_LEAST(1, 3, 0)
+void
+svn_hash__clear(apr_hash_t *hash)
 {
-#if APR_VERSION_AT_LEAST(1, 3, 0)
-  apr_hash_clear(hash);
-#else
   apr_hash_index_t *hi;
   const void *key;
   apr_ssize_t klen;
 
-  for (hi = apr_hash_first(pool, hash); hi; hi = apr_hash_next(hi))
+  for (hi = apr_hash_first(NULL, hash); hi; hi = apr_hash_next(hi))
     {
       apr_hash_this(hi, &key, &klen, NULL);
       apr_hash_set(hash, key, klen, NULL);
     }
-#endif
-  return SVN_NO_ERROR;
 }
+#endif
 
 
 
@@ -538,7 +549,7 @@ svn_hash__get_cstring(apr_hash_t *hash,
 {
   if (hash)
     {
-      const char *value = apr_hash_get(hash, key, APR_HASH_KEY_STRING);
+      const char *value = svn_hash_gets(hash, key);
       return value ? value : default_value;
     }
 

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/io.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/io.c Fri May 10 14:58:47 2013
@@ -51,6 +51,7 @@
 #include <arch/win32/apr_arch_file_io.h>
 #endif
 
+#include "svn_hash.h"
 #include "svn_types.h"
 #include "svn_dirent_uri.h"
 #include "svn_path.h"
@@ -2068,7 +2069,7 @@ svn_io_file_lock2(const char *lock_file,
 
   /* locktype is never read after this block, so we don't need to bother
      setting it.  If that were to ever change, uncomment the following
-     block. 
+     block.
   if (nonblocking)
     locktype |= APR_FLOCK_NONBLOCK;
   */
@@ -2476,7 +2477,7 @@ svn_io_get_dirents3(apr_hash_t **dirents
               dirent->mtime = this_entry.mtime;
             }
 
-          apr_hash_set(*dirents, name, APR_HASH_KEY_STRING, dirent);
+          svn_hash_sets(*dirents, name, dirent);
         }
     }
 
@@ -2581,7 +2582,7 @@ svn_io_stat_dirent2(const svn_io_dirent2
           else
             SVN_ERR(err);
 
-          if (! apr_hash_get(dirents, requested_name, APR_HASH_KEY_STRING))
+          if (! svn_hash_gets(dirents, requested_name))
             {
               if (ignore_enoent)
                 {
@@ -2824,7 +2825,7 @@ svn_io_run_cmd(const char *path,
 {
   apr_proc_t cmd_proc;
 
-  SVN_ERR(svn_io_start_cmd2(&cmd_proc, path, cmd, args, inherit,
+  SVN_ERR(svn_io_start_cmd3(&cmd_proc, path, cmd, args, NULL, inherit,
                             FALSE, infile, FALSE, outfile, FALSE, errfile,
                             pool));
 
@@ -2994,8 +2995,7 @@ svn_io_run_diff3_3(int *exitcode,
     svn_config_t *cfg;
 
     SVN_ERR(svn_config_get_config(&config, pool));
-    cfg = config ? apr_hash_get(config, SVN_CONFIG_CATEGORY_CONFIG,
-                                APR_HASH_KEY_STRING) : NULL;
+    cfg = config ? svn_hash_gets(config, SVN_CONFIG_CATEGORY_CONFIG) : NULL;
     SVN_ERR(svn_config_get_bool(cfg, &has_arg, SVN_CONFIG_SECTION_HELPERS,
                                 SVN_CONFIG_OPTION_DIFF3_HAS_PROGRAM_ARG,
                                 TRUE));
@@ -3111,7 +3111,7 @@ svn_io_parse_mimetypes_file(apr_hash_t *
                * we know svn_cstring_split() allocated it in 'pool' for us. */
               char *ext = APR_ARRAY_IDX(tokens, i, char *);
               fileext_tolower(ext);
-              apr_hash_set(types, ext, APR_HASH_KEY_STRING, type);
+              svn_hash_sets(types, ext, type);
             }
         }
       if (eof)
@@ -3162,8 +3162,7 @@ svn_io_detect_mimetype2(const char **mim
                          svn_path_splitext sets it to "". */
       svn_path_splitext(NULL, (const char **)&path_ext, file, pool);
       fileext_tolower(path_ext);
-      if ((type_from_map = apr_hash_get(mimetype_map, path_ext,
-                                        APR_HASH_KEY_STRING)))
+      if ((type_from_map = svn_hash_gets(mimetype_map, path_ext)))
         {
           *mimetype = type_from_map;
           return SVN_NO_ERROR;
@@ -3540,7 +3539,7 @@ svn_io_read_length_line(apr_file_t *file
       if (eol)
         {
           apr_off_t offset = (eol + 1 - buf) - (apr_off_t)bytes_read;
-          
+
           *eol = 0;
           *limit = total_read + (eol - buf);
 

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/mergeinfo.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/mergeinfo.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/mergeinfo.c Fri May 10 14:58:47 2013
@@ -649,11 +649,7 @@ svn_rangelist__combine_adjacent_ranges(s
           if (lastrange->inheritable == range->inheritable)
             {
               lastrange->end = MAX(range->end, lastrange->end);
-              if (i + 1 < rangelist->nelts)
-                memmove(rangelist->elts + (rangelist->elt_size * i),
-                        rangelist->elts + (rangelist->elt_size * (i + 1)),
-                        rangelist->elt_size * (rangelist->nelts - i));
-              rangelist->nelts--;
+              svn_sort__array_delete(rangelist, i, 1);
               i--;
             }
         }
@@ -1853,16 +1849,14 @@ svn_mergeinfo_intersect2(svn_mergeinfo_t
       svn_rangelist_t *rangelist2;
 
       svn_pool_clear(iterpool);
-      rangelist2 = apr_hash_get(mergeinfo2, path, APR_HASH_KEY_STRING);
+      rangelist2 = svn_hash_gets(mergeinfo2, path);
       if (rangelist2)
         {
           SVN_ERR(svn_rangelist_intersect(&rangelist2, rangelist1, rangelist2,
                                           consider_inheritance, iterpool));
           if (rangelist2->nelts > 0)
-            apr_hash_set(*mergeinfo,
-                         apr_pstrdup(result_pool, path),
-                         APR_HASH_KEY_STRING,
-                         svn_rangelist_dup(rangelist2, result_pool));
+            svn_hash_sets(*mergeinfo, apr_pstrdup(result_pool, path),
+                          svn_rangelist_dup(rangelist2, result_pool));
         }
     }
   svn_pool_destroy(iterpool);
@@ -1993,10 +1987,8 @@ svn_mergeinfo_catalog_dup(svn_mergeinfo_
       const char *key = svn__apr_hash_index_key(hi);
       svn_mergeinfo_t val = svn__apr_hash_index_val(hi);
 
-      apr_hash_set(new_mergeinfo_catalog,
-                   apr_pstrdup(pool, key),
-                   APR_HASH_KEY_STRING,
-                   svn_mergeinfo_dup(val, pool));
+      svn_hash_sets(new_mergeinfo_catalog, apr_pstrdup(pool, key),
+                    svn_mergeinfo_dup(val, pool));
     }
 
   return new_mergeinfo_catalog;
@@ -2131,7 +2123,7 @@ svn_mergeinfo__remove_empty_rangelists(s
 
           if (rangelist->nelts == 0)
             {
-              apr_hash_set(mergeinfo, path, APR_HASH_KEY_STRING, NULL);
+              svn_hash_sets(mergeinfo, path, NULL);
               removed_some_ranges = TRUE;
             }
         }
@@ -2160,7 +2152,7 @@ svn_mergeinfo__remove_prefix_from_catalo
       new_path = svn_fspath__skip_ancestor(prefix_path, original_path);
       SVN_ERR_ASSERT(new_path);
 
-      apr_hash_set(*out_catalog, new_path, APR_HASH_KEY_STRING, value);
+      svn_hash_sets(*out_catalog, new_path, value);
     }
 
   return SVN_NO_ERROR;
@@ -2187,9 +2179,9 @@ svn_mergeinfo__add_prefix_to_catalog(svn
       if (original_path[0] == '/')
         original_path++;
 
-      apr_hash_set(*out_catalog,
-                   svn_dirent_join(prefix_path, original_path, result_pool),
-                   APR_HASH_KEY_STRING, value);
+      svn_hash_sets(*out_catalog,
+                    svn_dirent_join(prefix_path, original_path, result_pool),
+                    value);
     }
 
   return SVN_NO_ERROR;
@@ -2215,10 +2207,9 @@ svn_mergeinfo__add_suffix_to_mergeinfo(s
       const char *fspath = svn__apr_hash_index_key(hi);
       svn_rangelist_t *rangelist = svn__apr_hash_index_val(hi);
 
-      apr_hash_set(*out_mergeinfo,
-                   svn_fspath__join(fspath, suffix_relpath, result_pool),
-                   APR_HASH_KEY_STRING,
-                   rangelist);
+      svn_hash_sets(*out_mergeinfo,
+                    svn_fspath__join(fspath, suffix_relpath, result_pool),
+                    rangelist);
     }
 
   return SVN_NO_ERROR;
@@ -2389,10 +2380,8 @@ svn_mergeinfo__filter_catalog_by_ranges(
                                                         result_pool,
                                                         scratch_pool));
       if (apr_hash_count(filtered_mergeinfo))
-        apr_hash_set(*filtered_cat,
-                     apr_pstrdup(result_pool, path),
-                     APR_HASH_KEY_STRING,
-                     filtered_mergeinfo);
+        svn_hash_sets(*filtered_cat,
+                      apr_pstrdup(result_pool, path), filtered_mergeinfo);
     }
 
   return SVN_NO_ERROR;
@@ -2436,10 +2425,8 @@ svn_mergeinfo__filter_mergeinfo_by_range
                         ! include_range, FALSE, result_pool));
 
               if (new_rangelist->nelts)
-                apr_hash_set(*filtered_mergeinfo,
-                             apr_pstrdup(result_pool, path),
-                             APR_HASH_KEY_STRING,
-                             new_rangelist);
+                svn_hash_sets(*filtered_mergeinfo,
+                              apr_pstrdup(result_pool, path), new_rangelist);
             }
         }
     }
@@ -2476,23 +2463,16 @@ svn_mergeinfo__adjust_mergeinfo_rangelis
 
               if (range->start + offset > 0 && range->end + offset > 0)
                 {
-                  if (range->start + offset < 0)
-                    range->start = 0;
-                  else
-                    range->start = range->start + offset;
-
-                  if (range->end + offset < 0)
-                    range->end = 0;
-                  else
-                    range->end = range->end + offset;
+                  range->start = range->start + offset;
+                  range->end = range->end + offset;
                   APR_ARRAY_PUSH(adjusted_rangelist, svn_merge_range_t *) =
                     range;
                 }
             }
 
           if (adjusted_rangelist->nelts)
-            apr_hash_set(*adjusted_mergeinfo, apr_pstrdup(result_pool, path),
-                         APR_HASH_KEY_STRING, adjusted_rangelist);
+            svn_hash_sets(*adjusted_mergeinfo, apr_pstrdup(result_pool, path),
+                          adjusted_rangelist);
         }
     }
   return SVN_NO_ERROR;
@@ -2568,7 +2548,7 @@ svn_mergeinfo__mergeinfo_from_segments(s
 
       /* See if we already stored ranges for this path.  If not, make
          a new list.  */
-      path_ranges = apr_hash_get(mergeinfo, source_path, APR_HASH_KEY_STRING);
+      path_ranges = svn_hash_gets(mergeinfo, source_path);
       if (! path_ranges)
         path_ranges = apr_array_make(pool, 1, sizeof(range));
 
@@ -2585,7 +2565,7 @@ svn_mergeinfo__mergeinfo_from_segments(s
       range->end = segment->range_end;
       range->inheritable = TRUE;
       APR_ARRAY_PUSH(path_ranges, svn_merge_range_t *) = range;
-      apr_hash_set(mergeinfo, source_path, APR_HASH_KEY_STRING, path_ranges);
+      svn_hash_sets(mergeinfo, source_path, path_ranges);
     }
 
   *mergeinfo_p = mergeinfo;

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/opt.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/opt.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/opt.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/opt.c Fri May 10 14:58:47 2013
@@ -34,6 +34,7 @@
 #include <apr_lib.h>
 #include <apr_file_info.h>
 
+#include "svn_hash.h"
 #include "svn_cmdline.h"
 #include "svn_version.h"
 #include "svn_types.h"
@@ -978,7 +979,7 @@ svn_opt_parse_revprop(apr_hash_t **revpr
                              _("'%s' is not a valid Subversion property name"),
                              propname);
 
-  apr_hash_set(*revprop_table_p, propname, APR_HASH_KEY_STRING, propval);
+  svn_hash_sets(*revprop_table_p, propname, propval);
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/pool.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/pool.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/pool.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/pool.c Fri May 10 14:58:47 2013
@@ -130,8 +130,8 @@ svn_pool_create_allocator(svn_boolean_t 
   if (thread_safe)
     {
       apr_thread_mutex_t *mutex;
-      apr_thread_mutex_create (&mutex, APR_THREAD_MUTEX_DEFAULT, pool);
-      apr_allocator_mutex_set (allocator, mutex);
+      apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, pool);
+      apr_allocator_mutex_set(allocator, mutex);
     }
 #endif
 

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/prompt.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/prompt.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/prompt.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/prompt.c Fri May 10 14:58:47 2013
@@ -576,7 +576,7 @@ prompt(const char **result,
     {
       /* If terminal echo was turned off, make sure future output
          to the terminal starts on a new line, as expected. */
-      terminal_puts(APR_EOL_STR, terminal, pool);
+      SVN_ERR(terminal_puts(APR_EOL_STR, terminal, pool));
     }
   SVN_ERR(terminal_close(terminal));
 

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/properties.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/properties.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/properties.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/properties.c Fri May 10 14:58:47 2013
@@ -27,6 +27,7 @@
 #include <apr_hash.h>
 #include <apr_tables.h>
 #include <string.h>       /* for strncmp() */
+#include "svn_hash.h"
 #include "svn_string.h"
 #include "svn_props.h"
 #include "svn_error.h"
@@ -331,7 +332,7 @@ svn_prop__patch(const apr_hash_t *origin
     {
       const svn_prop_t *p = &APR_ARRAY_IDX(prop_changes, i, svn_prop_t);
 
-      apr_hash_set(props, p->name, APR_HASH_KEY_STRING, p->value);
+      svn_hash_sets(props, p->name, p->value);
     }
   return props;
 }
@@ -429,7 +430,7 @@ svn_prop_array_to_hash(const apr_array_h
   for (i = 0; i < properties->nelts; i++)
     {
       const svn_prop_t *prop = &APR_ARRAY_IDX(properties, i, svn_prop_t);
-      apr_hash_set(prop_hash, prop->name, APR_HASH_KEY_STRING, prop->value);
+      svn_hash_sets(prop_hash, prop->name, prop->value);
     }
 
   return prop_hash;
@@ -497,7 +498,7 @@ svn_prop_get_value(const apr_hash_t *pro
   if (!props)
     return NULL;
 
-  str = apr_hash_get((apr_hash_t *)props, prop_name, APR_HASH_KEY_STRING);
+  str = svn_hash_gets((apr_hash_t *)props, prop_name);
 
   if (str)
     return str->data;

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/pseudo_md5.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/pseudo_md5.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/pseudo_md5.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/pseudo_md5.c Fri May 10 14:58:47 2013
@@ -125,11 +125,11 @@
   }
 
 /* The idea of the functions below is as follows:
- * 
+ *
  * - The core MD5 algorithm does not assume that the "important" data
  *   is at the begin of the encryption block, followed by e.g. 0.
  *   Instead, all bits are equally relevant.
- * 
+ *
  * - If some bytes in the input are known to be 0, we may hard-code them.
  *   With the previous property, it is safe to move them to the upper end
  *   of the encryption block to maximize the number of steps that can be
@@ -153,7 +153,7 @@
  * - Collisions between pseudo-MD5 and pseudo-MD5 as well as pseudo-MD5
  *   and standard MD5 are as likely as any other MD5 collision.
  */
-  
+
 void svn__pseudo_md5_15(apr_uint32_t digest[4],
                         const apr_uint32_t x[4])
 {
@@ -164,7 +164,7 @@ void svn__pseudo_md5_15(apr_uint32_t dig
 
     /* make sure byte 63 gets the marker independently of BE / LE */
     apr_uint32_t x3n = x[3] ^ 0xffffffff;
-    
+
     /* Round 1 */
     FF(a, b, c, d, 0,    S11, 0xd76aa478); /* 1 */
     FF(d, a, b, c, 0,    S12, 0xe8c7b756); /* 2 */
@@ -253,7 +253,7 @@ void svn__pseudo_md5_31(apr_uint32_t dig
 
     /* make sure byte 63 gets the marker independently of BE / LE */
     apr_uint32_t x7n = x[7] ^ 0xfefefefe;
-    
+
     /* Round 1 */
     FF(a, b, c, d, 0,    S11, 0xd76aa478); /* 1 */
     FF(d, a, b, c, 0,    S12, 0xe8c7b756); /* 2 */
@@ -342,7 +342,7 @@ void svn__pseudo_md5_63(apr_uint32_t dig
 
     /* make sure byte 63 gets the marker independently of BE / LE */
     apr_uint32_t x15n = x[15] ^ 0xfcfcfcfc;
-    
+
     /* Round 1 */
     FF(a, b, c, d, x[0],  S11, 0xd76aa478); /* 1 */
     FF(d, a, b, c, x[1],  S12, 0xe8c7b756); /* 2 */

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/simple_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/simple_providers.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/simple_providers.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/simple_providers.c Fri May 10 14:58:47 2013
@@ -82,10 +82,10 @@ svn_auth__simple_password_get(svn_boolea
 
   *done = FALSE;
 
-  str = apr_hash_get(creds, AUTHN_USERNAME_KEY, APR_HASH_KEY_STRING);
+  str = svn_hash_gets(creds, AUTHN_USERNAME_KEY);
   if (str && username && strcmp(str->data, username) == 0)
     {
-      str = apr_hash_get(creds, AUTHN_PASSWORD_KEY, APR_HASH_KEY_STRING);
+      str = svn_hash_gets(creds, AUTHN_PASSWORD_KEY);
       if (str && str->data)
         {
           *password = str->data;
@@ -108,8 +108,7 @@ svn_auth__simple_password_set(svn_boolea
                               svn_boolean_t non_interactive,
                               apr_pool_t *pool)
 {
-  apr_hash_set(creds, AUTHN_PASSWORD_KEY, APR_HASH_KEY_STRING,
-               svn_string_create(password, pool));
+  svn_hash_sets(creds, AUTHN_PASSWORD_KEY, svn_string_create(password, pool));
   *done = TRUE;
 
   return SVN_NO_ERROR;
@@ -124,7 +123,7 @@ simple_username_get(const char **usernam
                     svn_boolean_t non_interactive)
 {
   svn_string_t *str;
-  str = apr_hash_get(creds, AUTHN_USERNAME_KEY, APR_HASH_KEY_STRING);
+  str = svn_hash_gets(creds, AUTHN_USERNAME_KEY);
   if (str && str->data)
     {
       *username = str->data;
@@ -144,21 +143,17 @@ svn_auth__simple_creds_cache_get(void **
                                  const char *passtype,
                                  apr_pool_t *pool)
 {
-  svn_config_t *cfg = apr_hash_get(parameters,
-                                   SVN_AUTH_PARAM_CONFIG_CATEGORY_SERVERS,
-                                   APR_HASH_KEY_STRING);
-  const char *server_group = apr_hash_get(parameters,
-                                          SVN_AUTH_PARAM_SERVER_GROUP,
-                                          APR_HASH_KEY_STRING);
-  const char *username = apr_hash_get(parameters,
-                                      SVN_AUTH_PARAM_DEFAULT_USERNAME,
-                                      APR_HASH_KEY_STRING);
-  const char *password = apr_hash_get(parameters,
-                                      SVN_AUTH_PARAM_DEFAULT_PASSWORD,
-                                      APR_HASH_KEY_STRING);
-  svn_boolean_t non_interactive = apr_hash_get(parameters,
-                                               SVN_AUTH_PARAM_NON_INTERACTIVE,
-                                               APR_HASH_KEY_STRING) != NULL;
+  svn_config_t *cfg = svn_hash_gets(parameters,
+                                    SVN_AUTH_PARAM_CONFIG_CATEGORY_SERVERS);
+  const char *server_group = svn_hash_gets(parameters,
+                                           SVN_AUTH_PARAM_SERVER_GROUP);
+  const char *username = svn_hash_gets(parameters,
+                                       SVN_AUTH_PARAM_DEFAULT_USERNAME);
+  const char *password = svn_hash_gets(parameters,
+                                       SVN_AUTH_PARAM_DEFAULT_PASSWORD);
+  svn_boolean_t non_interactive = svn_hash_gets(parameters,
+                                                SVN_AUTH_PARAM_NON_INTERACTIVE)
+      != NULL;
   const char *default_username = NULL; /* Default username from cache. */
   const char *default_password = NULL; /* Default password from cache. */
 
@@ -193,7 +188,7 @@ svn_auth__simple_creds_cache_get(void **
       /* The password type in the auth data must match the
          mangler's type, otherwise the password must be
          interpreted by another provider. */
-      str = apr_hash_get(creds_hash, AUTHN_PASSTYPE_KEY, APR_HASH_KEY_STRING);
+      str = svn_hash_gets(creds_hash, AUTHN_PASSTYPE_KEY);
       if (str && str->data)
         if (passtype && (0 == strcmp(str->data, passtype)))
           have_passtype = TRUE;
@@ -318,20 +313,17 @@ svn_auth__simple_creds_cache_set(svn_boo
 {
   svn_auth_cred_simple_t *creds = credentials;
   apr_hash_t *creds_hash = NULL;
-  const char *config_dir;
   svn_error_t *err;
   svn_auth__store_t *auth_store;
   svn_boolean_t dont_store_passwords =
-    apr_hash_get(parameters,
-                 SVN_AUTH_PARAM_DONT_STORE_PASSWORDS,
-                 APR_HASH_KEY_STRING) != NULL;
-  svn_boolean_t non_interactive = apr_hash_get(parameters,
-                                               SVN_AUTH_PARAM_NON_INTERACTIVE,
-                                               APR_HASH_KEY_STRING) != NULL;
+    svn_hash_gets(parameters, SVN_AUTH_PARAM_DONT_STORE_PASSWORDS) != NULL;
+  svn_boolean_t non_interactive = svn_hash_gets(parameters,
+                                                SVN_AUTH_PARAM_NON_INTERACTIVE)
+      != NULL;
   svn_boolean_t no_auth_cache =
-    (! creds->may_save) || (apr_hash_get(parameters,
-                                         SVN_AUTH_PARAM_NO_AUTH_CACHE,
-                                         APR_HASH_KEY_STRING) != NULL);
+    (! creds->may_save) || (svn_hash_gets(parameters,
+                                          SVN_AUTH_PARAM_NO_AUTH_CACHE)
+                            != NULL);
 
   /* Make sure we've been passed a passtype. */
   SVN_ERR_ASSERT(passtype != NULL);
@@ -341,14 +333,10 @@ svn_auth__simple_creds_cache_set(svn_boo
   if (no_auth_cache)
     return SVN_NO_ERROR;
 
-  config_dir = apr_hash_get(parameters,
-                            SVN_AUTH_PARAM_CONFIG_DIR,
-                            APR_HASH_KEY_STRING);
-
   /* Put the username into the credentials hash. */
   creds_hash = apr_hash_make(pool);
-  apr_hash_set(creds_hash, AUTHN_USERNAME_KEY, APR_HASH_KEY_STRING,
-               svn_string_create(creds->username, pool));
+  svn_hash_sets(creds_hash, AUTHN_USERNAME_KEY,
+                svn_string_create(creds->username, pool));
 
   /* Don't store passwords in any form if the user has told
    * us not to do so. */
@@ -374,9 +362,7 @@ svn_auth__simple_creds_cache_set(svn_boo
           may_save_password = FALSE;
 #else
           const char *store_plaintext_passwords =
-            apr_hash_get(parameters,
-                         SVN_AUTH_PARAM_STORE_PLAINTEXT_PASSWORDS,
-                         APR_HASH_KEY_STRING);
+            svn_hash_gets(parameters, SVN_AUTH_PARAM_STORE_PLAINTEXT_PASSWORDS);
           simple_provider_baton_t *b =
             (simple_provider_baton_t *)provider_baton;
 
@@ -396,9 +382,8 @@ svn_auth__simple_creds_cache_set(svn_boo
                    *
                    * Check for a cached answer before prompting. */
                   svn_boolean_t *cached_answer;
-                  cached_answer = apr_hash_get(b->plaintext_answers,
-                                               realmstring,
-                                               APR_HASH_KEY_STRING);
+                  cached_answer = svn_hash_gets(b->plaintext_answers,
+                                                realmstring);
                   if (cached_answer != NULL)
                     may_save_password = *cached_answer;
                   else
@@ -424,8 +409,8 @@ svn_auth__simple_creds_cache_set(svn_boo
                       cached_answer = apr_palloc(cached_answer_pool,
                                                  sizeof(svn_boolean_t));
                       *cached_answer = may_save_password;
-                      apr_hash_set(b->plaintext_answers, realmstring,
-                                   APR_HASH_KEY_STRING, cached_answer);
+                      svn_hash_sets(b->plaintext_answers, realmstring,
+                                    cached_answer);
                     }
                 }
               else
@@ -478,8 +463,8 @@ svn_auth__simple_creds_cache_set(svn_boo
           if (*saved && passtype)
             /* Store the password type with the auth data, so that we
                know which provider owns the password. */
-            apr_hash_set(creds_hash, AUTHN_PASSTYPE_KEY, APR_HASH_KEY_STRING,
-                         svn_string_create(passtype, pool));
+            svn_hash_sets(creds_hash, AUTHN_PASSTYPE_KEY,
+                          svn_string_create(passtype, pool));
         }
     }
 
@@ -535,133 +520,6 @@ simple_save_creds(svn_boolean_t *saved,
                                           pool);
 }
 
-svn_error_t *
-svn_auth__simple_cleanup_walk(svn_auth_baton_t *baton,
-                              svn_auth_cleanup_callback cleanup,
-                              void *cleanup_baton,
-                              apr_hash_t *creds_cache,
-                              apr_pool_t *scratch_pool)
-{
-  const char *config_dir;
-  svn_boolean_t no_auth_cache;
-  int i;
-  apr_pool_t *iterpool;
-
-  const char *cred_kinds[] =
-  {
-      SVN_AUTH_CRED_SIMPLE,
-      SVN_AUTH_CRED_USERNAME,
-      SVN_AUTH_CRED_SSL_CLIENT_CERT,
-      SVN_AUTH_CRED_SSL_CLIENT_CERT_PW,
-      SVN_AUTH_CRED_SSL_SERVER_TRUST,
-      NULL
-  };
-
-  config_dir = svn_auth_get_parameter(baton, SVN_AUTH_PARAM_CONFIG_DIR);
-  no_auth_cache = (svn_auth_get_parameter(baton, SVN_AUTH_PARAM_NO_AUTH_CACHE)
-                                != NULL);
-
-  if ((! config_dir) || no_auth_cache)
-    {
-      /* Can't locate the cache to clear */
-      return SVN_NO_ERROR;
-    }
-
-  iterpool = svn_pool_create(scratch_pool);
-  for (i = 0; cred_kinds[i]; i++)
-    {
-      const char *item_path;
-      const char *dir_path;
-      apr_hash_t *nodes;
-      svn_error_t *err;
-      apr_pool_t *itempool;
-      apr_hash_index_t *hi;
-
-      svn_pool_clear(iterpool);
-
-      SVN_ERR(svn_auth__file_path(&item_path, cred_kinds[i], "!", config_dir,
-                                  iterpool));
-
-      dir_path = svn_dirent_dirname(item_path, iterpool);
-
-      err = svn_io_get_dirents3(&nodes, dir_path, TRUE, iterpool, iterpool);
-
-      if (err)
-        {
-          if (!APR_STATUS_IS_ENOENT(err->apr_err)
-              && !SVN__APR_STATUS_IS_ENOTDIR(err->apr_err))
-            return svn_error_trace(err);
-
-          svn_error_clear(err);
-          continue;
-        }
-
-      itempool = svn_pool_create(iterpool);
-      for (hi = apr_hash_first(iterpool, nodes); hi; hi = apr_hash_next(hi))
-        {
-          svn_io_dirent2_t *dirent = svn__apr_hash_index_val(hi);
-          svn_stream_t *stream;
-          apr_hash_t *file_data;
-
-          if (dirent->kind != svn_node_file)
-            continue;
-
-          svn_pool_clear(itempool);
-
-          item_path = svn_dirent_join(dir_path, svn__apr_hash_index_key(hi),
-                                      itempool);
-
-          err = svn_stream_open_readonly(&stream, item_path, itempool, itempool);
-          if (err)
-            {
-              /* Ignore this file. There are no credentials in it anyway */
-              svn_error_clear(err);
-              continue;
-            }
-
-          file_data = apr_hash_make(itempool);
-          err = svn_hash_read2(file_data, stream, SVN_HASH_TERMINATOR, itempool);
-          err = svn_error_compose_create(err, svn_stream_close(stream));
-          if (err)
-            {
-              /* Ignore this file. There are no credentials in it anyway */
-              svn_error_clear(err);
-              continue;
-            }
-
-          {
-            const svn_string_t *realm = svn_hash_gets(file_data, SVN_CONFIG_REALMSTRING_KEY);
-            svn_boolean_t delete_file = FALSE;
-
-            if (! realm)
-              continue; /* Not an auth file */
-
-            SVN_ERR(cleanup(&delete_file, cleanup_baton, cred_kinds[i], realm->data,
-                            SVN_AUTH_CRED_SIMPLE, itempool));
-
-            if (delete_file)
-              {
-                /* Delete from the credential hash */
-                const char *cache_key = apr_pstrcat(itempool,
-                                                    cred_kinds[0],
-                                                    ":",
-                                                    realm->data,
-                                                    (char *)NULL);
-
-                svn_hash_sets(creds_cache, cache_key, NULL);
-
-                /* And the file on disk */
-                SVN_ERR(svn_io_remove_file2(item_path, TRUE, itempool));
-              }
-          }
-        }
-    }
-
-  svn_pool_destroy(iterpool);
-  return SVN_NO_ERROR;
-}
-
-
 static const svn_auth_provider_t simple_provider = {
   SVN_AUTH_CRED_SIMPLE,
   simple_first_creds,
@@ -734,9 +592,8 @@ prompt_for_simple_creds(svn_auth_cred_si
      so. */
   if (first_time)
     {
-      default_username = apr_hash_get(parameters,
-                                      SVN_AUTH_PARAM_DEFAULT_USERNAME,
-                                      APR_HASH_KEY_STRING);
+      default_username = svn_hash_gets(parameters,
+                                       SVN_AUTH_PARAM_DEFAULT_USERNAME);
 
       /* No default username?  Try the auth cache. */
       if (! default_username)
@@ -755,8 +612,7 @@ prompt_for_simple_creds(svn_auth_cred_si
           svn_error_clear(err);
           if (! err && creds_hash)
             {
-              str = apr_hash_get(creds_hash, AUTHN_USERNAME_KEY,
-                                 APR_HASH_KEY_STRING);
+              str = svn_hash_gets(creds_hash, AUTHN_USERNAME_KEY);
               if (str && str->data)
                 default_username = str->data;
             }
@@ -765,12 +621,10 @@ prompt_for_simple_creds(svn_auth_cred_si
       /* Still no default username?  Try the 'servers' file. */
       if (! default_username)
         {
-          svn_config_t *cfg = apr_hash_get(parameters,
-                                           SVN_AUTH_PARAM_CONFIG_CATEGORY_SERVERS,
-                                           APR_HASH_KEY_STRING);
-          const char *server_group = apr_hash_get(parameters,
-                                                  SVN_AUTH_PARAM_SERVER_GROUP,
-                                                  APR_HASH_KEY_STRING);
+          svn_config_t *cfg = svn_hash_gets(parameters,
+                                            SVN_AUTH_PARAM_CONFIG_CATEGORY_SERVERS);
+          const char *server_group = svn_hash_gets(parameters,
+                                                   SVN_AUTH_PARAM_SERVER_GROUP);
           default_username =
             svn_config_get_server_setting(cfg, server_group,
                                           SVN_CONFIG_OPTION_USERNAME,
@@ -781,9 +635,8 @@ prompt_for_simple_creds(svn_auth_cred_si
       if (! default_username)
         default_username = svn_user_get_name(pool);
 
-      default_password = apr_hash_get(parameters,
-                                      SVN_AUTH_PARAM_DEFAULT_PASSWORD,
-                                      APR_HASH_KEY_STRING);
+      default_password = svn_hash_gets(parameters,
+                                       SVN_AUTH_PARAM_DEFAULT_PASSWORD);
     }
 
   /* If we have defaults, just build the cred here and return it.
@@ -821,9 +674,8 @@ simple_prompt_first_creds(void **credent
 {
   simple_prompt_provider_baton_t *pb = provider_baton;
   simple_prompt_iter_baton_t *ibaton = apr_pcalloc(pool, sizeof(*ibaton));
-  const char *no_auth_cache = apr_hash_get(parameters,
-                                           SVN_AUTH_PARAM_NO_AUTH_CACHE,
-                                           APR_HASH_KEY_STRING);
+  const char *no_auth_cache = svn_hash_gets(parameters,
+                                            SVN_AUTH_PARAM_NO_AUTH_CACHE);
 
   SVN_ERR(prompt_for_simple_creds((svn_auth_cred_simple_t **) credentials_p,
                                   pb, parameters, realmstring, TRUE,
@@ -848,9 +700,8 @@ simple_prompt_next_creds(void **credenti
 {
   simple_prompt_iter_baton_t *ib = iter_baton;
   simple_prompt_provider_baton_t *pb = provider_baton;
-  const char *no_auth_cache = apr_hash_get(parameters,
-                                           SVN_AUTH_PARAM_NO_AUTH_CACHE,
-                                           APR_HASH_KEY_STRING);
+  const char *no_auth_cache = svn_hash_gets(parameters,
+                                            SVN_AUTH_PARAM_NO_AUTH_CACHE);
 
   if ((pb->retry_limit >= 0) && (ib->retries >= pb->retry_limit))
     {

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/sorts.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/sorts.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/sorts.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/sorts.c Fri May 10 14:58:47 2013
@@ -28,6 +28,7 @@
 #include <apr_tables.h>
 #include <stdlib.h>       /* for qsort()   */
 #include <assert.h>
+#include "svn_hash.h"
 #include "svn_path.h"
 #include "svn_sorts.h"
 #include "svn_error.h"

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/sqlite.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/sqlite.c Fri May 10 14:58:47 2013
@@ -38,6 +38,11 @@
 #include "private/svn_skel.h"
 #include "private/svn_token.h"
 
+#ifdef SVN_UNICODE_NORMALIZATION_FIXES
+#include "private/svn_utf_private.h"
+#include "private/svn_string_private.h"
+#endif /* SVN_UNICODE_NORMALIZATION_FIXES */
+
 #ifdef SQLITE3_DEBUG
 #include "private/svn_debug.h"
 #endif
@@ -60,6 +65,13 @@ extern int (*const svn_sqlite3__api_conf
 #error SQLite is too old -- version 3.7.12 is the minimum required version
 #endif
 
+#ifdef SVN_UNICODE_NORMALIZATION_FIXES
+/* Limit the length of a GLOB or LIKE pattern. */
+#ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH
+# define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000
+#endif
+#endif /* SVN_UNICODE_NORMALIZATION_FIXES */
+
 const char *
 svn_sqlite__compiled_version(void)
 {
@@ -104,6 +116,13 @@ struct svn_sqlite__db_t
   int nbr_statements;
   svn_sqlite__stmt_t **prepared_stmts;
   apr_pool_t *state_pool;
+
+#ifdef SVN_UNICODE_NORMALIZATION_FIXES
+  /* Buffers for SQLite extensoins. */
+  svn_membuf_t sqlext_buf1;
+  svn_membuf_t sqlext_buf2;
+  svn_membuf_t sqlext_buf3;
+#endif /* SVN_UNICODE_NORMALIZATION_FIXES */
 };
 
 struct svn_sqlite__stmt_t
@@ -873,6 +892,99 @@ close_apr(void *data)
   return APR_SUCCESS;
 }
 
+#ifdef SVN_UNICODE_NORMALIZATION_FIXES
+/* Unicode normalizing collation for WC paths */
+static int
+collate_ucs_nfd(void *baton,
+                int len1, const void *key1,
+                int len2, const void *key2)
+{
+  svn_sqlite__db_t *db = baton;
+  int result;
+
+  if (svn_utf__normcmp(key1, len1, key2, len2,
+                       &db->sqlext_buf1, &db->sqlext_buf2, &result))
+    {
+      /* There is really nothing we can do here if an error occurs
+         during Unicode normalizetion, and attempting to recover could
+         result in the wc.db index being corrupted. Presumably this
+         can only happen if the index already contains invalid UTF-8
+         strings, which should never happen in any case ... */
+      SVN_ERR_MALFUNCTION_NO_RETURN();
+    }
+
+  return result;
+}
+
+static void
+glob_like_ucs_nfd_common(sqlite3_context *context,
+                         int argc, sqlite3_value **argv,
+                         svn_boolean_t sql_like)
+{
+  svn_sqlite__db_t *const db = sqlite3_user_data(context);
+
+  const char *const pattern = (void*)sqlite3_value_text(argv[0]);
+  const apr_size_t pattern_len = sqlite3_value_bytes(argv[0]);
+  const char *const string = (void*)sqlite3_value_text(argv[1]);
+  const apr_size_t string_len = sqlite3_value_bytes(argv[1]);
+
+  const char *escape = NULL;
+  apr_size_t escape_len = 0;
+
+  svn_boolean_t match;
+  svn_error_t *err;
+
+  if (pattern_len > SQLITE_MAX_LIKE_PATTERN_LENGTH)
+    {
+      sqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1);
+      return;
+    }
+
+  if (argc == 3 && sql_like)
+    {
+      escape = (void*)sqlite3_value_text(argv[2]);
+      escape_len = sqlite3_value_bytes(argv[2]);
+    }
+
+  if (pattern && string)
+    {
+      err = svn_utf__glob(pattern, pattern_len, string, string_len,
+                          escape, escape_len, sql_like,
+                          &db->sqlext_buf1, &db->sqlext_buf2, &db->sqlext_buf3,
+                          &match);
+
+      if (err)
+        {
+          const char *errmsg;
+          svn_membuf__ensure(&db->sqlext_buf1, 512);
+          errmsg = svn_err_best_message(err,
+                                        db->sqlext_buf1.data,
+                                        db->sqlext_buf1.size - 1);
+          svn_error_clear(err);
+          sqlite3_result_error(context, errmsg, -1);
+          return;
+        }
+
+      sqlite3_result_int(context, match);
+    }
+}
+
+/* Unicode normalizing implementation of GLOB */
+static void
+glob_ucs_nfd(sqlite3_context *context,
+             int argc, sqlite3_value **argv)
+{
+  glob_like_ucs_nfd_common(context, argc, argv, FALSE);
+}
+
+/* Unicode normalizing implementation of LIKE */
+static void
+like_ucs_nfd(sqlite3_context *context,
+             int argc, sqlite3_value **argv)
+{
+  glob_like_ucs_nfd_common(context, argc, argv, TRUE);
+}
+#endif /* SVN_UNICODE_NORMALIZATION_FIXES */
 
 svn_error_t *
 svn_sqlite__open(svn_sqlite__db_t **db, const char *path,
@@ -887,6 +999,28 @@ svn_sqlite__open(svn_sqlite__db_t **db, 
 
   SVN_ERR(internal_open(&(*db)->db3, path, mode, scratch_pool));
 
+#ifdef SVN_UNICODE_NORMALIZATION_FIXES
+  /* Create extension buffers with space for 200 UCS-4 characters. */
+  svn_membuf__create(&(*db)->sqlext_buf1, 800, result_pool);
+  svn_membuf__create(&(*db)->sqlext_buf2, 800, result_pool);
+  svn_membuf__create(&(*db)->sqlext_buf3, 800, result_pool);
+
+  /* Register collation and LIKE and GLOB operator replacements. */
+  SQLITE_ERR(sqlite3_create_collation((*db)->db3,
+                                      "svn-ucs-nfd", SQLITE_UTF8,
+                                      *db, collate_ucs_nfd),
+             *db);
+  SQLITE_ERR(sqlite3_create_function((*db)->db3, "glob", 2, SQLITE_UTF8,
+                                     *db, glob_ucs_nfd, NULL, NULL),
+             *db);
+  SQLITE_ERR(sqlite3_create_function((*db)->db3, "like", 2, SQLITE_UTF8,
+                                     *db, like_ucs_nfd, NULL, NULL),
+             *db);
+  SQLITE_ERR(sqlite3_create_function((*db)->db3, "like", 3, SQLITE_UTF8,
+                                     *db, like_ucs_nfd, NULL, NULL),
+             *db);
+#endif /* SVN_UNICODE_NORMALIZATION_FIXES */
+
 #ifdef SQLITE3_DEBUG
   sqlite3_trace((*db)->db3, sqlite_tracer, (*db)->db3);
 #endif

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/sqlite3wrapper.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/sqlite3wrapper.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/sqlite3wrapper.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/sqlite3wrapper.c Fri May 10 14:58:47 2013
@@ -39,6 +39,17 @@
 #      pragma GCC diagnostic ignored "-Wshorten-64-to-32"
 #    endif
 #  endif
+#  ifdef __APPLE__
+#    include <Availability.h>
+#    if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
+       /* <libkern/OSAtomic.h> is included on OS X by sqlite3.c, and
+          on old systems (Leopard or older), it cannot be compiled
+          with -std=c89 because it uses inline. This is a work-around. */
+#      define inline __inline__
+#      include <libkern/OSAtomic.h>
+#      undef inline
+#    endif
+#  endif
 #  include <sqlite3.c>
 #  if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 6))
 #    pragma GCC diagnostic pop

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/ssl_client_cert_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/ssl_client_cert_providers.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/ssl_client_cert_providers.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/ssl_client_cert_providers.c Fri May 10 14:58:47 2013
@@ -29,6 +29,7 @@
 /*** Includes. ***/
 
 #include <apr_pools.h>
+#include "svn_hash.h"
 #include "svn_auth.h"
 #include "svn_error.h"
 #include "svn_config.h"
@@ -48,12 +49,10 @@ ssl_client_cert_file_first_credentials(v
                                        const char *realmstring,
                                        apr_pool_t *pool)
 {
-  svn_config_t *cfg = apr_hash_get(parameters,
-                                   SVN_AUTH_PARAM_CONFIG_CATEGORY_SERVERS,
-                                   APR_HASH_KEY_STRING);
-  const char *server_group = apr_hash_get(parameters,
-                                          SVN_AUTH_PARAM_SERVER_GROUP,
-                                          APR_HASH_KEY_STRING);
+  svn_config_t *cfg = svn_hash_gets(parameters,
+                                    SVN_AUTH_PARAM_CONFIG_CATEGORY_SERVERS);
+  const char *server_group = svn_hash_gets(parameters,
+                                           SVN_AUTH_PARAM_SERVER_GROUP);
   const char *cert_file;
 
   cert_file =
@@ -139,9 +138,8 @@ ssl_client_cert_prompt_first_cred(void *
   ssl_client_cert_prompt_provider_baton_t *pb = provider_baton;
   ssl_client_cert_prompt_iter_baton_t *ib =
     apr_pcalloc(pool, sizeof(*ib));
-  const char *no_auth_cache = apr_hash_get(parameters,
-                                           SVN_AUTH_PARAM_NO_AUTH_CACHE,
-                                           APR_HASH_KEY_STRING);
+  const char *no_auth_cache = svn_hash_gets(parameters,
+                                            SVN_AUTH_PARAM_NO_AUTH_CACHE);
 
   SVN_ERR(pb->prompt_func((svn_auth_cred_ssl_client_cert_t **) credentials_p,
                           pb->prompt_baton, realmstring, ! no_auth_cache,
@@ -165,9 +163,8 @@ ssl_client_cert_prompt_next_cred(void **
                                  apr_pool_t *pool)
 {
   ssl_client_cert_prompt_iter_baton_t *ib = iter_baton;
-  const char *no_auth_cache = apr_hash_get(parameters,
-                                           SVN_AUTH_PARAM_NO_AUTH_CACHE,
-                                           APR_HASH_KEY_STRING);
+  const char *no_auth_cache = svn_hash_gets(parameters,
+                                            SVN_AUTH_PARAM_NO_AUTH_CACHE);
 
   if ((ib->pb->retry_limit >= 0) && (ib->retries >= ib->pb->retry_limit))
     {

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/ssl_client_cert_pw_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/ssl_client_cert_pw_providers.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/ssl_client_cert_pw_providers.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/ssl_client_cert_pw_providers.c Fri May 10 14:58:47 2013
@@ -25,6 +25,7 @@
 
 #include <apr_pools.h>
 
+#include "svn_hash.h"
 #include "svn_auth.h"
 #include "svn_error.h"
 #include "svn_config.h"
@@ -75,7 +76,7 @@ svn_auth__ssl_client_cert_pw_get(svn_boo
                                  apr_pool_t *pool)
 {
   svn_string_t *str;
-  str = apr_hash_get(creds, AUTHN_PASSPHRASE_KEY, APR_HASH_KEY_STRING);
+  str = svn_hash_gets(creds, AUTHN_PASSPHRASE_KEY);
   if (str && str->data)
     {
       *passphrase = str->data;
@@ -98,8 +99,8 @@ svn_auth__ssl_client_cert_pw_set(svn_boo
                                  svn_boolean_t non_interactive,
                                  apr_pool_t *pool)
 {
-  apr_hash_set(creds, AUTHN_PASSPHRASE_KEY, APR_HASH_KEY_STRING,
-               svn_string_create(passphrase, pool));
+  svn_hash_sets(creds, AUTHN_PASSPHRASE_KEY,
+                svn_string_create(passphrase, pool));
   *done = TRUE;
   return SVN_NO_ERROR;
 }
@@ -114,15 +115,13 @@ svn_auth__ssl_client_cert_pw_cache_get(v
                                        const char *passtype,
                                        apr_pool_t *pool)
 {
-  svn_config_t *cfg = apr_hash_get(parameters,
-                                   SVN_AUTH_PARAM_CONFIG_CATEGORY_SERVERS,
-                                   APR_HASH_KEY_STRING);
-  const char *server_group = apr_hash_get(parameters,
-                                          SVN_AUTH_PARAM_SERVER_GROUP,
-                                          APR_HASH_KEY_STRING);
-  svn_boolean_t non_interactive = apr_hash_get(parameters,
-                                               SVN_AUTH_PARAM_NON_INTERACTIVE,
-                                               APR_HASH_KEY_STRING) != NULL;
+  svn_config_t *cfg = svn_hash_gets(parameters,
+                                    SVN_AUTH_PARAM_CONFIG_CATEGORY_SERVERS);
+  const char *server_group = svn_hash_gets(parameters,
+                                           SVN_AUTH_PARAM_SERVER_GROUP);
+  svn_boolean_t non_interactive = svn_hash_gets(parameters,
+                                                SVN_AUTH_PARAM_NON_INTERACTIVE)
+      != NULL;
   const char *password =
     svn_config_get_server_setting(cfg, server_group,
                                   SVN_CONFIG_OPTION_SSL_CLIENT_CERT_PASSWORD,
@@ -179,16 +178,13 @@ svn_auth__ssl_client_cert_pw_cache_set(s
   apr_hash_t *creds_hash = NULL;
   svn_error_t *err;
   svn_boolean_t dont_store_passphrase =
-    apr_hash_get(parameters,
-                 SVN_AUTH_PARAM_DONT_STORE_SSL_CLIENT_CERT_PP,
-                 APR_HASH_KEY_STRING) != NULL;
-  svn_boolean_t non_interactive = apr_hash_get(parameters,
-                                               SVN_AUTH_PARAM_NON_INTERACTIVE,
-                                               APR_HASH_KEY_STRING) != NULL;
+    svn_hash_gets(parameters, SVN_AUTH_PARAM_DONT_STORE_SSL_CLIENT_CERT_PP)
+    != NULL;
+  svn_boolean_t non_interactive =
+      svn_hash_gets(parameters, SVN_AUTH_PARAM_NON_INTERACTIVE) != NULL;
   svn_boolean_t no_auth_cache =
-    (! creds->may_save) || (apr_hash_get(parameters,
-                                         SVN_AUTH_PARAM_NO_AUTH_CACHE,
-                                         APR_HASH_KEY_STRING) != NULL);
+    (! creds->may_save)
+    || (svn_hash_gets(parameters, SVN_AUTH_PARAM_NO_AUTH_CACHE) != NULL);
 
   *saved = FALSE;
 
@@ -219,9 +215,8 @@ svn_auth__ssl_client_cert_pw_cache_set(s
           may_save_passphrase = FALSE;
 #else
           const char *store_ssl_client_cert_pp_plaintext =
-            apr_hash_get(parameters,
-                         SVN_AUTH_PARAM_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT,
-                         APR_HASH_KEY_STRING);
+            svn_hash_gets(parameters,
+                          SVN_AUTH_PARAM_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT);
           ssl_client_cert_pw_file_provider_baton_t *b =
             (ssl_client_cert_pw_file_provider_baton_t *)provider_baton;
 
@@ -245,8 +240,7 @@ svn_auth__ssl_client_cert_pw_cache_set(s
                      "cached answer is no" and "no answer has been
                      cached yet". */
                   svn_boolean_t *cached_answer =
-                    apr_hash_get(b->plaintext_answers, realmstring,
-                                 APR_HASH_KEY_STRING);
+                    svn_hash_gets(b->plaintext_answers, realmstring);
 
                   if (cached_answer != NULL)
                     {
@@ -276,8 +270,8 @@ svn_auth__ssl_client_cert_pw_cache_set(s
                       cached_answer = apr_palloc(cached_answer_pool,
                                                  sizeof(*cached_answer));
                       *cached_answer = may_save_passphrase;
-                      apr_hash_set(b->plaintext_answers, realmstring,
-                                   APR_HASH_KEY_STRING, cached_answer);
+                      svn_hash_sets(b->plaintext_answers, realmstring,
+                                    cached_answer);
                     }
                 }
               else
@@ -316,9 +310,8 @@ svn_auth__ssl_client_cert_pw_cache_set(s
 
           if (*saved && passtype)
             {
-              apr_hash_set(creds_hash, AUTHN_PASSTYPE_KEY,
-                           APR_HASH_KEY_STRING,
-                           svn_string_create(passtype, pool));
+              svn_hash_sets(creds_hash, AUTHN_PASSTYPE_KEY,
+                            svn_string_create(passtype, pool));
             }
 
           /* Save credentials to disk. */
@@ -448,9 +441,8 @@ ssl_client_cert_pw_prompt_first_cred(voi
   ssl_client_cert_pw_prompt_provider_baton_t *pb = provider_baton;
   ssl_client_cert_pw_prompt_iter_baton_t *ib =
     apr_pcalloc(pool, sizeof(*ib));
-  const char *no_auth_cache = apr_hash_get(parameters,
-                                           SVN_AUTH_PARAM_NO_AUTH_CACHE,
-                                           APR_HASH_KEY_STRING);
+  const char *no_auth_cache = svn_hash_gets(parameters,
+                                            SVN_AUTH_PARAM_NO_AUTH_CACHE);
 
   SVN_ERR(pb->prompt_func((svn_auth_cred_ssl_client_cert_pw_t **)
                           credentials_p, pb->prompt_baton, realmstring,
@@ -474,9 +466,8 @@ ssl_client_cert_pw_prompt_next_cred(void
                                     apr_pool_t *pool)
 {
   ssl_client_cert_pw_prompt_iter_baton_t *ib = iter_baton;
-  const char *no_auth_cache = apr_hash_get(parameters,
-                                           SVN_AUTH_PARAM_NO_AUTH_CACHE,
-                                           APR_HASH_KEY_STRING);
+  const char *no_auth_cache = svn_hash_gets(parameters,
+                                            SVN_AUTH_PARAM_NO_AUTH_CACHE);
 
   if ((ib->pb->retry_limit >= 0) && (ib->retries >= ib->pb->retry_limit))
     {

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/ssl_server_trust_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/ssl_server_trust_providers.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/ssl_server_trust_providers.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/ssl_server_trust_providers.c Fri May 10 14:58:47 2013
@@ -24,6 +24,7 @@
 
 #include <apr_pools.h>
 
+#include "svn_hash.h"
 #include "svn_auth.h"
 #include "svn_error.h"
 #include "svn_config.h"
@@ -51,13 +52,10 @@ ssl_server_trust_file_first_credentials(
                                         const char *realmstring,
                                         apr_pool_t *pool)
 {
-  apr_uint32_t *failures = apr_hash_get(parameters,
-                                        SVN_AUTH_PARAM_SSL_SERVER_FAILURES,
-                                        APR_HASH_KEY_STRING);
+  apr_uint32_t *failures = svn_hash_gets(parameters,
+                                         SVN_AUTH_PARAM_SSL_SERVER_FAILURES);
   const svn_auth_ssl_server_cert_info_t *cert_info =
-    apr_hash_get(parameters,
-                 SVN_AUTH_PARAM_SSL_SERVER_CERT_INFO,
-                 APR_HASH_KEY_STRING);
+    svn_hash_gets(parameters, SVN_AUTH_PARAM_SSL_SERVER_CERT_INFO);
   apr_hash_t *creds_hash = NULL;
   svn_auth__store_t *auth_store;
   svn_error_t *error = SVN_NO_ERROR;
@@ -77,11 +75,9 @@ ssl_server_trust_file_first_credentials(
       svn_string_t *trusted_cert, *this_cert, *failstr;
       apr_uint32_t last_failures = 0;
 
-      trusted_cert = apr_hash_get(creds_hash, AUTHN_ASCII_CERT_KEY,
-                                  APR_HASH_KEY_STRING);
+      trusted_cert = svn_hash_gets(creds_hash, AUTHN_ASCII_CERT_KEY);
       this_cert = svn_string_create(cert_info->ascii_cert, pool);
-      failstr = apr_hash_get(creds_hash, AUTHN_FAILURES_KEY,
-                             APR_HASH_KEY_STRING);
+      failstr = svn_hash_gets(creds_hash, AUTHN_FAILURES_KEY);
 
       if (failstr)
         {
@@ -131,16 +127,15 @@ ssl_server_trust_file_save_credentials(s
   if (! creds->may_save)
     return SVN_NO_ERROR;
 
-  cert_info = apr_hash_get(parameters,
-                           SVN_AUTH_PARAM_SSL_SERVER_CERT_INFO,
-                           APR_HASH_KEY_STRING);
+  cert_info = svn_hash_gets(parameters, SVN_AUTH_PARAM_SSL_SERVER_CERT_INFO);
 
   creds_hash = apr_hash_make(pool);
-  apr_hash_set(creds_hash, AUTHN_ASCII_CERT_KEY, APR_HASH_KEY_STRING,
-               svn_string_create(cert_info->ascii_cert, pool));
-  apr_hash_set(creds_hash, AUTHN_FAILURES_KEY, APR_HASH_KEY_STRING,
-               svn_string_createf(pool, "%lu", (unsigned long)
-                                  creds->accepted_failures));
+  svn_hash_sets(creds_hash, AUTHN_ASCII_CERT_KEY,
+                svn_string_create(cert_info->ascii_cert, pool));
+  svn_hash_sets(creds_hash,
+                AUTHN_FAILURES_KEY,
+                svn_string_createf(pool, "%lu",
+                                   (unsigned long)creds->accepted_failures));
 
   SVN_ERR(svn_auth__get_store_from_parameters(&auth_store, parameters, pool));
   SVN_ERR(svn_auth__store_set_cred_hash(saved, auth_store,
@@ -192,16 +187,12 @@ ssl_server_trust_prompt_first_cred(void 
                                    apr_pool_t *pool)
 {
   ssl_server_trust_prompt_provider_baton_t *pb = provider_baton;
-  apr_uint32_t *failures = apr_hash_get(parameters,
-                                        SVN_AUTH_PARAM_SSL_SERVER_FAILURES,
-                                        APR_HASH_KEY_STRING);
-  const char *no_auth_cache = apr_hash_get(parameters,
-                                           SVN_AUTH_PARAM_NO_AUTH_CACHE,
-                                           APR_HASH_KEY_STRING);
+  apr_uint32_t *failures = svn_hash_gets(parameters,
+                                         SVN_AUTH_PARAM_SSL_SERVER_FAILURES);
+  const char *no_auth_cache = svn_hash_gets(parameters,
+                                            SVN_AUTH_PARAM_NO_AUTH_CACHE);
   const svn_auth_ssl_server_cert_info_t *cert_info =
-    apr_hash_get(parameters,
-                 SVN_AUTH_PARAM_SSL_SERVER_CERT_INFO,
-                 APR_HASH_KEY_STRING);
+    svn_hash_gets(parameters, SVN_AUTH_PARAM_SSL_SERVER_CERT_INFO);
   svn_boolean_t may_save = (!no_auth_cache
                             && !(*failures & SVN_AUTH_SSL_OTHER));
 

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/stream.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/stream.c Fri May 10 14:58:47 2013
@@ -21,8 +21,6 @@
  * ====================================================================
  */
 
-#include "svn_private_config.h"
-
 #include <assert.h>
 #include <stdio.h>
 
@@ -42,6 +40,7 @@
 #include "svn_utf.h"
 #include "svn_checksum.h"
 #include "svn_path.h"
+#include "svn_private_config.h"
 #include "private/svn_error_private.h"
 #include "private/svn_eol_private.h"
 #include "private/svn_io_private.h"
@@ -1677,6 +1676,9 @@ typedef struct lazyopen_baton_t {
   svn_stream_t *real_stream;
   apr_pool_t *pool;
 
+  /* Whether to open the wrapped stream on a close call. */
+  svn_boolean_t open_on_close;
+
 } lazyopen_baton_t;
 
 
@@ -1748,7 +1750,9 @@ close_handler_lazyopen(void *baton)
 {
   lazyopen_baton_t *b = baton;
 
-  if (b->real_stream != NULL)
+  if (b->open_on_close)
+    SVN_ERR(lazyopen_if_unopened(b));
+  if (b->real_stream)
     SVN_ERR(svn_stream_close(b->real_stream));
 
   return SVN_NO_ERROR;
@@ -1781,9 +1785,23 @@ seek_handler_lazyopen(void *baton,
   return SVN_NO_ERROR;
 }
 
+/* Implements svn_stream__is_buffered_fn_t */
+static svn_boolean_t
+is_buffered_lazyopen(void *baton)
+{
+  lazyopen_baton_t *b = baton;
+
+  /* No lazy open as we cannot handle an open error. */
+  if (!b->real_stream)
+    return FALSE;
+
+  return svn_stream__is_buffered(b->real_stream);
+}
+
 svn_stream_t *
 svn_stream_lazyopen_create(svn_stream_lazyopen_func_t open_func,
                            void *open_baton,
+                           svn_boolean_t open_on_close,
                            apr_pool_t *result_pool)
 {
   lazyopen_baton_t *lob = apr_pcalloc(result_pool, sizeof(*lob));
@@ -1793,6 +1811,7 @@ svn_stream_lazyopen_create(svn_stream_la
   lob->open_baton = open_baton;
   lob->real_stream = NULL;
   lob->pool = result_pool;
+  lob->open_on_close = open_on_close;
 
   stream = svn_stream_create(lob, result_pool);
   svn_stream_set_read(stream, read_handler_lazyopen);
@@ -1801,6 +1820,7 @@ svn_stream_lazyopen_create(svn_stream_la
   svn_stream_set_close(stream, close_handler_lazyopen);
   svn_stream_set_mark(stream, mark_handler_lazyopen);
   svn_stream_set_seek(stream, seek_handler_lazyopen);
-  
+  svn_stream__set_is_buffered(stream, is_buffered_lazyopen);
+
   return stream;
 }

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/string.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/string.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/string.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/string.c Fri May 10 14:58:47 2013
@@ -1242,7 +1242,7 @@ svn_string__similarity(const svn_string_
       /* Calculate LCS length of the remainder */
       for (pstr = stra; pstr < enda; ++pstr)
         {
-          int i;
+          apr_size_t i;
           for (i = 1; i <= slots; ++i)
             {
               if (*pstr == strb[i-1])