summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2018-09-02 13:50:59 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2018-09-02 13:50:59 +0300
commit05fcc25f2c6224af6db0a858f6e33dbde79d3813 (patch)
tree2756af75c7916ba6d26b03bea53d0f98a1ef4c49
parent42caba8c77b5e316ab166714c35fe180233f1011 (diff)
downloadmetacity-05fcc25f2c6224af6db0a858f6e33dbde79d3813.tar.gz
boxes: remove meta_rectangle_free_list_and_elements
-rw-r--r--src/core/boxes.c11
-rw-r--r--src/core/testboxes.c92
-rw-r--r--src/core/workspace.c16
-rw-r--r--src/include/boxes.h9
4 files changed, 55 insertions, 73 deletions
diff --git a/src/core/boxes.c b/src/core/boxes.c
index 89408374..6d156d6d 100644
--- a/src/core/boxes.c
+++ b/src/core/boxes.c
@@ -761,15 +761,6 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect,
} /* end loop over struts */
} /* end meta_rectangle_expand_to_avoiding_struts */
-void
-meta_rectangle_free_list_and_elements (GList *filled_list)
-{
- g_list_foreach (filled_list,
- (void (*)(gpointer,gpointer))&g_free, /* ew, for ugly */
- NULL);
- g_list_free (filled_list);
-}
-
gboolean
meta_rectangle_could_fit_in_region (const GList *spanning_rects,
const MetaRectangle *rect)
@@ -1793,7 +1784,7 @@ meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect,
ret = g_list_sort (ret, meta_rectangle_edge_cmp);
/* Free the fixed struts list */
- meta_rectangle_free_list_and_elements (fixed_strut_rects);
+ g_list_free_full (fixed_strut_rects, g_free);
return ret;
}
diff --git a/src/core/testboxes.c b/src/core/testboxes.c
index 4558c1d2..f1ae214e 100644
--- a/src/core/testboxes.c
+++ b/src/core/testboxes.c
@@ -364,7 +364,7 @@ get_monitor_edges (int which_monitor_set,
ret = meta_rectangle_find_nonintersected_monitor_edges (&screenrect, xins, struts);
free_strut_list (struts);
- meta_rectangle_free_list_and_elements (xins);
+ g_list_free_full (xins, g_free);
return ret;
}
@@ -605,8 +605,8 @@ test_regions_okay (void)
tmp = NULL;
tmp = g_list_prepend (tmp, new_meta_rect (0, 0, 1600, 1200));
verify_lists_are_equal (region, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (region);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (region, g_free);
/*************************************************************/
/* Make sure test region 1 has the right spanning rectangles */
@@ -616,8 +616,8 @@ test_regions_okay (void)
tmp = g_list_prepend (tmp, new_meta_rect (0, 20, 400, 1180));
tmp = g_list_prepend (tmp, new_meta_rect (0, 20, 1600, 1140));
verify_lists_are_equal (region, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (region);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (region, g_free);
/*************************************************************/
/* Make sure test region 2 has the right spanning rectangles */
@@ -630,8 +630,8 @@ test_regions_okay (void)
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 800, 1130));
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 1600, 1080));
verify_lists_are_equal (region, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (region);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (region, g_free);
/*************************************************************/
/* Make sure test region 3 has the right spanning rectangles */
@@ -656,8 +656,8 @@ test_regions_okay (void)
printf ("%s vs. %s\n", region_list, tmp_list);
#endif
verify_lists_are_equal (region, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (region);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (region, g_free);
/*************************************************************/
/* Make sure test region 4 has the right spanning rectangles */
@@ -666,8 +666,8 @@ test_regions_okay (void)
tmp = NULL;
tmp = g_list_prepend (tmp, new_meta_rect ( 800, 20, 800, 1180));
verify_lists_are_equal (region, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (region);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (region, g_free);
/*************************************************************/
/* Make sure test region 5 has the right spanning rectangles */
@@ -699,7 +699,7 @@ test_region_fitting (void)
g_assert (meta_rectangle_contained_in_region (region, &rect) == FALSE ||
meta_rectangle_could_fit_in_region (region, &rect) == TRUE);
}
- meta_rectangle_free_list_and_elements (region);
+ g_list_free_full (region, g_free);
/* Do some manual tests too */
region = get_screen_region (1);
@@ -716,14 +716,14 @@ test_region_fitting (void)
g_assert (meta_rectangle_could_fit_in_region (region, &rect));
g_assert (!meta_rectangle_contained_in_region (region, &rect));
- meta_rectangle_free_list_and_elements (region);
+ g_list_free_full (region, g_free);
region = get_screen_region (2);
rect = meta_rect (1000, 50, 600, 1100);
g_assert (meta_rectangle_could_fit_in_region (region, &rect));
g_assert (!meta_rectangle_contained_in_region (region, &rect));
- meta_rectangle_free_list_and_elements (region);
+ g_list_free_full (region, g_free);
printf ("%s passed.\n", G_STRFUNC);
}
@@ -753,7 +753,7 @@ test_clamping_to_region (void)
g_assert (meta_rectangle_could_fit_in_region (region, &rect) == TRUE);
g_assert (rect.x == temp.x && rect.y == temp.y);
}
- meta_rectangle_free_list_and_elements (region);
+ g_list_free_full (region, g_free);
/* Do some manual tests too */
region = get_screen_region (1);
@@ -819,7 +819,7 @@ test_clamping_to_region (void)
&min_size);
g_assert (rect.width == 100 && rect.height == 999999);
- meta_rectangle_free_list_and_elements (region);
+ g_list_free_full (region, g_free);
printf ("%s passed.\n", G_STRFUNC);
}
@@ -863,7 +863,7 @@ test_clipping_to_region (void)
g_assert (meta_rectangle_contained_in_region (region, &rect) == TRUE);
}
}
- meta_rectangle_free_list_and_elements (region);
+ g_list_free_full (region, g_free);
/* Do some manual tests too */
region = get_screen_region (2);
@@ -902,7 +902,7 @@ test_clipping_to_region (void)
&rect);
g_assert (meta_rectangle_equal (&rect, &temp));
- meta_rectangle_free_list_and_elements (region);
+ g_list_free_full (region, g_free);
printf ("%s passed.\n", G_STRFUNC);
}
@@ -925,7 +925,7 @@ test_shoving_into_region (void)
g_assert (meta_rectangle_contained_in_region (region, &rect));
}
}
- meta_rectangle_free_list_and_elements (region);
+ g_list_free_full (region, g_free);
/* Do some manual tests too */
region = get_screen_region (2);
@@ -972,7 +972,7 @@ test_shoving_into_region (void)
&rect);
g_assert (meta_rectangle_equal (&rect, &temp));
- meta_rectangle_free_list_and_elements (region);
+ g_list_free_full (region, g_free);
printf ("%s passed.\n", G_STRFUNC);
}
@@ -1045,8 +1045,8 @@ test_find_onscreen_edges (void)
tmp = g_list_prepend (tmp, new_screen_edge (1600, 0, 0, 1200, right));
tmp = g_list_prepend (tmp, new_screen_edge ( 0, 0, 0, 1200, left));
verify_edge_lists_are_equal (edges, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (edges);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (edges, g_free);
/*************************************************/
/* Make sure test region 1 has the correct edges */
@@ -1060,8 +1060,8 @@ test_find_onscreen_edges (void)
tmp = g_list_prepend (tmp, new_screen_edge ( 400, 1160, 0, 40, right));
tmp = g_list_prepend (tmp, new_screen_edge ( 0, 20, 0, 1180, left));
verify_edge_lists_are_equal (edges, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (edges);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (edges, g_free);
/*************************************************/
/* Make sure test region 2 has the correct edges */
@@ -1081,8 +1081,8 @@ test_find_onscreen_edges (void)
tmp = g_list_prepend (tmp, new_screen_edge ( 450, 1150, 0, 50, left));
tmp = g_list_prepend (tmp, new_screen_edge ( 0, 20, 0, 1180, left));
verify_edge_lists_are_equal (edges, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (edges);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (edges, g_free);
/*************************************************/
/* Make sure test region 3 has the correct edges */
@@ -1116,8 +1116,8 @@ test_find_onscreen_edges (void)
#endif
verify_edge_lists_are_equal (edges, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (edges);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (edges, g_free);
/*************************************************/
/* Make sure test region 4 has the correct edges */
@@ -1129,8 +1129,8 @@ test_find_onscreen_edges (void)
tmp = g_list_prepend (tmp, new_screen_edge (1600, 20, 0, 1180, right));
tmp = g_list_prepend (tmp, new_screen_edge ( 800, 20, 0, 1180, left));
verify_edge_lists_are_equal (edges, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (edges);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (edges, g_free);
/*************************************************/
/* Make sure test region 5 has the correct edges */
@@ -1138,8 +1138,8 @@ test_find_onscreen_edges (void)
edges = get_screen_edges (5);
tmp = NULL;
verify_edge_lists_are_equal (edges, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (edges);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (edges, g_free);
/*************************************************/
/* Make sure test region 6 has the correct edges */
@@ -1151,8 +1151,8 @@ test_find_onscreen_edges (void)
tmp = g_list_prepend (tmp, new_screen_edge (1600, 40, 0, 1160, right));
tmp = g_list_prepend (tmp, new_screen_edge ( 0, 40, 0, 1160, left));
verify_edge_lists_are_equal (edges, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (edges);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (edges, g_free);
printf ("%s passed.\n", G_STRFUNC);
}
@@ -1174,8 +1174,8 @@ test_find_nonintersected_monitor_edges (void)
edges = get_monitor_edges (0, 0);
tmp = NULL;
verify_edge_lists_are_equal (edges, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (edges);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (edges, g_free);
/*************************************************************************/
/* Make sure test monitor set 2 for with region 1 has the correct edges */
@@ -1185,8 +1185,8 @@ test_find_nonintersected_monitor_edges (void)
tmp = g_list_prepend (tmp, new_monitor_edge ( 0, 600, 1600, 0, bottom));
tmp = g_list_prepend (tmp, new_monitor_edge ( 0, 600, 1600, 0, top));
verify_edge_lists_are_equal (edges, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (edges);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (edges, g_free);
/*************************************************************************/
/* Make sure test monitor set 1 for with region 2 has the correct edges */
@@ -1204,8 +1204,8 @@ test_find_nonintersected_monitor_edges (void)
big_buffer1, big_buffer2);
#endif
verify_edge_lists_are_equal (edges, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (edges);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (edges, g_free);
/*************************************************************************/
/* Make sure test monitor set 3 for with region 3 has the correct edges */
@@ -1219,8 +1219,8 @@ test_find_nonintersected_monitor_edges (void)
tmp = g_list_prepend (tmp, new_monitor_edge ( 800, 675, 0, 425, right));
tmp = g_list_prepend (tmp, new_monitor_edge ( 800, 675, 0, 525, left));
verify_edge_lists_are_equal (edges, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (edges);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (edges, g_free);
/*************************************************************************/
/* Make sure test monitor set 3 for with region 4 has the correct edges */
@@ -1231,8 +1231,8 @@ test_find_nonintersected_monitor_edges (void)
tmp = g_list_prepend (tmp, new_monitor_edge ( 800, 600, 800, 0, top));
tmp = g_list_prepend (tmp, new_monitor_edge ( 800, 600, 0, 600, right));
verify_edge_lists_are_equal (edges, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (edges);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (edges, g_free);
/*************************************************************************/
/* Make sure test monitor set 3 for with region 5has the correct edges */
@@ -1240,8 +1240,8 @@ test_find_nonintersected_monitor_edges (void)
edges = get_monitor_edges (3, 5);
tmp = NULL;
verify_edge_lists_are_equal (edges, tmp);
- meta_rectangle_free_list_and_elements (tmp);
- meta_rectangle_free_list_and_elements (edges);
+ g_list_free_full (tmp, g_free);
+ g_list_free_full (edges, g_free);
printf ("%s passed.\n", G_STRFUNC);
}
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 166d717f..da714063 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -155,11 +155,11 @@ meta_workspace_free (MetaWorkspace *workspace)
{
workspace_free_struts (workspace);
for (i = 0; i < screen->n_monitor_infos; i++)
- meta_rectangle_free_list_and_elements (workspace->monitor_region[i]);
+ g_list_free_full (workspace->monitor_region[i], g_free);
g_free (workspace->monitor_region);
- meta_rectangle_free_list_and_elements (workspace->screen_region);
- meta_rectangle_free_list_and_elements (workspace->screen_edges);
- meta_rectangle_free_list_and_elements (workspace->monitor_edges);
+ g_list_free_full (workspace->screen_region, g_free);
+ g_list_free_full (workspace->screen_edges, g_free);
+ g_list_free_full (workspace->monitor_edges, g_free);
}
g_free (workspace);
@@ -570,11 +570,11 @@ meta_workspace_invalidate_work_area (MetaWorkspace *workspace)
workspace_free_struts (workspace);
for (i = 0; i < workspace->screen->n_monitor_infos; i++)
- meta_rectangle_free_list_and_elements (workspace->monitor_region[i]);
+ g_list_free_full (workspace->monitor_region[i], g_free);
g_free (workspace->monitor_region);
- meta_rectangle_free_list_and_elements (workspace->screen_region);
- meta_rectangle_free_list_and_elements (workspace->screen_edges);
- meta_rectangle_free_list_and_elements (workspace->monitor_edges);
+ g_list_free_full (workspace->screen_region, g_free);
+ g_list_free_full (workspace->screen_edges, g_free);
+ g_list_free_full (workspace->monitor_edges, g_free);
workspace->monitor_region = NULL;
workspace->screen_region = NULL;
workspace->screen_edges = NULL;
diff --git a/src/include/boxes.h b/src/include/boxes.h
index ddbc545c..4b881753 100644
--- a/src/include/boxes.h
+++ b/src/include/boxes.h
@@ -186,15 +186,6 @@ void meta_rectangle_expand_to_avoiding_struts (
const MetaDirection direction,
const GSList *all_struts);
-/* Free the list created by
- * meta_rectangle_get_minimal_spanning_set_for_region()
- * or
- * meta_rectangle_find_onscreen_edges ()
- * or
- * meta_rectangle_find_nonintersected_monitor_edges()
- */
-void meta_rectangle_free_list_and_elements (GList *filled_list);
-
/* could_fit_in_region determines whether one of the spanning_rects is
* big enough to contain rect. contained_in_region checks whether one
* actually contains it.