diff options
author | Tom Tromey <tom@tromey.com> | 2020-09-17 11:47:50 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-09-17 11:58:56 -0600 |
commit | 99032cfcc6c12006ba6184318c5df5b08a65e58a (patch) | |
tree | 34191fefb765cd2af8067fd660612e887816c44b /gdb/filename-seen-cache.c | |
parent | 32580f6d2eccfe32ee72b17f63c9e70cf867c09e (diff) | |
download | fsf-binutils-gdb-99032cfcc6c12006ba6184318c5df5b08a65e58a.zip fsf-binutils-gdb-99032cfcc6c12006ba6184318c5df5b08a65e58a.tar.gz fsf-binutils-gdb-99032cfcc6c12006ba6184318c5df5b08a65e58a.tar.bz2 |
Use htab_up in filename_seen_cache
This changes filename_seen_cache to use htab_up, rather than explicit
calls to htab_delete.
gdb/ChangeLog
2020-09-17 Tom Tromey <tom@tromey.com>
* filename-seen-cache.c (filename_seen_cache::filename_seen_cache)
(filename_seen_cache::clear): Update.
(~filename_seen_cache): Remove.
(filename_seen_cache::seen): Update.
* filename-seen-cache.h (class filename_seen_cache) <m_tab>: Now
htab_up.
<~filename_seen_cache>: Remove.
<traverse>: Update.
Diffstat (limited to 'gdb/filename-seen-cache.c')
-rw-r--r-- | gdb/filename-seen-cache.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/gdb/filename-seen-cache.c b/gdb/filename-seen-cache.c index f3905c0..b0cda08 100644 --- a/gdb/filename-seen-cache.c +++ b/gdb/filename-seen-cache.c @@ -27,10 +27,10 @@ /* filename_seen_cache constructor. */ filename_seen_cache::filename_seen_cache () + : m_tab (htab_create_alloc (INITIAL_FILENAME_SEEN_CACHE_SIZE, + filename_hash, filename_eq, + NULL, xcalloc, xfree)) { - m_tab = htab_create_alloc (INITIAL_FILENAME_SEEN_CACHE_SIZE, - filename_hash, filename_eq, - NULL, xcalloc, xfree); } /* See filename-seen-cache.h. */ @@ -38,14 +38,7 @@ filename_seen_cache::filename_seen_cache () void filename_seen_cache::clear () { - htab_empty (m_tab); -} - -/* See filename-seen-cache.h. */ - -filename_seen_cache::~filename_seen_cache () -{ - htab_delete (m_tab); + htab_empty (m_tab.get ()); } /* See filename-seen-cache.h. */ @@ -56,7 +49,7 @@ filename_seen_cache::seen (const char *file) void **slot; /* Is FILE in tab? */ - slot = htab_find_slot (m_tab, file, INSERT); + slot = htab_find_slot (m_tab.get (), file, INSERT); if (*slot != NULL) return true; |