You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2011/05/21 17:22:02 UTC

svn commit: r1125728 - in /subversion/trunk/subversion: libsvn_fs/fs-loader.c libsvn_repos/repos.c

Author: stefan2
Date: Sat May 21 15:22:02 2011
New Revision: 1125728

URL: http://svn.apache.org/viewvc?rev=1125728&view=rev
Log:
Simplify code used to access hashed FS configuration info.

* subversion/libsvn_repos/repos.c
  (svn_repos_create): use svn_hash_get_* to simplify the code
* subversion/libsvn_fs/fs-loader.c
  (svn_fs_create): dito

Modified:
    subversion/trunk/subversion/libsvn_fs/fs-loader.c
    subversion/trunk/subversion/libsvn_repos/repos.c

Modified: subversion/trunk/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/fs-loader.c?rev=1125728&r1=1125727&r2=1125728&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/trunk/subversion/libsvn_fs/fs-loader.c Sat May 21 15:22:02 2011
@@ -44,6 +44,7 @@
 #include "private/svn_utf_private.h"
 
 #include "fs-loader.h"
+#include "svn_hash.h"
 
 /* This is defined by configure on platforms which use configure, but
    we need to define a fallback for Windows. */
@@ -398,13 +399,10 @@ svn_fs_create(svn_fs_t **fs_p, const cha
   svn_error_t *err;
   svn_error_t *err2;
   fs_library_vtable_t *vtable;
-  const char *fs_type = NULL;
-
-  if (fs_config)
-    fs_type = apr_hash_get(fs_config, SVN_FS_CONFIG_FS_TYPE,
-                           APR_HASH_KEY_STRING);
-  if (fs_type == NULL)
-    fs_type = DEFAULT_FS_TYPE;
+  
+  const char *fs_type = svn_hash_get_cstring(fs_config, 
+                                             SVN_FS_CONFIG_FS_TYPE, 
+                                             DEFAULT_FS_TYPE);
   SVN_ERR(get_library_vtable(&vtable, fs_type, pool));
 
   /* Create the FS directory and write out the fsap-name file. */

Modified: subversion/trunk/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/repos.c?rev=1125728&r1=1125727&r2=1125728&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/repos.c (original)
+++ subversion/trunk/subversion/libsvn_repos/repos.c Sat May 21 15:22:02 2011
@@ -32,6 +32,7 @@
 #include "svn_fs.h"
 #include "svn_ra.h"  /* for SVN_RA_CAPABILITY_* */
 #include "svn_repos.h"
+#include "svn_hash.h"
 #include "private/svn_repos_private.h"
 #include "svn_private_config.h" /* for SVN_TEMPLATE_ROOT_DIR */
 
@@ -1224,17 +1225,10 @@ svn_repos_create(svn_repos_t **repos_p,
   repos->format = SVN_REPOS__FORMAT_NUMBER;
 
   /* Discover the type of the filesystem we are about to create. */
-  if (fs_config)
-    {
-      repos->fs_type = apr_hash_get(fs_config, SVN_FS_CONFIG_FS_TYPE,
-                                    APR_HASH_KEY_STRING);
-      if (apr_hash_get(fs_config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE,
-                       APR_HASH_KEY_STRING))
-        repos->format = SVN_REPOS__FORMAT_NUMBER_LEGACY;
-    }
-
-  if (! repos->fs_type)
-    repos->fs_type = DEFAULT_FS_TYPE;
+  repos->fs_type = svn_hash_get_cstring(fs_config, SVN_FS_CONFIG_FS_TYPE, 
+                                        DEFAULT_FS_TYPE);
+  if (svn_hash_get_bool(fs_config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE, FALSE))
+    repos->format = SVN_REPOS__FORMAT_NUMBER_LEGACY;
 
   /* Don't create a repository inside another repository. */
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));