You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by vm...@apache.org on 2012/06/01 05:10:46 UTC

svn commit: r1344977 - /subversion/branches/javahl-ra/subversion/bindings/javahl/native/JNIUtil.h

Author: vmpn
Date: Fri Jun  1 03:10:46 2012
New Revision: 1344977

URL: http://svn.apache.org/viewvc?rev=1344977&view=rev
Log:
JavaHL: Added CPPADDR_NULL_PTR macro to reduce amount of duplicate code
checking C++ pointer extracted from the java object

[ in subversion/bindings/javahl/native ]

* JNIUtil.h
  (CPPADDR_NULL_PTR): New macro to test for NULL pointer and raise java
    exception if necessary

Approved by: gstein

Modified:
    subversion/branches/javahl-ra/subversion/bindings/javahl/native/JNIUtil.h

Modified: subversion/branches/javahl-ra/subversion/bindings/javahl/native/JNIUtil.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/JNIUtil.h?rev=1344977&r1=1344976&r2=1344977&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/JNIUtil.h (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/JNIUtil.h Fri Jun  1 03:10:46 2012
@@ -273,4 +273,12 @@ class JNIUtil
  */
 #define POP_AND_RETURN_NULL             POP_AND_RETURN(NULL)
 
+#define CPPADDR_NULL_PTR(expr, ret_val)                 \
+  do {                                                  \
+    if ((expr) == NULL) {                               \
+      JNIUtil::throwError(_("bad C++ this"));           \
+      return ret_val;                                   \
+    }                                                   \
+  } while (0)
+
 #endif  // JNIUTIL_H