aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/slice/slice_hash_table.c
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-02-16 14:09:39 -0800
committerGravatar Craig Tiller <ctiller@google.com>2017-02-16 14:09:39 -0800
commit6f4178878ccc45f365ce72eef6247315e048cf2a (patch)
tree91e01ba6e683014839aa60e22069713e6229c2c7 /src/core/lib/slice/slice_hash_table.c
parent1ca0dc2a9b22c144e2a5153394266037e497635e (diff)
Add zalloc, convert a bunch of files to use it
Diffstat (limited to 'src/core/lib/slice/slice_hash_table.c')
-rw-r--r--src/core/lib/slice/slice_hash_table.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/core/lib/slice/slice_hash_table.c b/src/core/lib/slice/slice_hash_table.c
index 46f807f4a5..219567f36f 100644
--- a/src/core/lib/slice/slice_hash_table.c
+++ b/src/core/lib/slice/slice_hash_table.c
@@ -82,15 +82,13 @@ static void grpc_slice_hash_table_add(
grpc_slice_hash_table* grpc_slice_hash_table_create(
size_t num_entries, grpc_slice_hash_table_entry* entries) {
- grpc_slice_hash_table* table = gpr_malloc(sizeof(*table));
- memset(table, 0, sizeof(*table));
+ grpc_slice_hash_table* table = gpr_zalloc(sizeof(*table));
gpr_ref_init(&table->refs, 1);
// Quadratic probing gets best performance when the table is no more
// than half full.
table->size = num_entries * 2;
const size_t entry_size = sizeof(grpc_slice_hash_table_entry) * table->size;
- table->entries = gpr_malloc(entry_size);
- memset(table->entries, 0, entry_size);
+ table->entries = gpr_zalloc(entry_size);
for (size_t i = 0; i < num_entries; ++i) {
grpc_slice_hash_table_entry* entry = &entries[i];
grpc_slice_hash_table_add(table, entry->key, entry->value, entry->vtable);