From 559e23c796f973a65d05c76e211835b126ee8ac8 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 17 Jun 2011 10:34:29 -0700 Subject: Major refactoring: abandon upb_msg, add upb_accessors. Next on the chopping block is upb_string. --- src/upb_table.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/upb_table.h') 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. -- cgit v1.2.3