9 #ifndef _ASN_INTERNAL_H_ 10 #define _ASN_INTERNAL_H_ 14 #ifndef __NO_ASSERT_H__ 23 #define ASN1C_ENVIRONMENT_VERSION 923 26 #define CALLOC(nmemb, size) calloc(nmemb, size) 27 #define MALLOC(size) malloc(size) 28 #define REALLOC(oldptr, size) realloc(oldptr, size) 29 #define FREEMEM(ptr) free(ptr) 31 #define asn_debug_indent 0 32 #define ASN_DEBUG_INDENT_ADD(i) do{}while(0) 39 #if EMIT_ASN_DEBUG == 1 41 #ifdef ASN_THREAD_SAFE 45 #undef ASN_DEBUG_INDENT_ADD 46 #undef asn_debug_indent 48 #define ASN_DEBUG_INDENT_ADD(i) do { asn_debug_indent += i; } while(0) 50 #define ASN_DEBUG(fmt, args...) do { \ 51 int adi = asn_debug_indent; \ 52 while(adi--) fprintf(stderr, " "); \ 53 fprintf(stderr, fmt, ##args); \ 54 fprintf(stderr, " (%s:%d)\n", \ 55 __FILE__, __LINE__); \ 59 #define ASN_DEBUG ASN_DEBUG_f 62 static inline void ASN_DEBUG(
const char *fmt, ...) { (void)fmt; }
69 #define __ASN_E_cbc(buf, size) (cb((buf), (size), app_key) < 0) 70 #define _ASN_E_CALLBACK(foo) do { \ 71 if(foo) goto cb_failed; \ 73 #define _ASN_CALLBACK(buf, size) \ 74 _ASN_E_CALLBACK(__ASN_E_cbc(buf, size)) 75 #define _ASN_CALLBACK2(buf1, size1, buf2, size2) \ 76 _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1) || __ASN_E_cbc(buf2, size2)) 77 #define _ASN_CALLBACK3(buf1, size1, buf2, size2, buf3, size3) \ 78 _ASN_E_CALLBACK(__ASN_E_cbc(buf1, size1) \ 79 || __ASN_E_cbc(buf2, size2) \ 80 || __ASN_E_cbc(buf3, size3)) 82 #define _i_ASN_TEXT_INDENT(nl, level) do { \ 83 int __level = (level); \ 84 int __nl = ((nl) != 0); \ 86 if(__nl) _ASN_CALLBACK("\n", 1); \ 87 if(__level < 0) __level = 0; \ 88 for(__i = 0; __i < __level; __i++) \ 89 _ASN_CALLBACK(" ", 4); \ 90 er.encoded += __nl + 4 * __level; \ 93 #define _i_INDENT(nl) do { \ 95 if((nl) && cb("\n", 1, app_key) < 0) return -1; \ 96 for(__i = 0; __i < ilevel; __i++) \ 97 if(cb(" ", 4, app_key) < 0) return -1; \ 103 #define _ASN_DEFAULT_STACK_MAX (30000) 109 ptrdiff_t usedstack = ((
char *)ctx - (
char *)&ctx);
110 if(usedstack > 0) usedstack = -usedstack;
void ASN_DEBUG_f(const char *fmt,...)
int get_asn1c_environment_version(void)
static int _ASN_STACK_OVERFLOW_CHECK(asn_codec_ctx_t *ctx)
static void ASN_DEBUG(const char *fmt,...)