change the memory pool using pkbuf_t

This commit is contained in:
Sukchan Lee 2017-02-10 16:43:10 +09:00
parent 3d778225d8
commit 2041f65c83
8 changed files with 16 additions and 18 deletions

View File

@ -23,7 +23,7 @@ extern "C" {
#define ASN1C_ENVIRONMENT_VERSION 924 /* Compile-time version */
int get_asn1c_environment_version(void); /* Run-time version */
#if 1 /* modified by acetcom */
#if 0 /* modified by acetcom */
#define CALLOC(nmemb, size) calloc(nmemb, size)
#define MALLOC(size) malloc(size)
#define REALLOC(oldptr, size) realloc(oldptr, size)

View File

@ -30,7 +30,7 @@
/*******************************************************************************
* This file had been created by asn1tostruct.py script v1.0.2
* Please do not modify this file but regenerate it via script.
* Created on: 2017-02-09 22:00:13.084789 by acetcom
* Created on: 2017-02-10 16:41:29.642951 by acetcom
* from ['S1AP-PDU.asn']
******************************************************************************/
#define TRACE_MODULE ies_decoder

View File

@ -30,7 +30,7 @@
/*******************************************************************************
* This file had been created by asn1tostruct.py script v1.0.2
* Please do not modify this file but regenerate it via script.
* Created on: 2017-02-09 22:00:13.067890 by acetcom
* Created on: 2017-02-10 16:41:29.630365 by acetcom
* from ['S1AP-PDU.asn']
******************************************************************************/
#include "s1ap_asn1c.h"

View File

@ -30,7 +30,7 @@
/*******************************************************************************
* This file had been created by asn1tostruct.py script v1.0.2
* Please do not modify this file but regenerate it via script.
* Created on: 2017-02-09 22:00:13.107167 by acetcom
* Created on: 2017-02-10 16:41:29.658202 by acetcom
* from ['S1AP-PDU.asn']
******************************************************************************/
#include "core_debug.h"
@ -4423,7 +4423,7 @@ S1ap_IE_t *s1ap_new_ie(S1ap_ProtocolIE_ID_t id, S1ap_Criticality_t criticality,
{
S1ap_IE_t *buff;
if ((buff = malloc (sizeof (S1ap_IE_t))) == NULL)
if ((buff = MALLOC(sizeof (S1ap_IE_t))) == NULL)
{
// Possible error on malloc
return NULL;
@ -4436,8 +4436,7 @@ S1ap_IE_t *s1ap_new_ie(S1ap_ProtocolIE_ID_t id, S1ap_Criticality_t criticality,
if (ANY_fromType_aper(&buff->value, type, sptr) < 0)
{
d_error("Encoding of %s failed", type->name);
free (buff);
buff = NULL;
FREEMEM(buff);
return NULL;
}

View File

@ -30,7 +30,7 @@
/*******************************************************************************
* This file had been created by asn1tostruct.py script v1.0.2
* Please do not modify this file but regenerate it via script.
* Created on: 2017-02-09 22:00:13.124536 by acetcom
* Created on: 2017-02-10 16:41:29.668874 by acetcom
* from ['S1AP-PDU.asn']
******************************************************************************/
#define TRACE_MODULE ies_free

View File

@ -30,7 +30,7 @@
/*******************************************************************************
* This file had been created by asn1tostruct.py script v1.0.2
* Please do not modify this file but regenerate it via script.
* Created on: 2017-02-09 22:00:13.141785 by acetcom
* Created on: 2017-02-10 16:41:29.677364 by acetcom
* from ['S1AP-PDU.asn']
******************************************************************************/
#include <stdlib.h>

View File

@ -628,7 +628,7 @@ f.write("""S1ap_IE_t *s1ap_new_ie(S1ap_ProtocolIE_ID_t id, S1ap_Criticality_t cr
{
S1ap_IE_t *buff;
if ((buff = malloc (sizeof (S1ap_IE_t))) == NULL)
if ((buff = MALLOC(sizeof (S1ap_IE_t))) == NULL)
{
// Possible error on malloc
return NULL;
@ -641,8 +641,7 @@ f.write("""S1ap_IE_t *s1ap_new_ie(S1ap_ProtocolIE_ID_t id, S1ap_Criticality_t cr
if (ANY_fromType_aper(&buff->value, type, sptr) < 0)
{
d_error("Encoding of %s failed", type->name);
free (buff);
buff = NULL;
FREEMEM(buff);
return NULL;
}

View File

@ -48,7 +48,7 @@ do { \
/* Convert an integer on 32 bits to an octet string from aSN1c tool */
#define INT32_TO_OCTET_STRING(x, aSN) \
do { \
(aSN)->buf = calloc(4, sizeof(uint8_t)); \
(aSN)->buf = CALLOC(4, sizeof(uint8_t)); \
INT32_TO_BUFFER(x, ((aSN)->buf)); \
(aSN)->size = 4; \
} while(0)
@ -61,14 +61,14 @@ do { \
#define INT16_TO_OCTET_STRING(x, aSN) \
do { \
(aSN)->buf = calloc(2, sizeof(uint8_t)); \
(aSN)->buf = CALLOC(2, sizeof(uint8_t)); \
(aSN)->size = 2; \
INT16_TO_BUFFER(x, (aSN)->buf); \
} while(0)
#define INT8_TO_OCTET_STRING(x, aSN) \
do { \
(aSN)->buf = calloc(1, sizeof(uint8_t)); \
(aSN)->buf = CALLOC(1, sizeof(uint8_t)); \
(aSN)->size = 1; \
INT8_TO_BUFFER(x, (aSN)->buf); \
} while(0)
@ -129,7 +129,7 @@ do { \
#define MCC_MNC_TO_PLMNID(mCC, mNC, mNCdIGITlENGTH, oCTETsTRING) \
do { \
(oCTETsTRING)->buf = calloc(3, sizeof(uint8_t)); \
(oCTETsTRING)->buf = CALLOC(3, sizeof(uint8_t)); \
(oCTETsTRING)->buf[0] = (MCC_MNC_DECIMAL(mCC) << 4) | MCC_HUNDREDS(mCC); \
(oCTETsTRING)->buf[1] = (MNC_HUNDREDS(mNC,mNCdIGITlENGTH) << 4) | MCC_MNC_DIGIT(mCC); \
(oCTETsTRING)->buf[2] = (MCC_MNC_DIGIT(mNC) << 4) | MCC_MNC_DECIMAL(mNC); \
@ -207,7 +207,7 @@ do { \
*/
#define MACRO_ENB_ID_TO_BIT_STRING(mACRO, bITsTRING) \
do { \
(bITsTRING)->buf = calloc(3, sizeof(uint8_t)); \
(bITsTRING)->buf = CALLOC(3, sizeof(uint8_t)); \
(bITsTRING)->buf[0] = ((mACRO) >> 12); \
(bITsTRING)->buf[1] = (mACRO) >> 4; \
(bITsTRING)->buf[2] = ((mACRO) & 0x0f) << 4; \
@ -223,7 +223,7 @@ do { \
*/
#define MACRO_ENB_ID_TO_CELL_IDENTITY(mACRO, cELL_iD, bITsTRING) \
do { \
(bITsTRING)->buf = calloc(4, sizeof(uint8_t)); \
(bITsTRING)->buf = CALLOC(4, sizeof(uint8_t)); \
(bITsTRING)->buf[0] = ((mACRO) >> 12); \
(bITsTRING)->buf[1] = (mACRO) >> 4; \
(bITsTRING)->buf[2] = (((mACRO) & 0x0f) << 4) | ((cELL_iD) >> 4); \