Convert libasn1c to use talloc from libosmocore
This commit is contained in:
parent
ec0e217b06
commit
fa034009a1
|
@ -0,0 +1,30 @@
|
|||
diff --git a/include/asn1c/asn_internal.h b/include/asn1c/asn_internal.h
|
||||
index 67f055a..45b1adb 100644
|
||||
--- a/include/asn1c/asn_internal.h
|
||||
+++ b/include/asn1c/asn_internal.h
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <assert.h> /* for assert() macro */
|
||||
#endif
|
||||
|
||||
+#include <osmocore/talloc.h>
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -23,10 +25,12 @@ extern "C" {
|
||||
#define ASN1C_ENVIRONMENT_VERSION 920 /* 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_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)
|
||||
|
||||
/*
|
||||
* A macro for debugging the ASN.1 internals.
|
|
@ -15,6 +15,8 @@ AC_PROG_LIBTOOL
|
|||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.1.13)
|
||||
|
||||
# The following test is taken from WebKit's webkit.m4
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fvisibility=hidden "
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include <assert.h> /* for assert() macro */
|
||||
#endif
|
||||
|
||||
#include <osmocore/talloc.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -23,10 +25,12 @@ extern "C" {
|
|||
#define ASN1C_ENVIRONMENT_VERSION 922 /* 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_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)
|
||||
|
||||
/*
|
||||
* A macro for debugging the ASN.1 internals.
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
LIBVERSION=0:0:0
|
||||
|
||||
INCLUDES = $(all_includes) -I$(top_srcdir)/include/asn1c
|
||||
AM_CFLAGS = -fPIC -Wall
|
||||
AM_CFLAGS = -fPIC -Wall $(LIBOSMOCORE_CFLAGS)
|
||||
|
||||
lib_LTLIBRARIES = libasn1c.la
|
||||
|
||||
libasn1c_la_LDFLAGS = $(LIBOSMOCORE_LIBS)
|
||||
libasn1c_la_SOURCES = ANY.c constraints.c GeneralizedTime.c NumericString.c T61String.c asn_codecs_prim.c constr_CHOICE.c GeneralString.c ObjectDescriptor.c TeletexString.c asn_SEQUENCE_OF.c constr_SEQUENCE.c GraphicString.c OBJECT_IDENTIFIER.c UniversalString.c asn_SET_OF.c constr_SEQUENCE_OF.c IA5String.c OCTET_STRING.c UTCTime.c ber_decoder.c constr_SET.c INTEGER.c per_decoder.c UTF8String.c ber_tlv_length.c constr_SET_OF.c ISO646String.c per_encoder.c VideotexString.c ber_tlv_tag.c constr_TYPE.c NativeEnumerated.c per_support.c VisibleString.c BIT_STRING.c NativeInteger.c PrintableString.c xer_decoder.c BMPString.c der_encoder.c NativeReal.c REAL.c xer_encoder.c BOOLEAN.c ENUMERATED.c NULL.c RELATIVE-OID.c xer_support.c per_opentype.c
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <asn_codecs_prim.h>
|
||||
#include <errno.h>
|
||||
|
||||
void *talloc_asn1_ctx;
|
||||
|
||||
/*
|
||||
* Decode an always-primitive type.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue