Feature/life safety zone object example (#595)
* Added Keylist_Data_Free function to free all nodes and data in a list * Added basic Life Safety Zone object type in the apps/server example, with unit testing.
This commit is contained in:
@@ -301,6 +301,20 @@ void *Keylist_Data_Delete(OS_Keylist list, KEY key)
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pops every node data, removing it from the list,
|
||||
* and frees the data memory
|
||||
* @param list Pointer to the list
|
||||
* */
|
||||
void Keylist_Data_Free(OS_Keylist list)
|
||||
{
|
||||
void *data;
|
||||
while (Keylist_Count(list) > 0) {
|
||||
data = Keylist_Data_Pop(list);
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the data from last node, and
|
||||
* removes it from the list.
|
||||
*
|
||||
@@ -411,7 +425,7 @@ KEY Keylist_Key(OS_Keylist list, int index)
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Determine if there is a node key at the given index.
|
||||
*
|
||||
* @param list Pointer to the list
|
||||
|
||||
@@ -87,6 +87,11 @@ extern "C" {
|
||||
void *Keylist_Data_Pop(
|
||||
OS_Keylist list);
|
||||
|
||||
/* removes and frees all data from the list */
|
||||
BACNET_STACK_EXPORT
|
||||
void Keylist_Data_Free(
|
||||
OS_Keylist list);
|
||||
|
||||
/* returns the data from the node specified by key */
|
||||
BACNET_STACK_EXPORT
|
||||
void *Keylist_Data(
|
||||
@@ -115,8 +120,8 @@ extern "C" {
|
||||
/* returns the node key specified by the index */
|
||||
BACNET_STACK_EXPORT
|
||||
bool Keylist_Index_Key(
|
||||
OS_Keylist list,
|
||||
int index,
|
||||
OS_Keylist list,
|
||||
int index,
|
||||
KEY *pKey);
|
||||
|
||||
/* returns the next empty key from the list */
|
||||
|
||||
Reference in New Issue
Block a user