BarryServer : Git

All the code for all my projects
// BarryServer : Git / libBLOC / commit / c5a8d166e141bc66615bbf6d3f16e6c1ab6accf6 / list

// Related

libBLOC

Barry Adding object metadata functions c5a8d16 (2 years, 11 months ago)
diff --git a/list/list.c b/list/list.c
index 888ff12..c5ff224 100644
--- a/list/list.c
+++ b/list/list.c
@@ -19,7 +19,7 @@
 
 /*
  * This file implements object Lists.  Objects can be a part of multiple lists
- * that can be managed automatically by the library.  This prevents subsystems
+ * that can be managed automatically by the library.  This prevents programs
  * from having to implement their own object lists for sub-objects. Lists may
  * be created with a specific Object Type, and will not accept objects that are
  * not of that type.  If a list does not have a type, it will accept objects of
@@ -29,7 +29,6 @@
 #include <BLOC/object.h>
 #include <BLOC/list.h>
 #include "../assert.h"
-#include "../object.h"
 #include "list.h"
 
 static void _list_new(void *);
diff --git a/list/list_add.c b/list/list_add.c
index 276a158..ad5ddec 100644
--- a/list/list_add.c
+++ b/list/list_add.c
@@ -20,7 +20,6 @@
 #include <BLOC/object.h>
 #include <BLOC/list.h>
 #include "../assert.h"
-#include "../object.h"
 #include "list.h"
 
 /* Add an object to a list */
@@ -29,9 +28,8 @@ list_add(List *list, void *obj)
 {
 	ASSERT(list);
 	ASSERT(obj);
-	struct ObjectHeader *header = object_header(obj);
-	ASSERT(header->magic == OBJECT_MAGIC);
-	if (list->type && list->type != header->type)
+	ASSERT(obj_verify(obj));
+	if (list->type && list->type != obj_type(obj))
 		return;
 
 	struct IterableEntry *entry;
diff --git a/list/list_remove.c b/list/list_remove.c
index 767fb09..8aeac63 100644
--- a/list/list_remove.c
+++ b/list/list_remove.c
@@ -20,7 +20,6 @@
 #include <BLOC/object.h>
 #include <BLOC/list.h>
 #include "../assert.h"
-#include "../object.h"
 #include "list.h"
 
 /* Remove an object from a list */
@@ -29,11 +28,10 @@ list_remove(List *list, void *obj)
 {
 	ASSERT(list);
 	ASSERT(obj);
-	struct ObjectHeader *header = object_header(obj);
-	ASSERT(header->magic == OBJECT_MAGIC);
+	ASSERT(obj_verify(obj));
 	if (!list->header.start)
 		return;
-	if (list->type && list->type != header->type)
+	if (list->type && list->type != obj_type(obj))
 		return;
 	obj_lock(list);