From ba7551b9144044dd2cf69080ec96c0a079f3ce8c Mon Sep 17 00:00:00 2001
From: Mathieu L Bouchard <matju@artengine.ca>
Date: Wed, 20 Aug 2014 15:17:47 -0400
Subject: [PATCH] remove useless glist_free and glist_cleanup functions

---
 pd/src/g_canvas.c | 13 +++++--------
 pd/src/g_canvas.h |  3 ---
 pd/src/g_graph.c  | 25 -------------------------
 3 files changed, 5 insertions(+), 36 deletions(-)

diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c
index 06ed032cd..2a6c00bb4 100644
--- a/pd/src/g_canvas.c
+++ b/pd/src/g_canvas.c
@@ -870,7 +870,6 @@ extern void canvas_group_free(t_pd *x);
 
 void canvas_free(t_canvas *x)
 {
-    //fprintf(stderr,"canvas_free %lx\n", x);
     t_gobj *y;
     int dspstate = canvas_suspend_dsp();
 
@@ -890,12 +889,8 @@ void canvas_free(t_canvas *x)
      if (x->gl_editor)
          canvas_destroy_editor(x);   /* bug workaround; should already be gone*/
 
-    /*
-    if (x-> x_handle)
-        scalehandle_free(x->x_handle);
-    if (x-> x_mhandle)
-        scalehandle_free(x->x_mhandle);
-    */
+    if (x-> x_handle) scalehandle_free( x->x_handle);
+    if (x->x_mhandle) scalehandle_free(x->x_mhandle);
     
     canvas_unbind(x);
     if (x->gl_env)
@@ -904,7 +899,9 @@ void canvas_free(t_canvas *x)
         freebytes(x->gl_env, sizeof(*x->gl_env));
     }
     canvas_resume_dsp(dspstate);
-    glist_cleanup(x);
+    freebytes(x->gl_xlabel, x->gl_nxlabels * sizeof(*(x->gl_xlabel)));
+    freebytes(x->gl_ylabel, x->gl_nylabels * sizeof(*(x->gl_ylabel)));
+    gstub_cutoff(x->gl_stub);
     gfxstub_deleteforkey(x);        /* probably unnecessary */
     if (!x->gl_owner)
         canvas_takeofflist(x);
diff --git a/pd/src/g_canvas.h b/pd/src/g_canvas.h
index 473d89594..6dde20607 100644
--- a/pd/src/g_canvas.h
+++ b/pd/src/g_canvas.h
@@ -428,9 +428,6 @@ EXTERN int gobj_shouldvis(t_gobj *x, struct _glist *glist);
 EXTERN t_glist *glist_new( void);
 EXTERN void glist_init(t_glist *x);
 EXTERN void glist_add(t_glist *x, t_gobj *g);
-EXTERN void glist_cleanup(t_glist *x);
-EXTERN void glist_free(t_glist *x);
-
 EXTERN void glist_clear(t_glist *x);
 EXTERN t_canvas *glist_getcanvas(t_glist *x);
 EXTERN int glist_isselected(t_glist *x, t_gobj *y);
diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c
index 14793da4b..cadaadb03 100644
--- a/pd/src/g_graph.c
+++ b/pd/src/g_graph.c
@@ -410,31 +410,6 @@ void glist_sort(t_glist *x)
         x->gl_list = glist_dosort(x, x->gl_list, nitems);
 }
 
-void glist_cleanup(t_glist *x)
-{
-    //fprintf(stderr,"glist_cleanup =============\n");
-    freebytes(x->gl_xlabel, x->gl_nxlabels * sizeof(*(x->gl_xlabel)));
-    freebytes(x->gl_ylabel, x->gl_nylabels * sizeof(*(x->gl_ylabel)));
-    if (x->x_handle)
-    {    
-        pd_unbind((t_pd *)x->x_handle, ((t_scalehandle *)x->x_handle)->h_bindsym);
-        pd_free((t_pd *)x->x_handle);
-    }
-    if (x->x_mhandle)
-    {
-        pd_unbind((t_pd *)x->x_mhandle, ((t_scalehandle *)x->x_mhandle)->h_bindsym);
-        pd_free((t_pd *)x->x_mhandle);
-    }
-    gstub_cutoff(x->gl_stub);
-}
-
-void glist_free(t_glist *x)
-{
-    //fprintf(stderr,"glist_free =============\n");
-    glist_cleanup(x);
-    freebytes(x, sizeof(*x));
-}
-
 /* --------------- inlets and outlets  ----------- */
 
 
-- 
GitLab