aboutsummaryrefslogtreecommitdiffstats
path: root/skeletons/asn_internal.h
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2007-06-29 11:38:57 +0000
committerLev Walkin <vlm@lionet.info>2007-06-29 11:38:57 +0000
commit3e86a4eafef0f8a1e97b66950d3a57ad1579f4e3 (patch)
tree495f71f503d9eeef00355ba9eea2dc77dfa7e796 /skeletons/asn_internal.h
parent7c97b88e0d24260ff9790ff675aa7a38a190ed4e (diff)
thread safety to the masses
Diffstat (limited to 'skeletons/asn_internal.h')
-rw-r--r--skeletons/asn_internal.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/skeletons/asn_internal.h b/skeletons/asn_internal.h
index 3f99452f..674ed511 100644
--- a/skeletons/asn_internal.h
+++ b/skeletons/asn_internal.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2003, 2004, 2005 Lev Walkin <vlm@lionet.info>.
+ * Copyright (c) 2003, 2004, 2005, 2007 Lev Walkin <vlm@lionet.info>.
* All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
@@ -35,10 +35,17 @@ int get_asn1c_environment_version(void); /* Run-time version */
#ifndef ASN_DEBUG /* If debugging code is not defined elsewhere... */
#if EMIT_ASN_DEBUG == 1 /* And it was asked to emit this code... */
#ifdef __GNUC__
-#define ASN_DEBUG(fmt, args...) do { \
- fprintf(stderr, fmt, ##args); \
- fprintf(stderr, " (%s:%d)\n", \
- __FILE__, __LINE__); \
+#ifdef ASN_THREAD_SAFE
+#define asn_debug_indent 0
+#endif
+int asn_debug_indent;
+#endif
+#define ASN_DEBUG(fmt, args...) do { \
+ int adi = asn_debug_indent; \
+ while(adi--) fprintf(stderr, " "); \
+ fprintf(stderr, fmt, ##args); \
+ fprintf(stderr, " (%s:%d)\n", \
+ __FILE__, __LINE__); \
} while(0)
#else /* !__GNUC__ */
void ASN_DEBUG_f(const char *fmt, ...);