summaryrefslogtreecommitdiffstats
path: root/asn1c-talloc.patch
blob: 87bb44b0f59c6c3c90357bcd6e00f3f32c86ce33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- ../asn1c/skeletons/asn_internal.h	2015-08-31 09:29:45.590924282 +0200
+++ include/asn1c/asn_internal.h	2015-08-31 09:26:17.461872713 +0200
@@ -15,6 +15,8 @@
 #include <assert.h>		/* for assert() macro */
 #endif
 
+#include <osmocom/core/talloc.h>
+
 #ifdef	__cplusplus
 extern "C" {
 #endif
@@ -23,10 +25,12 @@
 #define	ASN1C_ENVIRONMENT_VERSION	924	/* Compile-time version */
 int get_asn1c_environment_version(void);	/* Run-time version */
 
-#define	CALLOC(nmemb, size)	calloc(nmemb, size)
-#define	MALLOC(size)		malloc(size)
-#define	REALLOC(oldptr, size)	realloc(oldptr, size)
-#define	FREEMEM(ptr)		free(ptr)
+extern void *talloc_asn1_ctx;
+
+#define	CALLOC(nmemb, size)	talloc_zero_size(talloc_asn1_ctx, (nmemb) * (size))
+#define	MALLOC(size)		talloc_size(talloc_asn1_ctx, size)
+#define	REALLOC(oldptr, size)	talloc_realloc_size(talloc_asn1_ctx, oldptr, size)
+#define	FREEMEM(ptr)		talloc_free(ptr)
 
 #define	asn_debug_indent	0
 #define ASN_DEBUG_INDENT_ADD(i) do{}while(0)