diff options
Diffstat (limited to 'gcc/alloc-pool.c')
-rw-r--r-- | gcc/alloc-pool.c | 11 |
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) |