[set/map] Remove init_shallow/fini_shallow()

This commit is contained in:
Behdad Esfahbod 2022-07-20 15:57:09 -06:00
parent 79b23cc25d
commit bcd59b5142
2 changed files with 8 additions and 16 deletions

View File

@ -124,21 +124,20 @@ struct hb_hashmap_t
hb_swap (a.prime, b.prime); hb_swap (a.prime, b.prime);
hb_swap (a.items, b.items); hb_swap (a.items, b.items);
} }
void init_shallow () void init ()
{ {
hb_object_init (this);
successful = true; successful = true;
population = occupancy = 0; population = occupancy = 0;
mask = 0; mask = 0;
prime = 0; prime = 0;
items = nullptr; items = nullptr;
} }
void init () void fini ()
{
hb_object_init (this);
init_shallow ();
}
void fini_shallow ()
{ {
hb_object_fini (this);
if (likely (items)) { if (likely (items)) {
unsigned size = mask + 1; unsigned size = mask + 1;
for (unsigned i = 0; i < size; i++) for (unsigned i = 0; i < size; i++)
@ -148,11 +147,6 @@ struct hb_hashmap_t
} }
population = occupancy = 0; population = occupancy = 0;
} }
void fini ()
{
hb_object_fini (this);
fini_shallow ();
}
void reset () void reset ()
{ {

View File

@ -59,17 +59,15 @@ struct hb_sparseset_t
hb_copy (o, *this); hb_copy (o, *this);
} }
void init_shallow () { s.init (); }
void init () void init ()
{ {
hb_object_init (this); hb_object_init (this);
init_shallow (); s.init ();
} }
void fini_shallow () { s.fini (); }
void fini () void fini ()
{ {
hb_object_fini (this); hb_object_fini (this);
fini_shallow (); s.fini ();
} }
explicit operator bool () const { return !is_empty (); } explicit operator bool () const { return !is_empty (); }