]> granicus.if.org Git - graphviz/commitdiff
smyrna new_viewport_camera: use cgraph wrapper for allocation
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 2 Sep 2022 01:44:28 +0000 (18:44 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 2 Sep 2022 01:45:07 +0000 (18:45 -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/viewportcamera.c

index c5b818da29f56e991b6379051ce2775b827c47de..d4ff9a9bca35c7e3f0cde340a2a9f239e1aa0159 100644 (file)
@@ -12,7 +12,6 @@
 #include "viewportcamera.h"
 #include "gui.h"
 #include <math.h>
-#include <common/memory.h>
 #include <glcomp/glcompbutton.h>
 #include <glcomp/glcomplabel.h>
 #include <glcomp/glcomppanel.h>
@@ -25,9 +24,10 @@ static viewport_camera *new_viewport_camera(ViewInfo * view)
 
 static viewport_camera *add_camera_to_viewport(ViewInfo * view)
 {
+    view->cameras = gv_recalloc(view->cameras, view->camera_count,
+                                view->camera_count + 1,
+                                sizeof(viewport_camera*));
     view->camera_count++;
-    view->cameras =
-       RALLOC(view->camera_count, view->cameras, viewport_camera *);
     view->cameras[view->camera_count - 1] = new_viewport_camera(view);
     view->active_camera = view->camera_count - 1;
     return view->cameras[view->camera_count - 1];