subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1146153 - /subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c
Date Wed, 13 Jul 2011 17:41:55 GMT
Author: danielsh
Date: Wed Jul 13 17:41:55 2011
New Revision: 1146153

URL: http://svn.apache.org/viewvc?rev=1146153&view=rev
Log:
Split out a helper function.  No functional change.

* subversion/libsvn_fs_fs/rep-cache.c
  (svn_fs_fs__get_rep_reference): Move code to a new helper function.
  (rep_has_been_born): New helper function.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c?rev=1146153&r1=1146152&r2=1146153&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c Wed Jul 13 17:41:55 2011
@@ -39,6 +39,42 @@
 REP_CACHE_DB_SQL_DECLARE_STATEMENTS(statements);
 
 
+
+/** Helper functions. **/
+
+
+/* Check that REP refers to a revision that exists in FS. */
+static svn_error_t *
+rep_has_been_born(representation_t *rep,
+                  svn_fs_t *fs,
+                  apr_pool_t *pool)
+{
+  fs_fs_data_t *ffd = fs->fsap_data;
+  svn_revnum_t youngest;
+
+  SVN_ERR_ASSERT(rep);
+
+  youngest = ffd->youngest_rev_cache;
+  if (youngest < rep->revision)
+  {
+    /* Stale cache. */
+    SVN_ERR(svn_fs_fs__youngest_rev(&youngest, fs, pool));
+
+    /* Fresh cache. */
+    if (youngest < rep->revision)
+      return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
+                               _("Youngest revision is r%ld, but "
+                                 "rep-cache contains r%ld"),
+                               youngest, rep->revision);
+  }
+
+  return SVN_NO_ERROR;
+}
+
+
+
+/** Library-private API's. **/
+
 /* Body of svn_fs_fs__open_rep_cache().
    Implements svn_atomic__init_once().init_func.
  */
@@ -121,25 +157,8 @@ svn_fs_fs__get_rep_reference(representat
   else
     *rep = NULL;
 
-  /* Sanity check. */
   if (*rep)
-    {
-      svn_revnum_t youngest;
-
-      youngest = ffd->youngest_rev_cache;
-      if (youngest < (*rep)->revision)
-      {
-        /* Stale cache. */
-        SVN_ERR(svn_fs_fs__youngest_rev(&youngest, fs, pool));
-
-        /* Fresh cache. */
-        if (youngest < (*rep)->revision)
-          return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
-                                   _("Youngest revision is r%ld, but "
-                                     "rep-cache contains r%ld"),
-                                   youngest, (*rep)->revision);
-      }
-    }
+    SVN_ERR(rep_has_been_born(*rep, fs, pool));
 
   return svn_sqlite__reset(stmt);
 }



Mime
View raw message