forked from gatsby/datalink_repo
adapted to new list api.
This commit is contained in:
@@ -45,11 +45,23 @@ static void entry_free(void* val){
|
||||
/**
|
||||
* @brief helper function to match node entries by nodeIds
|
||||
*/
|
||||
static bool entry_match(void* a, void* b){
|
||||
static int8_t entry_compare(void* a, void* b){
|
||||
ASSERT(a != NULL);
|
||||
ASSERT(b != NULL);
|
||||
return (((NODE_ENTRY*)a)->nodeInfo.nodeId
|
||||
== ((NODE_ENTRY*)b)->nodeInfo.nodeId);
|
||||
register uint8_t idA, idB;
|
||||
idA = ((NODE_ENTRY*)a)->nodeInfo.nodeId;
|
||||
idB = ((NODE_ENTRY*)b)->nodeInfo.nodeId;
|
||||
if (idA == idB)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if(idA < idB) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
@@ -67,7 +79,7 @@ int32_t L2_NodeList_Init(NODE_LIST **list) {
|
||||
return ENOMEM;
|
||||
}
|
||||
(*list)->free = entry_free;
|
||||
(*list)->match = entry_match;
|
||||
(*list)->compare = entry_compare;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -98,7 +110,7 @@ void L2_NodeList_Destroy(NODE_LIST *list){
|
||||
}
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* @brief Get node entry frome node list base on node id.
|
||||
* @brief Get node entry from node list base on node id.
|
||||
*
|
||||
* @param list
|
||||
* @param nodeId
|
||||
@@ -334,7 +346,7 @@ int32_t L2_GetNodeSpeed(NODE_LIST *list, uint8_t nodeId, COORD *speed) {
|
||||
*
|
||||
* @param list
|
||||
* @param nodeId
|
||||
* @param defl
|
||||
* @param devi
|
||||
*
|
||||
* @return SUCCESS update successfully.
|
||||
* FAILURE Node not exist.
|
||||
|
||||
@@ -40,11 +40,21 @@ static void schdevent_free(void* val){
|
||||
/**
|
||||
* @brief helper function to match events by ids.
|
||||
*/
|
||||
static bool schdevent_match(void* a, void* b){
|
||||
static int8_t schdevent_compare(void* a, void* b){
|
||||
ASSERT(a == NULL);
|
||||
ASSERT(b != NULL);
|
||||
return (((L2_SCHD_EVENT*)a)->eventId
|
||||
== ((L2_SCHD_EVENT*)b)->eventId);
|
||||
register uint32_t idA, idB;
|
||||
idA = ((L2_SCHD_EVENT*)a)->eventId;
|
||||
idB = ((L2_SCHD_EVENT*)b)->eventId;
|
||||
if( idA== idB) {
|
||||
return 0;
|
||||
}
|
||||
else if (idA < idB) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -69,7 +79,7 @@ int32_t L2_CreateSchedEventPool(L2_SCHD_POOL** schdPool) {
|
||||
return EALLOC;
|
||||
}
|
||||
(*schdPool)->schdList->free = schdevent_free;
|
||||
(*schdPool)->schdList->match = schdevent_match;
|
||||
(*schdPool)->schdList->compare = schdevent_compare;
|
||||
(*schdPool)->envCnt = 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user