File: asn1c-talloc.patch

package info (click to toggle)
osmo-libasn1c 0.9.31-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 956 kB
  • sloc: ansic: 15,495; sh: 71; makefile: 21
file content (28 lines) | stat: -rw-r--r-- 990 bytes parent folder | download
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)