]> granicus.if.org Git - graphviz/commitdiff
sparse SingleLinkedList_new: use cgraph wrapper for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 18 Nov 2022 01:14:41 +0000 (17:14 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 31 Dec 2022 16:33:58 +0000 (08:33 -0800)
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.

lib/sparse/LinkedList.c

index aa9a2c18b0de60b4f65368aff8b780e6e8d04cdd..2d1a6b45fc33b0e3df83dfb4cd5c60602c396586 100644 (file)
@@ -8,14 +8,13 @@
  * Contributors: Details at https://graphviz.org
  *************************************************************************/
 
+#include <cgraph/alloc.h>
 #include <sparse/LinkedList.h>
 #include <common/memory.h>
 
 SingleLinkedList SingleLinkedList_new(void *data){
-  SingleLinkedList head;
-  head = GNEW(struct SingleLinkedList_struct);
+  SingleLinkedList head = gv_alloc(sizeof(struct SingleLinkedList_struct));
   head->data = data;
-  head->next = NULL;
   return head;
 }