#include "object.h" /* Increment logic for every object in the list */ void logic(Object* obj) { while (obj = obj->next) obj->logic(obj); } /* Render every object in the list */ void render(Object* obj) { while (obj = obj->next) obj->render(obj); } /* Create the head object */ Object* make_object_list(void) { Object* obj; obj = malloc(sizeof(Object)); obj->next = NULL; } /* Deallocate the whole object list */ void dealloc_object_list(Object* obj) { Object* next; for (; obj != NULL; obj = next) { obj->free(obj); free(obj->data); next = obj->next; free(obj); } } /* Place obj after pos */ void append_obj(Object* pos, Object* obj) { obj->next = pos->next; pos->next = obj; } /* Remove obj from list */ void remove_obj(Object* list, Object* obj) { /* Locate the node before obj */ while (list != NULL && list->next != obj) list = list->next; if (list == NULL) return; list->next = obj->next; }