You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/07/14 12:31:54 UTC

svn commit: r1502952 - /subversion/trunk/subversion/libsvn_ra_svn/client.c

Author: rhuijben
Date: Sun Jul 14 10:31:53 2013
New Revision: 1502952

URL: http://svn.apache.org/r1502952
Log:
Following up on r1502909, resolve error leak and introduce a wrapper function
to allow returning the original SVN_ERR_CEASE_INVOCATION error chain.

* subversion/libsvn_ra_svn/client.c
  (ra_svn_log): Rename to...
  (perform_ra_svn_log): ... and add outer_error argument.

  (ra_svn_log): New function, call perform_ra_svn_log and
    compose a resulting error.

Modified:
    subversion/trunk/subversion/libsvn_ra_svn/client.c

Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/client.c?rev=1502952&r1=1502951&r2=1502952&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/client.c Sun Jul 14 10:31:53 2013
@@ -1479,16 +1479,19 @@ static svn_error_t *ra_svn_diff(svn_ra_s
 }
 
 
-static svn_error_t *ra_svn_log(svn_ra_session_t *session,
-                               const apr_array_header_t *paths,
-                               svn_revnum_t start, svn_revnum_t end,
-                               int limit,
-                               svn_boolean_t discover_changed_paths,
-                               svn_boolean_t strict_node_history,
-                               svn_boolean_t include_merged_revisions,
-                               const apr_array_header_t *revprops,
-                               svn_log_entry_receiver_t receiver,
-                               void *receiver_baton, apr_pool_t *pool)
+static svn_error_t *
+perform_ra_svn_log(svn_error_t **outer_error,
+                   svn_ra_session_t *session,
+                   const apr_array_header_t *paths,
+                   svn_revnum_t start, svn_revnum_t end,
+                   int limit,
+                   svn_boolean_t discover_changed_paths,
+                   svn_boolean_t strict_node_history,
+                   svn_boolean_t include_merged_revisions,
+                   const apr_array_header_t *revprops,
+                   svn_log_entry_receiver_t receiver,
+                   void *receiver_baton,
+                   apr_pool_t *pool)
 {
   svn_ra_svn__session_baton_t *sess_baton = session->priv;
   svn_ra_svn_conn_t *conn = sess_baton->conn;
@@ -1501,7 +1504,6 @@ static svn_error_t *ra_svn_log(svn_ra_se
   svn_boolean_t want_author = FALSE;
   svn_boolean_t want_message = FALSE;
   svn_boolean_t want_date = FALSE;
-  svn_boolean_t cease_invocation = FALSE;
 
   SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w((!", "log"));
   if (paths)
@@ -1648,7 +1650,7 @@ static svn_error_t *ra_svn_log(svn_ra_se
 
       nreceived = 0;
       if (! (limit && (nest_level == 0) && (++nreceived > limit))
-          && ! cease_invocation)
+          && ! *outer_error)
         {
           svn_error_t *err;
           log_entry = svn_log_entry_create(iterpool);
@@ -1677,9 +1679,12 @@ static svn_error_t *ra_svn_log(svn_ra_se
           err = receiver(receiver_baton, log_entry, iterpool);
           if (err && err->apr_err == SVN_ERR_CEASE_INVOCATION)
             {
-              svn_error_clear(err);
-              cease_invocation = TRUE;
+              *outer_error = svn_error_trace(
+                                svn_error_compose_create(*outer_error, err));
             }
+          else
+            SVN_ERR(err);
+
           if (log_entry->has_children)
             {
               nest_level++;
@@ -1694,19 +1699,41 @@ static svn_error_t *ra_svn_log(svn_ra_se
   svn_pool_destroy(iterpool);
 
   /* Read the response. */
-  {
-    svn_error_t *err = svn_ra_svn__read_cmd_response(conn, pool, "");
+  return svn_error_trace(svn_ra_svn__read_cmd_response(conn, pool, ""));
+}
 
-    if (cease_invocation)
-      err = svn_error_compose_create(
-                svn_error_create(SVN_ERR_CEASE_INVOCATION, NULL, NULL),
-                err);
+static svn_error_t *
+ra_svn_log(svn_ra_session_t *session,
+           const apr_array_header_t *paths,
+           svn_revnum_t start, svn_revnum_t end,
+           int limit,
+           svn_boolean_t discover_changed_paths,
+           svn_boolean_t strict_node_history,
+           svn_boolean_t include_merged_revisions,
+           const apr_array_header_t *revprops,
+           svn_log_entry_receiver_t receiver,
+           void *receiver_baton, apr_pool_t *pool)
+{
+  svn_error_t *outer_error = NULL;
+  svn_error_t *err;
 
-    return svn_error_trace(err);
-  }
+  err = svn_error_trace(perform_ra_svn_log(&outer_error,
+                                           session, paths,
+                                           start, end,
+                                           limit,
+                                           discover_changed_paths,
+                                           strict_node_history,
+                                           include_merged_revisions,
+                                           revprops,
+                                           receiver, receiver_baton,
+                                           pool));
+  return svn_error_trace(
+            svn_error_compose_create(outer_error,
+                                     err));
 }
 
 
+
 static svn_error_t *ra_svn_check_path(svn_ra_session_t *session,
                                       const char *path, svn_revnum_t rev,
                                       svn_node_kind_t *kind, apr_pool_t *pool)



Re: svn commit: r1502952 - /subversion/trunk/subversion/libsvn_ra_svn/client.c

Posted by Daniel Shahaf <da...@elego.de>.
rhuijben@apache.org wrote on Sun, Jul 14, 2013 at 10:31:54 -0000:
> Author: rhuijben
> Date: Sun Jul 14 10:31:53 2013
> New Revision: 1502952
> 
> URL: http://svn.apache.org/r1502952
> Log:
> Following up on r1502909, resolve error leak and introduce a wrapper function
> to allow returning the original SVN_ERR_CEASE_INVOCATION error chain.
> 

Thanks for the fix.

>        nreceived = 0;
>        if (! (limit && (nest_level == 0) && (++nreceived > limit))
> -          && ! cease_invocation)
> +          && ! *outer_error)

That's not part of your patch, but: why is NRECEIVED initialized one
line before it is incremented?  We could just change the condition to
"&& (1 > limit)" and delete NRECEIVED.

Re: svn commit: r1502952 - /subversion/trunk/subversion/libsvn_ra_svn/client.c

Posted by Daniel Shahaf <da...@elego.de>.
rhuijben@apache.org wrote on Sun, Jul 14, 2013 at 10:31:54 -0000:
> Author: rhuijben
> Date: Sun Jul 14 10:31:53 2013
> New Revision: 1502952
> 
> URL: http://svn.apache.org/r1502952
> Log:
> Following up on r1502909, resolve error leak and introduce a wrapper function
> to allow returning the original SVN_ERR_CEASE_INVOCATION error chain.
> 

Thanks for the fix.

>        nreceived = 0;
>        if (! (limit && (nest_level == 0) && (++nreceived > limit))
> -          && ! cease_invocation)
> +          && ! *outer_error)

That's not part of your patch, but: why is NRECEIVED initialized one
line before it is incremented?  We could just change the condition to
"&& (1 > limit)" and delete NRECEIVED.