From: Matthew Fernandez Date: Fri, 18 Nov 2022 01:14:41 +0000 (-0800) Subject: sparse DoubleLinkedList_new: use cgraph wrapper for allocation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ee4812c0fe6d4dcaed85d6288d2e4abab55d861;p=graphviz sparse DoubleLinkedList_new: use cgraph wrapper for allocation The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h wrappers except (1) they are header-only and (2) they live in a directory (cgraph) that is at the root of the dependency tree. The long term plan is to replace all use of lib/common/memory.h with lib/cgraph/alloc.h. --- diff --git a/lib/sparse/LinkedList.c b/lib/sparse/LinkedList.c index 5bada8216..bf7389dbb 100644 --- a/lib/sparse/LinkedList.c +++ b/lib/sparse/LinkedList.c @@ -10,7 +10,6 @@ #include #include -#include SingleLinkedList SingleLinkedList_new(void *data){ SingleLinkedList head = gv_alloc(sizeof(struct SingleLinkedList_struct)); @@ -70,11 +69,8 @@ void SingleLinkedList_print(SingleLinkedList head, void (*linkedlist_print)(void DoubleLinkedList DoubleLinkedList_new(void *data){ - DoubleLinkedList head; - head = GNEW(struct DoubleLinkedList_struct); + DoubleLinkedList head = gv_alloc(sizeof(struct DoubleLinkedList_struct)); head->data = data; - head->next = NULL; - head->prev = NULL; return head; }