Ver código fonte

remove indexedlist

Julius Pfrommer 10 anos atrás
pai
commit
4827374d7f
4 arquivos alterados com 0 adições e 171 exclusões
  1. 0 1
      CMakeLists.txt
  2. 0 126
      src/util/ua_indexedList.c
  3. 0 40
      src/util/ua_indexedList.h
  4. 0 4
      tests/CMakeLists.txt

+ 0 - 1
CMakeLists.txt

@@ -19,7 +19,6 @@ set(lib_sources src/ua_types.c
                 src/ua_session.c
                 src/util/ua_util.c
                 src/util/ua_list.c
-                src/util/ua_indexedList.c
                 src/util/ua_base64.c
                 src/server/ua_namespace.c
                 src/server/ua_server.c

+ 0 - 126
src/util/ua_indexedList.c

@@ -1,126 +0,0 @@
-#include "ua_indexedList.h"
-#include "ua_util.h"
-
-void UA_indexedList_defaultFreer(void* payload){
-	UA_list_defaultFreer(payload);
-}
-
-UA_Int32 UA_indexedList_init(UA_indexedList_List* list){
-	if(list==UA_NULL)return UA_ERROR;
-	return UA_list_init((UA_list_List*)list);
-}
-
-UA_Int32 UA_indexedList_destroy(UA_indexedList_List* list, UA_indexedList_PayloadVisitor visitor) {
-	UA_list_Element* current = UA_NULL;
-	if(list==UA_NULL)
-		return UA_ERROR;
-	current=list->first;
-	while(current){
-		UA_list_Element* next = current->next;
-		UA_indexedList_Element* elem = (UA_indexedList_Element*)current->payload;
-		if(visitor){
-			(*visitor)(elem->payload);
-		}
-		if(elem){
-			UA_free(elem);
-		}
-		UA_free(current);
-		current = next;
-	}
-	UA_list_init(list);
-	return UA_NO_ERROR;
-}
-
-UA_Int32 UA_indexedList_initElement(UA_indexedList_Element* elem){
-	if(elem==UA_NULL)return UA_ERROR;
-	elem->father = UA_NULL;
-	elem->index = -1;
-	elem->payload = UA_NULL;
-	return UA_NO_ERROR;
-}
-
-UA_Int32 UA_indexedList_addValue(UA_indexedList_List* list, UA_Int32 index, void* payload){
-	UA_list_Element* dllElem;
-	if(list==UA_NULL)
-		return UA_ERROR;
-	UA_alloc((void**)&dllElem, sizeof(UA_list_Element));
-	UA_list_initElement(dllElem);
-	UA_indexedList_Element* iilElem;
-	UA_alloc((void**)&iilElem, sizeof(UA_indexedList_Element));
-	UA_indexedList_initElement(iilElem);
-	iilElem->index = index;
-	iilElem->father = dllElem;
-	iilElem->payload = payload;
-	dllElem->payload = iilElem;
-	return UA_list_addElementToBack((UA_list_List*)list, dllElem);
-}
-
-UA_Int32 UA_indexedList_addValueToFront(UA_indexedList_List* list, UA_Int32 index, void* payload) {
-	UA_list_Element* dllElem;
-	UA_indexedList_Element* iilElem;
-	if(list==UA_NULL)
-		return UA_ERROR;
-	UA_alloc((void**)&dllElem, sizeof(UA_list_Element));
-	UA_list_initElement(dllElem);
-	UA_alloc((void**)&iilElem, sizeof(UA_indexedList_Element));
-	UA_indexedList_initElement(iilElem);
-	iilElem->index = index;
-	iilElem->father = dllElem;
-	iilElem->payload = payload;
-	dllElem->payload = iilElem;
-	return UA_list_addElementToFront((UA_list_List*)list, dllElem);
-}
-
-UA_indexedList_Element* UA_indexedList_find(UA_indexedList_List* const list, UA_Int32 index) {
-	UA_list_Element* current;
-	if(list==UA_NULL)
-		return UA_NULL;
-	current = list->first;
-	while(current){
-		if(current->payload){
-			UA_indexedList_Element* elem = (UA_indexedList_Element*)current->payload;
-			if(elem->index == index){
-				return elem;
-			}
-		}
-		current=current->next;
-	}
-	return UA_NULL;
-}
-
-void* UA_indexedList_findValue(UA_indexedList_List* const list, UA_Int32 index) {
-	UA_indexedList_Element* iilElem;
-	if(list==UA_NULL)return UA_NULL;
-	iilElem = UA_indexedList_find(list, index);
-	if(iilElem){
-		return iilElem->payload;
-	}
-	return UA_NULL;
-}
-
-UA_Int32 UA_indexedList_iterateValues(UA_indexedList_List* const list, UA_indexedList_PayloadVisitor visitor) {
-	UA_list_Element* current;
-	if(list==UA_NULL)
-		return UA_ERROR;
-	current = list->first;
-	while(current){
-		if(current->payload){
-			UA_indexedList_Element* elem = (UA_indexedList_Element*)current->payload;
-			if(visitor){
-				(*visitor)(elem->payload);
-			}
-		}
-		current=current->next;
-	}
-	return UA_NO_ERROR;
-}
-
-UA_Int32 UA_indexedList_removeElement(UA_indexedList_List* list, UA_indexedList_Element* elem, UA_indexedList_PayloadVisitor visitor){
-	if(list==UA_NULL || elem==UA_NULL)return UA_ERROR;
-	if(visitor){
-		(*visitor)(elem->payload);
-	}
-	UA_list_Element* father = elem->father;
-	UA_free(elem);
-	return UA_list_removeElement(father, UA_NULL);
-}

+ 0 - 40
src/util/ua_indexedList.h

@@ -1,40 +0,0 @@
-#ifndef UA_INDEXEDLIST_H_
-#define UA_INDEXEDLIST_H_
-
-#include "ua_types.h"
-/* UA_indexedList reuses many types of UA_list */
-#include "ua_list.h"
-
-/*
- * Integer Indexed List
- */
-typedef struct UA_indexedList_Element {
-	struct UA_list_Element* father;
-	UA_Int32 index;
-	void* payload;
-}UA_indexedList_Element;
-
-typedef UA_list_List UA_indexedList_List;
-typedef UA_list_PayloadVisitor UA_indexedList_PayloadVisitor;
-
-void UA_indexedList_defaultFreer(void* payload);
-
-UA_Int32 UA_indexedList_init(UA_indexedList_List* list);
-
-UA_Int32 UA_indexedList_destroy(UA_indexedList_List* list, UA_indexedList_PayloadVisitor visitor);
-
-UA_Int32 UA_indexedList_initElement(UA_indexedList_Element* elem);
-
-UA_Int32 UA_indexedList_addValue(UA_indexedList_List* list, UA_Int32 index, void* payload);
-
-UA_Int32 UA_indexedList_addValueToFront(UA_indexedList_List* list, UA_Int32 index, void* payload);
-
-UA_indexedList_Element* UA_indexedList_find(UA_indexedList_List* const list, UA_Int32 index);
-
-void* UA_indexedList_findValue(UA_indexedList_List* const list, UA_Int32 index);
-
-UA_Int32 UA_indexedList_iterateValues(UA_indexedList_List* const list, UA_indexedList_PayloadVisitor visitor);
-
-UA_Int32 UA_indexedList_removeElement(UA_indexedList_List* list, UA_indexedList_Element* elem, UA_indexedList_PayloadVisitor visitor);
-
-#endif /* UA_INDEXEDLIST_H_ */

+ 0 - 4
tests/CMakeLists.txt

@@ -25,10 +25,6 @@ add_executable(check_list check_list.c)
 target_link_libraries(check_list ${LIBS})
 add_test(list ${CMAKE_CURRENT_BINARY_DIR}/check_list)
 
-add_executable(check_indexedList check_indexedList.c)
-target_link_libraries(check_indexedList ${LIBS})
-add_test(indexedList ${CMAKE_CURRENT_BINARY_DIR}/check_indexedList)
-
 add_executable(check_base64 check_base64.c)
 target_link_libraries(check_base64 ${LIBS})
 add_test(base64 ${CMAKE_CURRENT_BINARY_DIR}/check_base64)