src/share/native/common/jni_util.h
Print this page
@@ -276,10 +276,42 @@
*/
#define IS_NULL(obj) ((obj) == NULL)
#define JNU_IsNull(env,obj) ((obj) == NULL)
+/************************************************************************
+ * Miscellaneous utilities used by the class libraries to return from
+ * a function if a value is NULL or an exception is pending.
+ */
+
+#define CHECK_NULL(x) \
+ do { \
+ if ((x) == NULL) { \
+ return; \
+ } \
+ } while (0) \
+
+#define CHECK_NULL_RETURN(x, y) \
+ do { \
+ if ((x) == NULL) { \
+ return (y); \
+ } \
+ } while (0) \
+
+#define JNU_CHECK_EXCEPTION(env) \
+ do { \
+ if ((*env)->ExceptionCheck(env)) { \
+ return; \
+ } \
+ } while (0) \
+
+#define JNU_CHECK_EXCEPTION_RETURN(env, y) \
+ do { \
+ if ((*env)->ExceptionCheck(env)) { \
+ return (y); \
+ } \
+ } while (0)
/************************************************************************
* Debugging utilities
*/