diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2011-06-17 10:34:29 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2011-06-17 10:34:29 -0700 |
commit | 559e23c796f973a65d05c76e211835b126ee8ac8 (patch) | |
tree | ec359628f3b93b88718cc34e5ec86ca6e6c6c1e2 /src/upb_table.h | |
parent | a503b8859c37906ab5012db163daca43bfe393bb (diff) |
Major refactoring: abandon upb_msg, add upb_accessors.
Next on the chopping block is upb_string.
Diffstat (limited to 'src/upb_table.h')
-rw-r--r-- | src/upb_table.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/upb_table.h b/src/upb_table.h index 9b53a37..631709c 100644 --- a/src/upb_table.h +++ b/src/upb_table.h @@ -103,6 +103,12 @@ INLINE uint32_t upb_strtable_count(upb_strtable *t) { void upb_inttable_insert(upb_inttable *t, upb_inttable_key_t key, void *val); void upb_strtable_insert(upb_strtable *t, upb_strtable_entry *ent); // TODO: update void upb_inttable_compact(upb_inttable *t); +INLINE void upb_strtable_clear(upb_strtable *t) { + // TODO: improve. + uint16_t entry_size = t->t.entry_size; + upb_strtable_free(t); + upb_strtable_init(t, 8, entry_size); +} INLINE uint32_t _upb_inttable_bucket(upb_inttable *t, upb_inttable_key_t k) { uint32_t bucket = k & t->t.mask; // Identity hash for ints. |