list -> clist to avoid naming conflict.
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
#include <stdbool.h>
|
||||
#include "linklayer814_types.h"
|
||||
#include "node_list.h"
|
||||
#include "../util/list.h"
|
||||
#include "../util/clist.h"
|
||||
#include "../common.h"
|
||||
#include "../error.h"
|
||||
|
||||
@@ -79,7 +79,7 @@ static int8_t entry_compare(void *a, void *b)
|
||||
******************************************************************************/
|
||||
int32_t L2_NodeList_Init(NODE_LIST **list)
|
||||
{
|
||||
(*list) = list_new();
|
||||
(*list) = clist_new();
|
||||
if (*list == NULL)
|
||||
{
|
||||
return ENOMEM;
|
||||
@@ -100,7 +100,7 @@ int32_t L2_NodeList_Init(NODE_LIST **list)
|
||||
void L2_NodeList_Clear(NODE_LIST *list)
|
||||
{
|
||||
ASSERT(list != NULL);
|
||||
list_clear(list);
|
||||
clist_clear(list);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -114,7 +114,7 @@ void L2_NodeList_Clear(NODE_LIST *list)
|
||||
******************************************************************************/
|
||||
void L2_NodeList_Destroy(NODE_LIST *list)
|
||||
{
|
||||
list_destroy(list);
|
||||
clist_destroy(list);
|
||||
}
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
@@ -131,7 +131,7 @@ NODE_ENTRY *L2_GetNodeById(NODE_LIST *list, uint8_t nodeId)
|
||||
{
|
||||
ASSERT(list != NULL);
|
||||
util_entry.nodeInfo.nodeId = nodeId;
|
||||
list_node_t *node = list_find(list, &util_entry);
|
||||
clist_node_t *node = clist_find(list, &util_entry);
|
||||
if (node == NULL)
|
||||
{
|
||||
return NULL;
|
||||
@@ -169,7 +169,7 @@ NODE_ENTRY *L2_AppendNode(NODE_LIST *list, uint8_t nodeId, L2_NODE_TYPE nodeType
|
||||
DBG_ERROR("Failed to allocated memory for nodeEntry.\n");
|
||||
return NULL;
|
||||
}
|
||||
list_node_t *node = list_node_new(nodeEntry);
|
||||
clist_node_t *node = clist_node_new(nodeEntry);
|
||||
if (node == NULL)
|
||||
{
|
||||
DBG_ERROR("Failed to allocated memory for list node.\n");
|
||||
@@ -186,7 +186,7 @@ NODE_ENTRY *L2_AppendNode(NODE_LIST *list, uint8_t nodeId, L2_NODE_TYPE nodeType
|
||||
nodeEntry->nodeInfo.speed.z = 0;
|
||||
nodeEntry->nodeInfo.beamNo = 0;
|
||||
nodeEntry->ttlCnt = 0;
|
||||
list_rpush(list, node);
|
||||
clist_rpush(list, node);
|
||||
return nodeEntry;
|
||||
}
|
||||
|
||||
@@ -205,14 +205,14 @@ int32_t L2_DeleteNodeById(NODE_LIST *list, uint8_t nodeId)
|
||||
{
|
||||
ASSERT(list != NULL);
|
||||
util_entry.nodeInfo.nodeId = nodeId;
|
||||
list_node_t *node = list_find(list, &util_entry);
|
||||
clist_node_t *node = clist_find(list, &util_entry);
|
||||
if (node == NULL)
|
||||
{
|
||||
DBG_WARNING("Node [%d] in not in node list, skip deleting process.\n", nodeId);
|
||||
return SUCCESS;
|
||||
}
|
||||
DBG_INFO("Deleting node [%d].\n", nodeId);
|
||||
list_remove(list, node);
|
||||
clist_remove(list, node);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -490,14 +490,14 @@ int32_t L2_IterEditNode(NODE_LIST *list, const void *param, int32_t (*operation)
|
||||
{
|
||||
ASSERT(list != NULL);
|
||||
int32_t Status;
|
||||
list_node_t *node;
|
||||
list_iterator_t *iter = list_iterator_new(list, LIST_HEAD);
|
||||
clist_node_t *node;
|
||||
clist_iterator_t *iter = clist_iterator_new(list, LIST_HEAD);
|
||||
if (iter == NULL)
|
||||
{
|
||||
DBG_ERROR("Failed to initialize list iteration process.\n");
|
||||
return EALLOC;
|
||||
}
|
||||
while ((node = list_iterator_next(iter)))
|
||||
while ((node = clist_iterator_next(iter)))
|
||||
{
|
||||
Status = operation((NODE_ENTRY *)node->val, param);
|
||||
if (Status != SUCCESS)
|
||||
@@ -506,7 +506,7 @@ int32_t L2_IterEditNode(NODE_LIST *list, const void *param, int32_t (*operation)
|
||||
break;
|
||||
}
|
||||
}
|
||||
list_iterator_destroy(iter);
|
||||
clist_iterator_destroy(iter);
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -524,20 +524,20 @@ int32_t L2_IterEditNode(NODE_LIST *list, const void *param, int32_t (*operation)
|
||||
int32_t L2_IterDeleteNode(NODE_LIST *list, bool (*condition)(NODE_ENTRY *))
|
||||
{
|
||||
ASSERT(list != NULL);
|
||||
list_node_t *node;
|
||||
list_iterator_t *iter = list_iterator_new(list, LIST_HEAD);
|
||||
clist_node_t *node;
|
||||
clist_iterator_t *iter = clist_iterator_new(list, LIST_HEAD);
|
||||
if (iter == NULL)
|
||||
{
|
||||
DBG_ERROR("Failed to initialize list iteration process.\n");
|
||||
return EALLOC;
|
||||
}
|
||||
while ((node = list_iterator_next(iter)))
|
||||
while ((node = clist_iterator_next(iter)))
|
||||
{
|
||||
if (condition((NODE_ENTRY *)node->val) == false)
|
||||
{
|
||||
list_remove(list, node);
|
||||
clist_remove(list, node);
|
||||
}
|
||||
}
|
||||
list_iterator_destroy(iter);
|
||||
clist_iterator_destroy(iter);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "linklayer814_types.h"
|
||||
#include "geometry/coord.h"
|
||||
#include "../util/util.h"
|
||||
#include "../util/list.h"
|
||||
#include "../util/clist.h"
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
@@ -36,7 +36,7 @@ typedef struct NODE_LIST_ENTRY
|
||||
int32_t timeDevi;
|
||||
} NODE_ENTRY;
|
||||
|
||||
typedef list_t NODE_LIST;
|
||||
typedef clist_t NODE_LIST;
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "linklayer814.h"
|
||||
#include "linklayer814_types.h"
|
||||
#include "../error.h"
|
||||
#include "../util/list.h"
|
||||
#include "../util/clist.h"
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
/**************************** Type Definitions *******************************/
|
||||
/************************** Variable Definitions *****************************/
|
||||
@@ -80,7 +80,7 @@ int32_t L2_CreateSchedEventPool(L2_SCHD_POOL **schdPool)
|
||||
DBG_ERROR("Failed to allocated memory for schdPool.\n");
|
||||
return EALLOC;
|
||||
}
|
||||
(*schdPool)->schdList = list_new();
|
||||
(*schdPool)->schdList = clist_new();
|
||||
if ((*schdPool)->schdList == NULL)
|
||||
{
|
||||
DBG_ERROR("Failed to allocated memory for schdPool->schdList.\n");
|
||||
@@ -106,7 +106,7 @@ int32_t L2_CreateSchedEventPool(L2_SCHD_POOL **schdPool)
|
||||
void L2_ClearSchedEventPool(L2_SCHD_POOL *schdPool)
|
||||
{
|
||||
ASSERT(schdPool != NULL);
|
||||
list_clear(schdPool->schdList);
|
||||
clist_clear(schdPool->schdList);
|
||||
schdPool->envCnt = 0;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ void L2_DestroySchedEventPool(L2_SCHD_POOL *schdPool)
|
||||
{
|
||||
return;
|
||||
}
|
||||
list_destroy(schdPool->schdList);
|
||||
clist_destroy(schdPool->schdList);
|
||||
free(schdPool);
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ L2_SCHD_EVENT *L2_CreatNewSchdEvent(L2_SCHD_POOL *schdPool, L2_EVENT_TYPE event,
|
||||
DBG_ERROR("Failed to allocate schedule event.\n");
|
||||
return NULL;
|
||||
}
|
||||
list_node_t *node = list_node_new(schdEvent);
|
||||
clist_node_t *node = clist_node_new(schdEvent);
|
||||
if (node == NULL)
|
||||
{
|
||||
DBG_ERROR("Failed to allocate schedule event list node.\n");
|
||||
@@ -170,7 +170,7 @@ L2_SCHD_EVENT *L2_CreatNewSchdEvent(L2_SCHD_POOL *schdPool, L2_EVENT_TYPE event,
|
||||
schdEvent->isVolatile = isVolatile;
|
||||
schdEvent->schdSlot = L2_SLOTNO_NONE;
|
||||
schdEvent->schdFrame = L2_FRAMENO_NONE;
|
||||
list_rpush(schdPool->schdList, node);
|
||||
clist_rpush(schdPool->schdList, node);
|
||||
return schdEvent;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ L2_SCHD_EVENT *L2_GetEventById(L2_SCHD_POOL *schdPool, uint32_t id)
|
||||
{
|
||||
ASSERT(schdPool != NULL);
|
||||
util_schdevent.eventId = id;
|
||||
list_node_t *node = list_find(schdPool->schdList, &util_schdevent);
|
||||
clist_node_t *node = clist_find(schdPool->schdList, &util_schdevent);
|
||||
if (node != NULL)
|
||||
{
|
||||
DBG_WARNING("Event with id=%d, dose not exist.\n", id);
|
||||
@@ -214,13 +214,13 @@ int32_t L2_DeleteSchdEventById(L2_SCHD_POOL *schdPool, uint32_t id)
|
||||
{
|
||||
ASSERT(schdPool != NULL);
|
||||
util_schdevent.eventId = id;
|
||||
list_node_t *node = list_find(schdPool->schdList, &util_schdevent);
|
||||
clist_node_t *node = clist_find(schdPool->schdList, &util_schdevent);
|
||||
if (node != NULL)
|
||||
{
|
||||
DBG_ERROR("Event with id=%d, dose not exist.\n", id);
|
||||
return EIGNORE;
|
||||
}
|
||||
list_remove(schdPool->schdList, node);
|
||||
clist_remove(schdPool->schdList, node);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -343,16 +343,16 @@ int32_t L2_RescheduleEventAfter(L2_INST *instPtr, L2_SCHD_EVENT *schdEvent, uint
|
||||
void L2_EventPoolHandler(L2_INST *instPtr)
|
||||
{
|
||||
ASSERT(instPtr != NULL);
|
||||
list_node_t *node;
|
||||
clist_node_t *node;
|
||||
L2_SCHD_EVENT *event;
|
||||
L2_SCHD_POOL *pool = instPtr->schdEventPool;
|
||||
list_iterator_t *iter = list_iterator_new(pool->schdList, LIST_HEAD);
|
||||
clist_iterator_t *iter = clist_iterator_new(pool->schdList, LIST_HEAD);
|
||||
if (iter == NULL)
|
||||
{
|
||||
DBG_ERROR("Failed to initialize schedule event pool iteration.\n");
|
||||
return;
|
||||
}
|
||||
while ((node = list_iterator_next(iter)))
|
||||
while ((node = clist_iterator_next(iter)))
|
||||
{
|
||||
event = (L2_SCHD_EVENT *)node->val;
|
||||
if (L2_isEventScheduled(event))
|
||||
@@ -364,7 +364,7 @@ void L2_EventPoolHandler(L2_INST *instPtr)
|
||||
if (event->isVolatile == true)
|
||||
{
|
||||
DBG_INFO("Deleting scheduled event [%d], since it is volatile.\n", event->eventId);
|
||||
list_remove(pool->schdList, node);
|
||||
clist_remove(pool->schdList, node);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -373,7 +373,7 @@ void L2_EventPoolHandler(L2_INST *instPtr)
|
||||
}
|
||||
}
|
||||
}
|
||||
list_iterator_destroy(iter);
|
||||
clist_iterator_destroy(iter);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "linklayer814_types.h"
|
||||
#include "../error.h"
|
||||
#include "../util/list.h"
|
||||
#include "../util/clist.h"
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
/**************************** Type Definitions *******************************/
|
||||
/** @name L2 event
|
||||
@@ -43,7 +43,7 @@ typedef struct
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
list_t *schdList;
|
||||
clist_t *schdList;
|
||||
uint32_t envCnt;
|
||||
} L2_SCHD_POOL;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//
|
||||
|
||||
#include <stdint.h>
|
||||
#include "list.h"
|
||||
#include "clist.h"
|
||||
|
||||
/*
|
||||
* Allocates a new clist_node_t. NULL on failure.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
//
|
||||
// list.h
|
||||
// clist.h
|
||||
//
|
||||
// Copyright (c) 2010 TJ Holowaychuk <[email protected]>
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user