aboutsummaryrefslogtreecommitdiffstats
path: root/e_os.h
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2016-01-30 12:04:25 -0500
committerRich Salz <rsalz@openssl.org>2016-02-11 12:40:32 -0500
commitf3f1cf8444f439c0be9de04bf3821a20d00fd956 (patch)
tree50d0fc624d4680e6cd734328126cd60a9dc128be /e_os.h
parent7823d792d0cad3b44ad5389a8d3381becefe7f44 (diff)
downloadopenssl-f3f1cf8444f439c0be9de04bf3821a20d00fd956.tar.gz
Move to REF_DEBUG, for consistency.
Add utility macros REF_ASSERT_NOT and REF_PRINT_COUNT This is also RT 4181 Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'e_os.h')
-rw-r--r--e_os.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/e_os.h b/e_os.h
index 4456b7e51c..0701a78d5c 100644
--- a/e_os.h
+++ b/e_os.h
@@ -71,15 +71,26 @@ extern "C" {
#endif
/* Used to checking reference counts, most while doing perl5 stuff :-) */
-# ifdef REF_PRINT
-# undef REF_PRINT
-# define REF_PRINT(a,b) fprintf(stderr,"%08X:%4d:%s\n",(int)b,b->references,a)
+# if defined(OPENSSL_NO_STDIO)
+# if defined(REF_DEBUG)
+# error "REF_DEBUG requires stdio"
+# endif
+# if defined(REF_PRINT)
+# error "REF_PRINT requires stdio"
+# endif
# endif
-# if defined(OPENSSL_NO_STDIO) && defined(REF_CHECK)
-# error "Cannot have REF_CHECK with no-stdio"
+
+# if defined(REF_DEBUG)
+# define REF_ASSERT_ISNT(test) \
+ (void)((test) ? (OpenSSLDie(__FILE__, __LINE__, "refcount error"), 1) : 0)
+# else
+# define REF_ASSERT_ISNT(i)
# endif
-# if defined(OPENSSL_NO_STDIO) && defined(REF_PRINT)
-# error "Cannot have REF_PRINT with no-stdio"
+# ifdef REF_PRINT
+# define REF_PRINT_COUNT(a, b) \
+ fprintf(stderr, "%p:%4d:%s\n", b, b->references, a)
+# else
+# define REF_PRINT_COUNT(a, b)
# endif
# ifndef DEVRANDOM