Author: rhuijben
Date: Thu Nov 21 12:36:57 2013
New Revision: 1544161

URL: http://svn.apache.org/r1544161
Log:
* subversion/include/svn_error.h
  (svn_handle_error2): Improve documentation.

* subversion/libsvn_subr/object_pool.c
  (exit_on_error): Add arguments. Use existing malfunction infrastructure 
instead
    of assuming that every libsvn_subr user is a commandline application.

Modified:
    subversion/trunk/subversion/include/svn_error.h
    subversion/trunk/subversion/libsvn_subr/object_pool.c

Modified: subversion/trunk/subversion/include/svn_error.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_error.h?rev=1544161&r1=1544160&r2=1544161&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_error.h (original)
+++ subversion/trunk/subversion/include/svn_error.h Thu Nov 21 12:36:57 2013
@@ -268,6 +268,10 @@ svn_error__locate(const char *file,
  * what code that used to call svn_handle_error() and now calls
  * svn_handle_error2() does.
  *
+ * Note that this should only be used from commandline specific code, or
+ * code that knows that @a stream is really where the application wants
+ * to receive its errors on.
+ *
  * @since New in 1.2.
  */
 void

Modified: subversion/trunk/subversion/libsvn_subr/object_pool.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/object_pool.c?rev=1544161&r1=1544160&r2=1544161&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/object_pool.c (original)
+++ subversion/trunk/subversion/libsvn_subr/object_pool.c Thu Nov 21 12:36:57 
2013
@@ -229,13 +229,26 @@ remove_unused_objects(svn_object_pool__t
   object_pool->objects_hash_pool = new_pool;
 }
 
-/* If ERR is not 0, handle it and terminate the application.
+/* If ERR is not SVN_NO_ERROR, handle it and terminate the application.
+ *
+ * Please make this generic if necessary instead of duplicating this code.
  */
 static void
-exit_on_error(svn_error_t *err)
+exit_on_error(const char *file, int line, svn_error_t *err)
 {
   if (err)
-    svn_handle_error2(err, stderr, TRUE, "svn: ");
+    {
+      char buffer[1024];
+
+      /* The svn_error_clear() is to make static analyzers happy.
+         svn_error__malfunction() will never return */
+      svn_error_clear(
+            svn_error__malfunction(FALSE /* can_return */, file, line,
+                                   svn_err_best_message(err, buffer,
+                                                        sizeof(buffer))
+                                   ));
+      abort(); /* Only reached by broken malfunction handlers */
+    }
 }
 
 /* Cleanup function called when an object_ref_t gets released.
@@ -266,7 +279,8 @@ object_ref_cleanup(void *baton)
     }
 
   /* begin critical section */
-  exit_on_error(svn_error_trace(svn_mutex__lock(object_pool->mutex)));
+  exit_on_error(__FILE__, __LINE__,
+                svn_error_trace(svn_mutex__lock(object_pool->mutex)));
 
   /* put back into "available" container */
   if (!object_pool->share_objects)
@@ -286,7 +300,8 @@ object_ref_cleanup(void *baton)
     }
 
   /* end critical section */
-  exit_on_error(svn_error_trace(svn_mutex__unlock(object_pool->mutex, NULL)));
+  exit_on_error(__FILE__, __LINE__,
+                svn_error_trace(svn_mutex__unlock(object_pool->mutex, NULL)));
 
   /* Maintain reference counters and handle object cleanup */
   if (svn_atomic_dec(&object->ref_count) == 0)


Reply via email to