subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1465280 - in /subversion/trunk/subversion: include/svn_ra.h libsvn_ra_local/ra_plugin.c libsvn_ra_serf/update.c
Date Sat, 06 Apr 2013 17:46:45 GMT
Author: julianfoad
Date: Sat Apr  6 17:46:45 2013
New Revision: 1465280

URL: http://svn.apache.org/r1465280
Log:
Improve pool usage in RA-serf and RA-local by making use of the scratch pool
that is available during the 'switch' operation since r1449413.

The RA-svn implementation currently has no use for a scratch pool in that
context, so there is no change there.

* subversion/include/svn_ra.h
  (svn_ra_do_switch): State what is allocated in the result pool.
  (svn_ra_get_inherited_props): Tweak the log message for consistency.

* subversion/libsvn_ra_local/ra_plugin.c
  (get_username): Clarify pool usage in the doc string, fix typos, and
    rename 'pool' to 'scratch_pool'.
  (make_reporter): Switch to dual pools.
  (svn_ra_local__do_update,
   svn_ra_local__do_status,
   svn_ra_local__do_diff): Track the change to make_reporter().
  (svn_ra_local__do_switch): Pass the scratch pool to make_reporter().

* subversion/libsvn_ra_serf/update.c
  (make_update_reporter): Switch to dual pools.
  (svn_ra_serf__do_update,
   svn_ra_serf__do_diff,
   svn_ra_serf__do_status): Track the change to make_update_reporter().
  (svn_ra_serf__do_switch): Pass the scratch pool to make_update_reporter().

Modified:
    subversion/trunk/subversion/include/svn_ra.h
    subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
    subversion/trunk/subversion/libsvn_ra_serf/update.c

Modified: subversion/trunk/subversion/include/svn_ra.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_ra.h?rev=1465280&r1=1465279&r2=1465280&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_ra.h (original)
+++ subversion/trunk/subversion/include/svn_ra.h Sat Apr  6 17:46:45 2013
@@ -1176,8 +1176,8 @@ svn_ra_do_update(svn_ra_session_t *sessi
  * and the addition of another, but if this flag is @c TRUE,
  * unrelated items will be diffed as if they were related.
  *
- * Use @a result_pool for memory allocation and @a scratch_pool for
- * temporary work.
+ * Allocate @a *reporter and @a *report_baton in @a result_pool.  Use
+ * @a scratch_pool for temporary allocations.
  *
  * @note Pre Subversion 1.8 svnserve based servers always ignore ancestry
  * and never send copyfrom data.
@@ -1949,7 +1949,7 @@ svn_ra_get_deleted_rev(svn_ra_session_t 
  * paths relative to the repository root URL (of the repository which
  * @a ra_session is associated).
  *
- * Allocated @a *inherited_props in @a result_pool, use @a scratch_pool
+ * Allocate @a *inherited_props in @a result_pool.  Use @a scratch_pool
  * for temporary allocations.
  *
  * @since New in 1.8.

Modified: subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c?rev=1465280&r1=1465279&r2=1465280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/trunk/subversion/libsvn_ra_local/ra_plugin.c Sat Apr  6 17:46:45 2013
@@ -71,10 +71,13 @@ cleanup_access(void *data)
 }
 
 
-/* Fetch a username for use with SESS, and store it in SESS->username. */
+/* Fetch a username for use with SESSION, and store it in SESSION->username.
+ *
+ * Allocate the username in SESSION->pool.  Use SCRATCH_POOL for temporary
+ * allocations. */
 static svn_error_t *
 get_username(svn_ra_session_t *session,
-             apr_pool_t *pool)
+             apr_pool_t *scratch_pool)
 {
   svn_ra_local__session_baton_t *sess = session->priv;
 
@@ -93,7 +96,7 @@ get_username(svn_ra_session_t *session,
                                              SVN_AUTH_CRED_USERNAME,
                                              sess->uuid, /* realmstring */
                                              sess->callbacks->auth_baton,
-                                             pool));
+                                             scratch_pool));
 
           /* No point in calling next_creds(), since that assumes that the
              first_creds() somehow failed to authenticate.  But there's no
@@ -104,7 +107,8 @@ get_username(svn_ra_session_t *session,
             {
               sess->username = apr_pstrdup(session->pool,
                                            username_creds->username);
-              svn_error_clear(svn_auth_save_credentials(iterstate, pool));
+              svn_error_clear(svn_auth_save_credentials(iterstate,
+                                                        scratch_pool));
             }
           else
             sess->username = "";
@@ -279,7 +283,9 @@ static const svn_ra_reporter3_t ra_local
  * they have already wrapped with the same cancellation editor, so it ends
  * up double-wrapped.
  *
- * ... */
+ * Allocate @a *reporter and @a *report_baton in @a result_pool.  Use
+ * @a scratch_pool for temporary allocations.
+ */
 static svn_error_t *
 make_reporter(svn_ra_session_t *session,
               const svn_ra_reporter3_t **reporter,
@@ -293,7 +299,8 @@ make_reporter(svn_ra_session_t *session,
               svn_boolean_t ignore_ancestry,
               const svn_delta_editor_t *editor,
               void *edit_baton,
-              apr_pool_t *pool)
+              apr_pool_t *result_pool,
+              apr_pool_t *scratch_pool)
 {
   svn_ra_local__session_baton_t *sess = session->priv;
   void *rbaton;
@@ -301,14 +308,14 @@ make_reporter(svn_ra_session_t *session,
 
   /* Get the HEAD revision if one is not supplied. */
   if (! SVN_IS_VALID_REVNUM(revision))
-    SVN_ERR(svn_fs_youngest_rev(&revision, sess->fs, pool));
+    SVN_ERR(svn_fs_youngest_rev(&revision, sess->fs, scratch_pool));
 
   /* If OTHER_URL was provided, validate it and convert it into a
      regular filesystem path. */
   if (other_url)
     {
       const char *other_relpath
-        = svn_uri_skip_ancestor(sess->repos_url, other_url, pool);
+        = svn_uri_skip_ancestor(sess->repos_url, other_url, scratch_pool);
 
       /* Sanity check:  the other_url better be in the same repository as
          the original session url! */
@@ -319,13 +326,14 @@ make_reporter(svn_ra_session_t *session,
              "is not the same repository as\n"
              "'%s'"), other_url, sess->repos_url);
 
-      other_fs_path = apr_pstrcat(pool, "/", other_relpath, (char *)NULL);
+      other_fs_path = apr_pstrcat(scratch_pool, "/", other_relpath,
+                                  (char *)NULL);
     }
 
   /* Pass back our reporter */
   *reporter = &ra_local_reporter;
 
-  SVN_ERR(get_username(session, pool));
+  SVN_ERR(get_username(session, scratch_pool));
 
   if (sess->callbacks)
     SVN_ERR(svn_delta_get_cancellation_editor(sess->callbacks->cancel_func,
@@ -334,7 +342,7 @@ make_reporter(svn_ra_session_t *session,
                                               edit_baton,
                                               &editor,
                                               &edit_baton,
-                                              pool));
+                                              result_pool));
 
   /* Build a reporter baton. */
   SVN_ERR(svn_repos_begin_report3(&rbaton,
@@ -353,11 +361,11 @@ make_reporter(svn_ra_session_t *session,
                                   NULL,
                                   1024 * 1024,  /* process-local transfers
                                                    should be fast */
-                                  pool));
+                                  result_pool));
 
   /* Wrap the report baton given us by the repos layer with our own
      reporter baton. */
-  *report_baton = make_reporter_baton(sess, rbaton, pool);
+  *report_baton = make_reporter_baton(sess, rbaton, result_pool);
 
   return SVN_NO_ERROR;
 }
@@ -826,7 +834,7 @@ svn_ra_local__do_update(svn_ra_session_t
                        FALSE,
                        update_editor,
                        update_baton,
-                       pool);
+                       pool, pool);
 }
 
 
@@ -857,7 +865,7 @@ svn_ra_local__do_switch(svn_ra_session_t
                        ignore_ancestry,
                        update_editor,
                        update_baton,
-                       result_pool);
+                       result_pool, scratch_pool);
 }
 
 
@@ -884,7 +892,7 @@ svn_ra_local__do_status(svn_ra_session_t
                        FALSE,
                        status_editor,
                        status_baton,
-                       pool);
+                       pool, pool);
 }
 
 
@@ -914,7 +922,7 @@ svn_ra_local__do_diff(svn_ra_session_t *
                        ignore_ancestry,
                        update_editor,
                        update_baton,
-                       pool);
+                       pool, pool);
 }
 
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1465280&r1=1465279&r2=1465280&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Sat Apr  6 17:46:45 2013
@@ -3152,10 +3152,9 @@ make_update_reporter(svn_ra_session_t *r
                      svn_boolean_t send_copyfrom_args,
                      const svn_delta_editor_t *update_editor,
                      void *update_baton,
-                     apr_pool_t *result_pool)
+                     apr_pool_t *result_pool,
+                     apr_pool_t *scratch_pool)
 {
-  /* ### would be nice to get a SCRATCH_POOL passed to us.  */
-  apr_pool_t *scratch_pool = svn_pool_create(result_pool);
   report_context_t *report;
   const svn_delta_editor_t *filter_editor;
   void *filter_baton;
@@ -3336,7 +3335,6 @@ make_update_reporter(svn_ra_session_t *r
   SVN_ERR(svn_io_file_write_full(report->body_file, buf->data, buf->len,
                                  NULL, scratch_pool));
 
-  svn_pool_destroy(scratch_pool);
   return SVN_NO_ERROR;
 }
 
@@ -3353,12 +3351,16 @@ svn_ra_serf__do_update(svn_ra_session_t 
                        apr_pool_t *pool)
 {
   svn_ra_serf__session_t *session = ra_session->priv;
+  apr_pool_t *scratch_pool = svn_pool_create(pool);
 
-  return make_update_reporter(ra_session, reporter, report_baton,
-                              revision_to_update_to,
-                              session->session_url.path, NULL, update_target,
-                              depth, FALSE, TRUE, send_copyfrom_args,
-                              update_editor, update_baton, pool);
+  SVN_ERR(make_update_reporter(ra_session, reporter, report_baton,
+                               revision_to_update_to,
+                               session->session_url.path, NULL, update_target,
+                               depth, FALSE, TRUE, send_copyfrom_args,
+                               update_editor, update_baton,
+                               pool, scratch_pool));
+  svn_pool_destroy(scratch_pool);
+  return SVN_NO_ERROR;
 }
 
 svn_error_t *
@@ -3376,12 +3378,16 @@ svn_ra_serf__do_diff(svn_ra_session_t *r
                      apr_pool_t *pool)
 {
   svn_ra_serf__session_t *session = ra_session->priv;
+  apr_pool_t *scratch_pool = svn_pool_create(pool);
 
-  return make_update_reporter(ra_session, reporter, report_baton,
-                              revision,
-                              session->session_url.path, versus_url, diff_target,
-                              depth, ignore_ancestry, text_deltas, FALSE,
-                              diff_editor, diff_baton, pool);
+  SVN_ERR(make_update_reporter(ra_session, reporter, report_baton,
+                               revision,
+                               session->session_url.path, versus_url, diff_target,
+                               depth, ignore_ancestry, text_deltas, FALSE,
+                               diff_editor, diff_baton,
+                               pool, scratch_pool));
+  svn_pool_destroy(scratch_pool);
+  return SVN_NO_ERROR;
 }
 
 svn_error_t *
@@ -3396,12 +3402,16 @@ svn_ra_serf__do_status(svn_ra_session_t 
                        apr_pool_t *pool)
 {
   svn_ra_serf__session_t *session = ra_session->priv;
+  apr_pool_t *scratch_pool = svn_pool_create(pool);
 
-  return make_update_reporter(ra_session, reporter, report_baton,
-                              revision,
-                              session->session_url.path, NULL, status_target,
-                              depth, FALSE, FALSE, FALSE,
-                              status_editor, status_baton, pool);
+  SVN_ERR(make_update_reporter(ra_session, reporter, report_baton,
+                               revision,
+                               session->session_url.path, NULL, status_target,
+                               depth, FALSE, FALSE, FALSE,
+                               status_editor, status_baton,
+                               pool, scratch_pool));
+  svn_pool_destroy(scratch_pool);
+  return SVN_NO_ERROR;
 }
 
 svn_error_t *
@@ -3430,7 +3440,7 @@ svn_ra_serf__do_switch(svn_ra_session_t 
                               TRUE /* text_deltas */,
                               send_copyfrom_args,
                               switch_editor, switch_baton,
-                              result_pool);
+                              result_pool, scratch_pool);
 }
 
 /* Helper svn_ra_serf__get_file(). Attempts to fetch file contents



Mime
View raw message