]> granicus.if.org Git - graphviz/commitdiff
smyrna load_attributes: use cgraph wrapper for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 2 Sep 2022 01:57:58 +0000 (18:57 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 2 Sep 2022 02:03:30 +0000 (19:03 -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/gui/gui.c

index c82863f9f89671aa7abde8a6b9c4a5d7104407ca..346f0cd6790ffaa59aa371128e1ce3617f3d0a16 100644 (file)
@@ -15,8 +15,8 @@
 #include <gdk/gdkkeysyms.h>
 #include <gdk/gdk.h>
 #include "viewport.h"
+#include <cgraph/alloc.h>
 #include <cgraph/strview.h>
-#include <common/memory.h>
 
 GladeXML *xml;                 //global libglade vars
 GtkWidget *gladewidget;
@@ -90,9 +90,10 @@ void load_attributes(void)
                    }
                    break;
                default:
-                   attr[attrcount].ComboValues =
-                       RALLOC(attr[attrcount].ComboValuesCount,
-                              attr[attrcount].ComboValues, char *);
+                   attr[attrcount].ComboValues = gv_recalloc(attr[attrcount].ComboValues,
+                                                             attr[attrcount].ComboValuesCount - 1,
+                                                             attr[attrcount].ComboValuesCount,
+                                                             sizeof(char*));
                    attr[attrcount].ComboValues[attr[attrcount].
                                                ComboValuesCount] = strview_str(ss);
                    attr[attrcount].ComboValuesCount++;