aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplex.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2001-08-11 12:37:19 +0000
committerNeil Booth <neil@gcc.gnu.org>2001-08-11 12:37:19 +0000
commitbef985f3f69e6f63b144e936b599517e2d6b0601 (patch)
treefcbebbbfda56236b89a255fb6864d9fcde8b6022 /gcc/cpplex.c
parent4d5f3fbd61ad7e6a13424fa720bda3888d6ef429 (diff)
downloadgcc-bef985f3f69e6f63b144e936b599517e2d6b0601.zip
gcc-bef985f3f69e6f63b144e936b599517e2d6b0601.tar.gz
gcc-bef985f3f69e6f63b144e936b599517e2d6b0601.tar.bz2
cpphash.c (_cpp_destroy_hashtable): Use ht_destroy.
* cpphash.c (_cpp_destroy_hashtable): Use ht_destroy. * cpphash.h (CPP_IN_SYSTEM_HEADER): Fix. (struct cpp_pool): New member first. * cppinit.c (append_include_chain): Plug memory leaks. * cpplib.c (cpp_register_pragma, cpp_register_pragma_space): Allocate pragma structures from the (aligned) macro pool to avoid leaking memory. * cpplex.c (_cpp_init_pool, _cpp_free_pool): Use pool->first so we don't leak memory. * hashtable.c (ht_destroy): New. * hashtable.h (ht_destroy): New. From-SVN: r44794
Diffstat (limited to 'gcc/cpplex.c')
-rw-r--r--gcc/cpplex.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/cpplex.c b/gcc/cpplex.c
index 5e0aa5a..9446aae 100644
--- a/gcc/cpplex.c
+++ b/gcc/cpplex.c
@@ -2109,7 +2109,8 @@ _cpp_init_pool (pool, size, align, temp)
if (align & (align - 1))
abort ();
pool->align = align;
- pool->cur = new_chunk (size);
+ pool->first = new_chunk (size);
+ pool->cur = pool->first;
pool->locked = 0;
pool->locks = 0;
if (temp)
@@ -2136,7 +2137,7 @@ void
_cpp_free_pool (pool)
cpp_pool *pool;
{
- cpp_chunk *chunk = pool->cur, *next;
+ cpp_chunk *chunk = pool->first, *next;
do
{
@@ -2144,7 +2145,7 @@ _cpp_free_pool (pool)
free (chunk->base);
chunk = next;
}
- while (chunk && chunk != pool->cur);
+ while (chunk && chunk != pool->first);
}
/* Reserve LEN bytes from a memory pool. */