mirror of
				https://github.com/theoludwig/libcproject.git
				synced 2025-05-21 23:21:15 +02:00 
			
		
		
		
	feat: add array_list_free
This commit is contained in:
		| @@ -37,3 +37,8 @@ void* array_list_get(struct array_list* list, size_t index) { | ||||
|   } | ||||
|   return list->data[index]; | ||||
| } | ||||
|  | ||||
| void array_list_free(struct array_list* list) { | ||||
|   free(list->data); | ||||
|   free(list); | ||||
| } | ||||
|   | ||||
| @@ -42,4 +42,10 @@ void array_list_remove(struct array_list* list, size_t index); | ||||
|  */ | ||||
| void* array_list_get(struct array_list* list, size_t index); | ||||
|  | ||||
| /** | ||||
|  * @brief Frees the array list. | ||||
|  * @since v2.1.0 | ||||
|  */ | ||||
| void array_list_free(struct array_list* list); | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -32,4 +32,6 @@ void array_list_test() { | ||||
|   array_list_remove(list, 100); | ||||
|   assert(list->size == 105); | ||||
|   assert(array_list_get(list, 100) == (void *)95); | ||||
|  | ||||
|   array_list_free(list); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user