[[[
    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
]]]
Index: subversion/bindings/javahl/native/JNIUtil.h
===================================================================
--- subversion/bindings/javahl/native/JNIUtil.h (revision 1328758)
+++ subversion/bindings/javahl/native/JNIUtil.h (working copy)
@@ -272,4 +272,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

Reply via email to