aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2004-08-11 08:32:04 +0000
committerLev Walkin <vlm@lionet.info>2004-08-11 08:32:04 +0000
commit7a5e30202e2fb605eb378703354b74417a85613f (patch)
treeda123796b63d68cd1d55107e36bc5698d74c4bbb
parent3af51b46abda248dfa63f9b92f243a27a3252da9 (diff)
portability
-rw-r--r--skeletons/asn_types.h11
-rw-r--r--skeletons/constr_TYPE.c12
2 files changed, 19 insertions, 4 deletions
diff --git a/skeletons/asn_types.h b/skeletons/asn_types.h
index d2633f6f..4785f968 100644
--- a/skeletons/asn_types.h
+++ b/skeletons/asn_types.h
@@ -24,10 +24,8 @@ typedef int ssize_t;
#endif
#ifdef WIN32
-#define snprintf(str, size, format, args...) \
- _snprintf(str, size, format, ##args)
-#define vsnprintf(str, size, format, ap) \
- _vsnprintf(str, size, format, ap)
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
#define alloca(size) _alloca(size)
#endif
@@ -59,10 +57,15 @@ typedef int ssize_t;
*/
#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, "\n"); \
} while(0)
+#else /* !__GNUC__ */
+extern void ASN_DEBUG_f(const char *fmt, ...);
+#define ASN_DEBUG ASN_DEBUG_f
+#endif /* __GNUC__ */
#else /* EMIT_ASN_DEBUG */
#define ASN_DEBUG(fmt, args...) ((void)0) /* Emit a no-op operator */
#endif /* EMIT_ASN_DEBUG */
diff --git a/skeletons/constr_TYPE.c b/skeletons/constr_TYPE.c
index 9ab1bdc5..2a19bc98 100644
--- a/skeletons/constr_TYPE.c
+++ b/skeletons/constr_TYPE.c
@@ -56,3 +56,15 @@ _print2fp(const void *buffer, size_t size, void *app_key) {
return 0;
}
+
+/*
+ * Some compilers do not support variable args macros.
+ * This function is a replacement of ASN_DEBUG() macro.
+ */
+void ASN_DEBUG_f(const char *fmt, ...) {
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\n");
+ va_end(ap);
+}