summaryrefslogtreecommitdiff
path: root/gcc/alloc-pool.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2006-06-20 16:19:29 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2006-06-20 16:19:29 +0000
commit5a6ccafd7d4899ee7942a5f3be359a249c1273ae (patch)
tree9147dcee09484286cbe9b33011aa8f2b85f12e02 /gcc/alloc-pool.c
parent1000b34d95a6319206389feb136879d42d4675f2 (diff)
alloc-pool.h (free_alloc_pool_if_empty): Prototype new function.
2006-06-20 Richard Guenther <rguenther@suse.de> Michael Matz <matz@suse.de> * alloc-pool.h (free_alloc_pool_if_empty): Prototype new function. * alloc-pool.c (free_alloc_pool_if_empty): New function. * et-forest.h (et_free_pools): Prototype new function. * et-forest.c (et_free_tree_force): Free parent occurrence. (et_free_pools): New function. * dominance.c (free_dominance_info): Free et-forest alloc pools. Co-Authored-By: Michael Matz <matz@suse.de> From-SVN: r114817
Diffstat (limited to 'gcc/alloc-pool.c')
-rw-r--r--gcc/alloc-pool.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c
index 17d4073cee5..d85cd9ef57c 100644
--- a/gcc/alloc-pool.c
+++ b/gcc/alloc-pool.c
@@ -207,6 +207,17 @@ free_alloc_pool (alloc_pool pool)
free (pool);
}
+/* Frees the alloc_pool, if it is empty and zero *POOL in this case. */
+void
+free_alloc_pool_if_empty (alloc_pool *pool)
+{
+ if ((*pool)->elts_free == (*pool)->elts_allocated)
+ {
+ free_alloc_pool (*pool);
+ *pool = NULL;
+ }
+}
+
/* Allocates one element from the pool specified. */
void *
pool_alloc (alloc_pool pool)