From 2d50ad0b35677e913c38f432188d3f9f5b8515e3 Mon Sep 17 00:00:00 2001
From: Lionel Gauthier <lionel.gauthier@eurecom.fr>
Date: Wed, 8 Jan 2014 16:56:16 +0000
Subject: [PATCH] list init

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4830 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 .../INTERFACE-802.21/INCLUDE/MIH_C_Link_Primitives.h       | 4 ++--
 openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Types.h    | 7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Link_Primitives.h b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Link_Primitives.h
index 3f34154296..517511981e 100755
--- a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Link_Primitives.h
+++ b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Link_Primitives.h
@@ -200,8 +200,8 @@ typedef struct MIH_C_Link_Configure_Thresholds_request
     LIST(MIH_C_LINK_CFG_PARAM, LinkConfigureParameterList)   /*!< \brief  A list of link threshold parameters.*/
 }__attribute__((__packed__))MIH_C_Link_Configure_Thresholds_request_t;
 
-
-TYPEDEF_LIST(MIH_C_LINK_CFG_STATUS, 16);
+#define MIH_C_LINK_CFG_STATUS_LIST_LENGTH 16
+TYPEDEF_LIST(MIH_C_LINK_CFG_STATUS, MIH_C_LINK_CFG_STATUS_LIST_LENGTH);
 /*! \struct  MIH_C_Link_Configure_Thresholds_confirm
 * \brief Structure defining the Link_Configure_Thresholds.confirm MIH_LINK_SAP primitive (see IEEE Std 802.21-2008 7.3.13.2 Link_Configure_Thresholds.confirm)
 */
diff --git a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Types.h b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Types.h
index 79317eb12f..a35f47d472 100755
--- a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Types.h
+++ b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Types.h
@@ -546,13 +546,18 @@ u_int16_t MIH_C_LIST_LENGTH_get_encode_length(u_int16_t lengthP);
                 DATA_TYPE_NAME ## _encode(bbP, &listP->val[index++]);\
             }\
         }\
+    };\
+    inline void DATA_TYPE_NAME ## _LIST_init(DATA_TYPE_NAME ## _LIST_T *listP) {\
+        listP->length = 0;\
+        memset(listP->val, 0, MAX_LENGTH*sizeof(DATA_TYPE_NAME ## _T));\
     };
 
 #else
 #define TYPEDEF_LIST(DATA_TYPE_NAME, MAX_LENGTH)    typedef  struct DATA_TYPE_NAME ## _LIST { u_int16_t length; DATA_TYPE_NAME ## _T val[MAX_LENGTH];} DATA_TYPE_NAME ## _LIST_T;\
     extern unsigned int DATA_TYPE_NAME ## _LIST2String(DATA_TYPE_NAME ## _LIST_T *listP, char* bufP);\
     extern void         DATA_TYPE_NAME ## _LIST_decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _LIST_T *listP);\
-    extern void         DATA_TYPE_NAME ## _LIST_encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _LIST_T *listP);
+    extern void         DATA_TYPE_NAME ## _LIST_encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _LIST_T *listP);\
+    extern void         DATA_TYPE_NAME ## _LIST_init(DATA_TYPE_NAME ## _LIST_T *listP);
 #endif
 #define LIST(DATA_TYPE_NAME, VAR_NAME)              DATA_TYPE_NAME ## _LIST_T VAR_NAME ## _list;
 
-- 
GitLab