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 2015/01/17 13:09:56 UTC

svn commit: r1652586 - in /subversion/trunk/subversion/libsvn_fs_x: rep-cache.c rep-cache.h transaction.c

Author: stefan2
Date: Sat Jan 17 12:09:55 2015
New Revision: 1652586

URL: http://svn.apache.org/r1652586
Log:
Switch the last function in FSX/rep-cache to using the 2-pool paradigm.

* subversion/libsvn_fs_x/rep-cache.h
  (svn_fs_x__get_rep_reference): Switch declaration to the new paradigm.

* subversion/libsvn_fs_x/rep-cache.c
  (svn_fs_x__get_rep_reference): Use two pools now.
  (svn_fs_x__set_rep_reference): Update caller.

* subversion/libsvn_fs_x/transaction.c
  (get_shared_rep): Same.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/rep-cache.c
    subversion/trunk/subversion/libsvn_fs_x/rep-cache.h
    subversion/trunk/subversion/libsvn_fs_x/transaction.c

Modified: subversion/trunk/subversion/libsvn_fs_x/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/rep-cache.c?rev=1652586&r1=1652585&r2=1652586&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/rep-cache.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/rep-cache.c Sat Jan 17 12:09:55 2015
@@ -239,7 +239,8 @@ svn_error_t *
 svn_fs_x__get_rep_reference(svn_fs_x__representation_t **rep,
                             svn_fs_t *fs,
                             svn_checksum_t *checksum,
-                            apr_pool_t *pool)
+                            apr_pool_t *result_pool,
+                            apr_pool_t *scratch_pool)
 {
   svn_fs_x__data_t *ffd = fs->fsap_data;
   svn_sqlite__stmt_t *stmt;
@@ -247,7 +248,7 @@ svn_fs_x__get_rep_reference(svn_fs_x__re
 
   SVN_ERR_ASSERT(ffd->rep_sharing_allowed);
   if (! ffd->rep_cache_db)
-    SVN_ERR(svn_fs_x__open_rep_cache(fs, pool));
+    SVN_ERR(svn_fs_x__open_rep_cache(fs, scratch_pool));
 
   /* We only allow SHA1 checksums in this table. */
   if (checksum->kind != svn_checksum_sha1)
@@ -257,12 +258,12 @@ svn_fs_x__get_rep_reference(svn_fs_x__re
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, ffd->rep_cache_db, STMT_GET_REP));
   SVN_ERR(svn_sqlite__bindf(stmt, "s",
-                            svn_checksum_to_cstring(checksum, pool)));
+                            svn_checksum_to_cstring(checksum, scratch_pool)));
 
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
   if (have_row)
     {
-      *rep = apr_pcalloc(pool, sizeof(**rep));
+      *rep = apr_pcalloc(result_pool, sizeof(**rep));
       memcpy((*rep)->sha1_digest, checksum->digest,
              sizeof((*rep)->sha1_digest));
       (*rep)->has_sha1 = TRUE;
@@ -280,12 +281,12 @@ svn_fs_x__get_rep_reference(svn_fs_x__re
     {
       /* Check that REP refers to a revision that exists in FS. */
       svn_revnum_t revision = svn_fs_x__get_revnum((*rep)->id.change_set);
-      svn_error_t *err = svn_fs_x__ensure_revision_exists(revision, fs, pool);
+      svn_error_t *err = svn_fs_x__ensure_revision_exists(revision, fs,
+                                                          scratch_pool);
       if (err)
         return svn_error_createf(SVN_ERR_FS_CORRUPT, err,
-                                 "Checksum '%s' in rep-cache is beyond HEAD",
-                                 svn_checksum_to_cstring_display(checksum,
-                                                                 pool));
+                   "Checksum '%s' in rep-cache is beyond HEAD",
+                   svn_checksum_to_cstring_display(checksum, scratch_pool));
     }
 
   return SVN_NO_ERROR;
@@ -335,7 +336,7 @@ svn_fs_x__set_rep_reference(svn_fs_t *fs
          should exist.  If so that's cool -- just do nothing.  If not,
          that's a red flag!  */
       SVN_ERR(svn_fs_x__get_rep_reference(&old_rep, fs, &checksum,
-                                          scratch_pool));
+                                          scratch_pool, scratch_pool));
 
       if (!old_rep)
         {

Modified: subversion/trunk/subversion/libsvn_fs_x/rep-cache.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/rep-cache.h?rev=1652586&r1=1652585&r2=1652586&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/rep-cache.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/rep-cache.h Sat Jan 17 12:09:55 2015
@@ -61,14 +61,15 @@ svn_fs_x__walk_rep_reference(svn_fs_t *f
                              apr_pool_t *scratch_pool);
 
 /* Return the representation REP in FS which has fulltext CHECKSUM.
-   REP is allocated in POOL.  If the rep cache database has not been
-   opened, just set *REP to NULL.  Returns SVN_ERR_FS_CORRUPT if
-   a reference beyond HEAD is detected. */
+   REP is allocated in RESULT_POOL.  If the rep cache database has not been
+   opened, just set *REP to NULL.  Returns SVN_ERR_FS_CORRUPT if a reference
+   beyond HEAD is detected.  Uses SCRATCH_POOL for temporary allocations. */
 svn_error_t *
 svn_fs_x__get_rep_reference(svn_fs_x__representation_t **rep,
                             svn_fs_t *fs,
                             svn_checksum_t *checksum,
-                            apr_pool_t *pool);
+                            apr_pool_t *result_pool,
+                            apr_pool_t *scratch_pool);
 
 /* Set the representation REP in FS, using REP->CHECKSUM.
    Use SCRATCH_POOL for temporary allocations.  Returns SVN_ERR_FS_CORRUPT

Modified: subversion/trunk/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/transaction.c?rev=1652586&r1=1652585&r2=1652586&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/transaction.c Sat Jan 17 12:09:55 2015
@@ -2213,7 +2213,9 @@ get_shared_rep(svn_fs_x__representation_
       svn_checksum_t checksum;
       checksum.digest = rep->sha1_digest;
       checksum.kind = svn_checksum_sha1;
-      err = svn_fs_x__get_rep_reference(old_rep, fs, &checksum, result_pool);
+      err = svn_fs_x__get_rep_reference(old_rep, fs, &checksum, result_pool,
+                                        scratch_pool);
+
       /* ### Other error codes that we shouldn't mask out? */
       if (err == SVN_NO_ERROR)
         {