]> granicus.if.org Git - graphviz/commitdiff
glcomp glCompButtonNew: use cgraph wrapper for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 17 Sep 2022 00:18:25 +0000 (17:18 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 21 Sep 2022 00:17:10 +0000 (17:17 -0700)
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/glcomp/glcompbutton.c

index 8a22a0d7d00e5c69256f1b52983d110b8077d52e..4bfa2a9685c0b6be39f7285330eff1a2e2e8beac 100644 (file)
@@ -8,13 +8,13 @@
  * Contributors: Details at https://graphviz.org
  *************************************************************************/
 
+#include <cgraph/alloc.h>
 #include <glcomp/glcompbutton.h>
 #include <glcomp/glcomplabel.h>
 #include <glcomp/glcompimage.h>
 #include <glcomp/glcompfont.h>
 #include <glcomp/glutils.h>
 #include <glcomp/glcompset.h>
-#include <common/memory.h>
 #include <stddef.h>
 #include <string.h>
 #include <GL/glut.h>
@@ -23,8 +23,7 @@
 glCompButton *glCompButtonNew(glCompObj * par, GLfloat x, GLfloat y,
                              GLfloat w, GLfloat h, char *caption)
 {
-    glCompButton *p;
-    p = NEW(glCompButton);
+    glCompButton *p = gv_alloc(sizeof(glCompButton));
     glCompInitCommon((glCompObj *) p, par, x, y);
     p->objType = glButtonObj;
     /*customize button color */