From ed38016565d8c7127211fdde45d6add3230193d0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 11 Jul 2017 08:34:26 -0700 Subject: C++ compatibility fixes --- src/core/lib/support/arena.c | 4 ++-- src/core/lib/support/atm.c | 14 +++++++------- src/core/lib/support/avl.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/core/lib') diff --git a/src/core/lib/support/arena.c b/src/core/lib/support/arena.c index b433c61b4c..9e0f73ae3d 100644 --- a/src/core/lib/support/arena.c +++ b/src/core/lib/support/arena.c @@ -38,7 +38,7 @@ struct gpr_arena { gpr_arena *gpr_arena_create(size_t initial_size) { initial_size = ROUND_UP_TO_ALIGNMENT_SIZE(initial_size); - gpr_arena *a = gpr_zalloc(sizeof(gpr_arena) + initial_size); + gpr_arena *a = (gpr_arena *)gpr_zalloc(sizeof(gpr_arena) + initial_size); a->initial_zone.size_end = initial_size; return a; } @@ -64,7 +64,7 @@ void *gpr_arena_alloc(gpr_arena *arena, size_t size) { zone *next_z = (zone *)gpr_atm_acq_load(&z->next_atm); if (next_z == NULL) { size_t next_z_size = (size_t)gpr_atm_no_barrier_load(&arena->size_so_far); - next_z = gpr_zalloc(sizeof(zone) + next_z_size); + next_z = (zone *)gpr_zalloc(sizeof(zone) + next_z_size); next_z->size_begin = z->size_end; next_z->size_end = z->size_end + next_z_size; if (!gpr_atm_rel_cas(&z->next_atm, (gpr_atm)NULL, (gpr_atm)next_z)) { diff --git a/src/core/lib/support/atm.c b/src/core/lib/support/atm.c index caa0bafe33..2f37d62f76 100644 --- a/src/core/lib/support/atm.c +++ b/src/core/lib/support/atm.c @@ -21,12 +21,12 @@ gpr_atm gpr_atm_no_barrier_clamped_add(gpr_atm *value, gpr_atm delta, gpr_atm min, gpr_atm max) { - gpr_atm current; - gpr_atm new; + gpr_atm current_value; + gpr_atm new_value; do { - current = gpr_atm_no_barrier_load(value); - new = GPR_CLAMP(current + delta, min, max); - if (new == current) break; - } while (!gpr_atm_no_barrier_cas(value, current, new)); - return new; + current_value = gpr_atm_no_barrier_load(value); + new_value = GPR_CLAMP(current_value + delta, min, max); + if (new_value == current_value) break; + } while (!gpr_atm_no_barrier_cas(value, current_value, new_value)); + return new_value; } diff --git a/src/core/lib/support/avl.c b/src/core/lib/support/avl.c index aa0f665272..a6178fdbce 100644 --- a/src/core/lib/support/avl.c +++ b/src/core/lib/support/avl.c @@ -76,7 +76,7 @@ static gpr_avl_node *assert_invariants(gpr_avl_node *n) { return n; } gpr_avl_node *new_node(void *key, void *value, gpr_avl_node *left, gpr_avl_node *right) { - gpr_avl_node *node = gpr_malloc(sizeof(*node)); + gpr_avl_node *node = (gpr_avl_node *)gpr_malloc(sizeof(*node)); gpr_ref_init(&node->refs, 1); node->key = key; node->value = value; -- cgit v1.2.3