+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.
+
2020-09-17 Tom Tromey <tom@tromey.com>
* completer.c (completion_tracker::discard_completions)
/* 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. */
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. */
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;
{
public:
filename_seen_cache ();
- ~filename_seen_cache ();
DISABLE_COPY_AND_ASSIGN (filename_seen_cache);
return 1;
};
- htab_traverse_noresize (m_tab, erased_cb, &callback);
+ htab_traverse_noresize (m_tab.get (), erased_cb, &callback);
}
private:
/* Table of files seen so far. */
- htab_t m_tab;
+ htab_up m_tab;
};
#endif /* FILENAME_SEEN_CACHE_H */