]> granicus.if.org Git - graphviz/commitdiff
smyrna main: use cgraph wrapper for allocations
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 2 Sep 2022 01:54:37 +0000 (18:54 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 2 Sep 2022 01:54:37 +0000 (18:54 -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.

cmd/smyrna/main.c

index be908ba133282ad9716d756a060699f619b237fb..1196c3a0dc10a5d12b769556618761445de5ae24 100644 (file)
@@ -26,7 +26,6 @@
 #include "gltemplate.h"
 #include <cgraph/alloc.h>
 #include <cgraph/exit.h>
-#include <common/memory.h>
 #include "gvprpipe.h"
 #include "frmobjectui.h"
 #ifdef ENABLE_NLS
@@ -212,7 +211,7 @@ int main(int argc, char *argv[])
        }
        *s = '\0';
 
-       smyrnaDir = N_NEW(strlen(line)+sizeof(SMYRNA), char);
+       smyrnaDir = gv_calloc(strlen(line) + sizeof(SMYRNA), sizeof(char));
        strcpy (smyrnaDir, line);
        strcat(smyrnaDir, SMYRNA);
 #else
@@ -236,7 +235,7 @@ int main(int argc, char *argv[])
     bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
     textdomain(GETTEXT_PACKAGE);
 #endif
-    view = NEW(ViewInfo);
+    view = gv_alloc(sizeof(ViewInfo));
     init_viewport(view);
     view->initFileName = parseArgs(argc, argv, view);
     if(view->initFileName)