You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ko...@apache.org on 2016/04/27 13:05:10 UTC
svn commit: r1741224 - in /subversion/trunk/subversion/libsvn_fs_fs:
rep-cache.c rep-cache.h
Author: kotkov
Date: Wed Apr 27 11:05:10 2016
New Revision: 1741224
URL: http://svn.apache.org/viewvc?rev=1741224&view=rev
Log:
Simplify the code a bit by introducing a local variable.
* subversion/libsvn_fs_fs/rep-cache.h
(svn_fs_fs__get_rep_reference): Rename output parameter `rep' to `rep_p`.
* subversion/libsvn_fs_fs/rep-cache.c
(svn_fs_fs__get_rep_reference): Introduce local variable `rep', get rid of
excessive dereferencing.
Modified:
subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c
subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h
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=1741224&r1=1741223&r2=1741224&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/rep-cache.c Wed Apr 27 11:05:10 2016
@@ -261,7 +261,7 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
If you extend this function, check the callsite to see if you have
to make it not-ignore additional error codes. */
svn_error_t *
-svn_fs_fs__get_rep_reference(representation_t **rep,
+svn_fs_fs__get_rep_reference(representation_t **rep_p,
svn_fs_t *fs,
svn_checksum_t *checksum,
apr_pool_t *pool)
@@ -269,6 +269,7 @@ svn_fs_fs__get_rep_reference(representat
fs_fs_data_t *ffd = fs->fsap_data;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
+ representation_t *rep;
SVN_ERR_ASSERT(ffd->rep_sharing_allowed);
if (! ffd->rep_cache_db)
@@ -287,29 +288,28 @@ svn_fs_fs__get_rep_reference(representat
SVN_ERR(svn_sqlite__step(&have_row, stmt));
if (have_row)
{
- *rep = apr_pcalloc(pool, sizeof(**rep));
- svn_fs_fs__id_txn_reset(&(*rep)->txn_id);
- memcpy((*rep)->sha1_digest, checksum->digest,
- sizeof((*rep)->sha1_digest));
- (*rep)->has_sha1 = TRUE;
- (*rep)->revision = svn_sqlite__column_revnum(stmt, 0);
- (*rep)->item_index = svn_sqlite__column_int64(stmt, 1);
- (*rep)->size = svn_sqlite__column_int64(stmt, 2);
- (*rep)->expanded_size = svn_sqlite__column_int64(stmt, 3);
+ rep = apr_pcalloc(pool, sizeof(*rep));
+ svn_fs_fs__id_txn_reset(&(rep->txn_id));
+ memcpy(rep->sha1_digest, checksum->digest, sizeof(rep->sha1_digest));
+ rep->has_sha1 = TRUE;
+ rep->revision = svn_sqlite__column_revnum(stmt, 0);
+ rep->item_index = svn_sqlite__column_int64(stmt, 1);
+ rep->size = svn_sqlite__column_int64(stmt, 2);
+ rep->expanded_size = svn_sqlite__column_int64(stmt, 3);
}
else
- *rep = NULL;
+ rep = NULL;
SVN_ERR(svn_sqlite__reset(stmt));
- if (*rep)
+ if (rep)
{
svn_error_t *err;
- SVN_ERR(svn_fs_fs__fixup_expanded_size(fs, *rep, pool));
+ SVN_ERR(svn_fs_fs__fixup_expanded_size(fs, rep, pool));
/* Check that REP refers to a revision that exists in FS. */
- err = svn_fs_fs__ensure_revision_exists((*rep)->revision, fs, pool);
+ err = svn_fs_fs__ensure_revision_exists(rep->revision, fs, pool);
if (err)
return svn_error_createf(SVN_ERR_FS_CORRUPT, err,
"Checksum '%s' in rep-cache is beyond HEAD",
@@ -317,6 +317,7 @@ svn_fs_fs__get_rep_reference(representat
pool));
}
+ *rep_p = rep;
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h?rev=1741224&r1=1741223&r2=1741224&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/rep-cache.h Wed Apr 27 11:05:10 2016
@@ -64,11 +64,11 @@ svn_fs_fs__walk_rep_reference(svn_fs_t *
apr_pool_t *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
+ *REP_P is allocated in POOL. If the rep cache database has not been
+ opened, just set *REP_P to NULL. Returns SVN_ERR_FS_CORRUPT if
a reference beyond HEAD is detected. */
svn_error_t *
-svn_fs_fs__get_rep_reference(representation_t **rep,
+svn_fs_fs__get_rep_reference(representation_t **rep_p,
svn_fs_t *fs,
svn_checksum_t *checksum,
apr_pool_t *pool);