diff options
author | Craig Tiller <ctiller@google.com> | 2017-02-16 14:09:39 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-02-16 14:09:39 -0800 |
commit | 6f4178878ccc45f365ce72eef6247315e048cf2a (patch) | |
tree | 91e01ba6e683014839aa60e22069713e6229c2c7 /src/core/lib/transport | |
parent | 1ca0dc2a9b22c144e2a5153394266037e497635e (diff) |
Add zalloc, convert a bunch of files to use it
Diffstat (limited to 'src/core/lib/transport')
-rw-r--r-- | src/core/lib/transport/metadata.c | 6 | ||||
-rw-r--r-- | src/core/lib/transport/transport.h | 1 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/core/lib/transport/metadata.c b/src/core/lib/transport/metadata.c index 489c20cbc8..f2417d8c4e 100644 --- a/src/core/lib/transport/metadata.c +++ b/src/core/lib/transport/metadata.c @@ -130,8 +130,7 @@ void grpc_mdctx_global_init(void) { shard->count = 0; gpr_atm_no_barrier_store(&shard->free_estimate, 0); shard->capacity = INITIAL_SHARD_CAPACITY; - shard->elems = gpr_malloc(sizeof(*shard->elems) * shard->capacity); - memset(shard->elems, 0, sizeof(*shard->elems) * shard->capacity); + shard->elems = gpr_zalloc(sizeof(*shard->elems) * shard->capacity); } } @@ -216,8 +215,7 @@ static void grow_mdtab(mdtab_shard *shard) { GPR_TIMER_BEGIN("grow_mdtab", 0); - mdtab = gpr_malloc(sizeof(interned_metadata *) * capacity); - memset(mdtab, 0, sizeof(interned_metadata *) * capacity); + mdtab = gpr_zalloc(sizeof(interned_metadata *) * capacity); for (i = 0; i < shard->capacity; i++) { for (md = shard->elems[i]; md; md = next) { diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index 9a0abe1ca4..f2dbb891b2 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -213,6 +213,7 @@ size_t grpc_transport_stream_size(grpc_transport *transport); /* Initialize transport data for a stream. Returns 0 on success, any other (transport-defined) value for failure. + May assume that stream contains all-zeros. Arguments: transport - the transport on which to create this stream |