diff options
Diffstat (limited to 'src/core/lib')
-rw-r--r-- | src/core/lib/channel/channel_args.c | 18 | ||||
-rw-r--r-- | src/core/lib/channel/channel_stack_builder.c | 6 | ||||
-rw-r--r-- | src/core/lib/channel/connected_channel.c | 25 | ||||
-rw-r--r-- | src/core/lib/channel/handshaker.c | 14 | ||||
-rw-r--r-- | src/core/lib/channel/handshaker_registry.c | 2 | ||||
-rw-r--r-- | src/core/lib/debug/stats.c | 2 | ||||
-rw-r--r-- | src/core/lib/http/format_request.c | 2 | ||||
-rw-r--r-- | src/core/lib/http/httpcli.c | 13 | ||||
-rw-r--r-- | src/core/lib/http/parser.c | 7 | ||||
-rw-r--r-- | src/core/lib/iomgr/closure.c | 4 | ||||
-rw-r--r-- | src/core/lib/iomgr/error.c | 14 | ||||
-rw-r--r-- | src/core/lib/iomgr/ev_epoll1_linux.c | 6 |
12 files changed, 62 insertions, 51 deletions
diff --git a/src/core/lib/channel/channel_args.c b/src/core/lib/channel/channel_args.c index 02db798b5c..16d0737b40 100644 --- a/src/core/lib/channel/channel_args.c +++ b/src/core/lib/channel/channel_args.c @@ -86,13 +86,14 @@ grpc_channel_args *grpc_channel_args_copy_and_add_and_remove( } } // Create result. - grpc_channel_args *dst = gpr_malloc(sizeof(grpc_channel_args)); + grpc_channel_args *dst = + (grpc_channel_args *)gpr_malloc(sizeof(grpc_channel_args)); dst->num_args = num_args_to_copy + num_to_add; if (dst->num_args == 0) { dst->args = NULL; return dst; } - dst->args = gpr_malloc(sizeof(grpc_arg) * dst->num_args); + dst->args = (grpc_arg *)gpr_malloc(sizeof(grpc_arg) * dst->num_args); // Copy args from src that are not being removed. size_t dst_idx = 0; if (src != NULL) { @@ -117,7 +118,7 @@ grpc_channel_args *grpc_channel_args_copy(const grpc_channel_args *src) { grpc_channel_args *grpc_channel_args_union(const grpc_channel_args *a, const grpc_channel_args *b) { const size_t max_out = (a->num_args + b->num_args); - grpc_arg *uniques = gpr_malloc(sizeof(*uniques) * max_out); + grpc_arg *uniques = (grpc_arg *)gpr_malloc(sizeof(*uniques) * max_out); for (size_t i = 0; i < a->num_args; ++i) uniques[i] = a->args[i]; size_t uniques_idx = a->num_args; @@ -160,24 +161,25 @@ static int cmp_arg(const grpc_arg *a, const grpc_arg *b) { /* stabilizing comparison function: since channel_args ordering matters for * keys with the same name, we need to preserve that ordering */ static int cmp_key_stable(const void *ap, const void *bp) { - const grpc_arg *const *a = ap; - const grpc_arg *const *b = bp; + const grpc_arg *const *a = (const grpc_arg *const *)ap; + const grpc_arg *const *b = (const grpc_arg *const *)bp; int c = strcmp((*a)->key, (*b)->key); if (c == 0) c = GPR_ICMP(*a, *b); return c; } grpc_channel_args *grpc_channel_args_normalize(const grpc_channel_args *a) { - grpc_arg **args = gpr_malloc(sizeof(grpc_arg *) * a->num_args); + grpc_arg **args = (grpc_arg **)gpr_malloc(sizeof(grpc_arg *) * a->num_args); for (size_t i = 0; i < a->num_args; i++) { args[i] = &a->args[i]; } if (a->num_args > 1) qsort(args, a->num_args, sizeof(grpc_arg *), cmp_key_stable); - grpc_channel_args *b = gpr_malloc(sizeof(grpc_channel_args)); + grpc_channel_args *b = + (grpc_channel_args *)gpr_malloc(sizeof(grpc_channel_args)); b->num_args = a->num_args; - b->args = gpr_malloc(sizeof(grpc_arg) * b->num_args); + b->args = (grpc_arg *)gpr_malloc(sizeof(grpc_arg) * b->num_args); for (size_t i = 0; i < a->num_args; i++) { b->args[i] = copy_arg(args[i]); } diff --git a/src/core/lib/channel/channel_stack_builder.c b/src/core/lib/channel/channel_stack_builder.c index 2c991ea960..df45f13c81 100644 --- a/src/core/lib/channel/channel_stack_builder.c +++ b/src/core/lib/channel/channel_stack_builder.c @@ -51,7 +51,8 @@ struct grpc_channel_stack_builder_iterator { }; grpc_channel_stack_builder *grpc_channel_stack_builder_create(void) { - grpc_channel_stack_builder *b = gpr_zalloc(sizeof(*b)); + grpc_channel_stack_builder *b = + (grpc_channel_stack_builder *)gpr_zalloc(sizeof(*b)); b->begin.filter = NULL; b->end.filter = NULL; @@ -76,7 +77,8 @@ const char *grpc_channel_stack_builder_get_target( static grpc_channel_stack_builder_iterator *create_iterator_at_filter_node( grpc_channel_stack_builder *builder, filter_node *node) { - grpc_channel_stack_builder_iterator *it = gpr_malloc(sizeof(*it)); + grpc_channel_stack_builder_iterator *it = + (grpc_channel_stack_builder_iterator *)gpr_malloc(sizeof(*it)); it->builder = builder; it->node = node; return it; diff --git a/src/core/lib/channel/connected_channel.c b/src/core/lib/channel/connected_channel.c index 8285226fc4..4f37908958 100644 --- a/src/core/lib/channel/connected_channel.c +++ b/src/core/lib/channel/connected_channel.c @@ -100,8 +100,8 @@ static callback_state *get_state_for_batch( static void con_start_transport_stream_op_batch( grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op_batch *batch) { - call_data *calld = elem->call_data; - channel_data *chand = elem->channel_data; + call_data *calld = (call_data *)elem->call_data; + channel_data *chand = (channel_data *)elem->channel_data; if (batch->recv_initial_metadata) { callback_state *state = &calld->recv_initial_metadata_ready; intercept_callback( @@ -136,7 +136,7 @@ static void con_start_transport_stream_op_batch( static void con_start_transport_op(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_transport_op *op) { - channel_data *chand = elem->channel_data; + channel_data *chand = (channel_data *)elem->channel_data; grpc_transport_perform_op(exec_ctx, chand->transport, op); } @@ -144,8 +144,8 @@ static void con_start_transport_op(grpc_exec_ctx *exec_ctx, static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, const grpc_call_element_args *args) { - call_data *calld = elem->call_data; - channel_data *chand = elem->channel_data; + call_data *calld = (call_data *)elem->call_data; + channel_data *chand = (channel_data *)elem->channel_data; calld->call_combiner = args->call_combiner; int r = grpc_transport_init_stream( exec_ctx, chand->transport, TRANSPORT_STREAM_FROM_CALL_DATA(calld), @@ -158,8 +158,8 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, static void set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_polling_entity *pollent) { - call_data *calld = elem->call_data; - channel_data *chand = elem->channel_data; + call_data *calld = (call_data *)elem->call_data; + channel_data *chand = (channel_data *)elem->channel_data; grpc_transport_set_pops(exec_ctx, chand->transport, TRANSPORT_STREAM_FROM_CALL_DATA(calld), pollent); } @@ -168,8 +168,8 @@ static void set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx, static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, const grpc_call_final_info *final_info, grpc_closure *then_schedule_closure) { - call_data *calld = elem->call_data; - channel_data *chand = elem->channel_data; + call_data *calld = (call_data *)elem->call_data; + channel_data *chand = (channel_data *)elem->channel_data; grpc_transport_destroy_stream(exec_ctx, chand->transport, TRANSPORT_STREAM_FROM_CALL_DATA(calld), then_schedule_closure); @@ -218,7 +218,7 @@ static void bind_transport(grpc_channel_stack *channel_stack, channel_data *cd = (channel_data *)elem->channel_data; GPR_ASSERT(elem->filter == &grpc_connected_filter); GPR_ASSERT(cd->transport == NULL); - cd->transport = t; + cd->transport = (grpc_transport *)t; /* HACK(ctiller): increase call stack size for the channel to make space for channel data. We need a cleaner (but performant) way to do this, @@ -226,7 +226,8 @@ static void bind_transport(grpc_channel_stack *channel_stack, This is only "safe" because call stacks place no additional data after the last call element, and the last call element MUST be the connected channel. */ - channel_stack->call_stack_size += grpc_transport_stream_size(t); + channel_stack->call_stack_size += + grpc_transport_stream_size((grpc_transport *)t); } bool grpc_add_connected_filter(grpc_exec_ctx *exec_ctx, @@ -240,6 +241,6 @@ bool grpc_add_connected_filter(grpc_exec_ctx *exec_ctx, } grpc_stream *grpc_connected_channel_get_stream(grpc_call_element *elem) { - call_data *calld = elem->call_data; + call_data *calld = (call_data *)elem->call_data; return TRANSPORT_STREAM_FROM_CALL_DATA(calld); } diff --git a/src/core/lib/channel/handshaker.c b/src/core/lib/channel/handshaker.c index 2cb83f4114..1753da5721 100644 --- a/src/core/lib/channel/handshaker.c +++ b/src/core/lib/channel/handshaker.c @@ -84,7 +84,8 @@ struct grpc_handshake_manager { }; grpc_handshake_manager* grpc_handshake_manager_create() { - grpc_handshake_manager* mgr = gpr_zalloc(sizeof(grpc_handshake_manager)); + grpc_handshake_manager* mgr = + (grpc_handshake_manager*)gpr_zalloc(sizeof(grpc_handshake_manager)); gpr_mu_init(&mgr->mu); gpr_ref_init(&mgr->refs, 1); return mgr; @@ -137,8 +138,8 @@ void grpc_handshake_manager_add(grpc_handshake_manager* mgr, realloc_count = mgr->count * 2; } if (realloc_count > 0) { - mgr->handshakers = - gpr_realloc(mgr->handshakers, realloc_count * sizeof(grpc_handshaker*)); + mgr->handshakers = (grpc_handshaker**)gpr_realloc( + mgr->handshakers, realloc_count * sizeof(grpc_handshaker*)); } mgr->handshakers[mgr->count++] = handshaker; gpr_mu_unlock(&mgr->mu); @@ -205,7 +206,7 @@ static bool call_next_handshaker_locked(grpc_exec_ctx* exec_ctx, // handshakers together. static void call_next_handshaker(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { - grpc_handshake_manager* mgr = arg; + grpc_handshake_manager* mgr = (grpc_handshake_manager*)arg; gpr_mu_lock(&mgr->mu); bool done = call_next_handshaker_locked(exec_ctx, mgr, GRPC_ERROR_REF(error)); gpr_mu_unlock(&mgr->mu); @@ -219,7 +220,7 @@ static void call_next_handshaker(grpc_exec_ctx* exec_ctx, void* arg, // Callback invoked when deadline is exceeded. static void on_timeout(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { - grpc_handshake_manager* mgr = arg; + grpc_handshake_manager* mgr = (grpc_handshake_manager*)arg; if (error == GRPC_ERROR_NONE) { // Timer fired, rather than being cancelled. grpc_handshake_manager_shutdown( exec_ctx, mgr, @@ -241,7 +242,8 @@ void grpc_handshake_manager_do_handshake( mgr->args.endpoint = endpoint; mgr->args.args = grpc_channel_args_copy(channel_args); mgr->args.user_data = user_data; - mgr->args.read_buffer = gpr_malloc(sizeof(*mgr->args.read_buffer)); + mgr->args.read_buffer = + (grpc_slice_buffer*)gpr_malloc(sizeof(*mgr->args.read_buffer)); grpc_slice_buffer_init(mgr->args.read_buffer); // Initialize state needed for calling handshakers. mgr->acceptor = acceptor; diff --git a/src/core/lib/channel/handshaker_registry.c b/src/core/lib/channel/handshaker_registry.c index 8c4bc3aa00..c6bc87d704 100644 --- a/src/core/lib/channel/handshaker_registry.c +++ b/src/core/lib/channel/handshaker_registry.c @@ -34,7 +34,7 @@ typedef struct { static void grpc_handshaker_factory_list_register( grpc_handshaker_factory_list* list, bool at_start, grpc_handshaker_factory* factory) { - list->list = gpr_realloc( + list->list = (grpc_handshaker_factory**)gpr_realloc( list->list, (list->num_factories + 1) * sizeof(grpc_handshaker_factory*)); if (at_start) { memmove(list->list + 1, list->list, diff --git a/src/core/lib/debug/stats.c b/src/core/lib/debug/stats.c index 91ca0aa76e..4096384dd9 100644 --- a/src/core/lib/debug/stats.c +++ b/src/core/lib/debug/stats.c @@ -33,7 +33,7 @@ static size_t g_num_cores; void grpc_stats_init(void) { g_num_cores = GPR_MAX(1, gpr_cpu_num_cores()); grpc_stats_per_cpu_storage = - gpr_zalloc(sizeof(grpc_stats_data) * g_num_cores); + (grpc_stats_data *)gpr_zalloc(sizeof(grpc_stats_data) * g_num_cores); } void grpc_stats_shutdown(void) { gpr_free(grpc_stats_per_cpu_storage); } diff --git a/src/core/lib/http/format_request.c b/src/core/lib/http/format_request.c index f887726eea..88fb0ab0b6 100644 --- a/src/core/lib/http/format_request.c +++ b/src/core/lib/http/format_request.c @@ -98,7 +98,7 @@ grpc_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request, gpr_strvec_destroy(&out); if (body_bytes) { - tmp = gpr_realloc(tmp, out_len + body_size); + tmp = (char *)gpr_realloc(tmp, out_len + body_size); memcpy(tmp + out_len, body_bytes, body_size); out_len += body_size; } diff --git a/src/core/lib/http/httpcli.c b/src/core/lib/http/httpcli.c index 77af7b7c08..84cc39604c 100644 --- a/src/core/lib/http/httpcli.c +++ b/src/core/lib/http/httpcli.c @@ -130,7 +130,7 @@ static void do_read(grpc_exec_ctx *exec_ctx, internal_request *req) { static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, grpc_error *error) { - internal_request *req = user_data; + internal_request *req = (internal_request *)user_data; size_t i; for (i = 0; i < req->incoming.count; i++) { @@ -159,7 +159,7 @@ static void on_written(grpc_exec_ctx *exec_ctx, internal_request *req) { } static void done_write(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - internal_request *req = arg; + internal_request *req = (internal_request *)arg; if (error == GRPC_ERROR_NONE) { on_written(exec_ctx, req); } else { @@ -175,7 +175,7 @@ static void start_write(grpc_exec_ctx *exec_ctx, internal_request *req) { static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *ep) { - internal_request *req = arg; + internal_request *req = (internal_request *)arg; if (!ep) { next_address(exec_ctx, req, GRPC_ERROR_CREATE_FROM_STATIC_STRING( @@ -189,7 +189,7 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, static void on_connected(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - internal_request *req = arg; + internal_request *req = (internal_request *)arg; if (!req->ep) { next_address(exec_ctx, req, GRPC_ERROR_REF(error)); @@ -226,7 +226,7 @@ static void next_address(grpc_exec_ctx *exec_ctx, internal_request *req, } static void on_resolved(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - internal_request *req = arg; + internal_request *req = (internal_request *)arg; if (error != GRPC_ERROR_NONE) { finish(exec_ctx, req, GRPC_ERROR_REF(error)); return; @@ -243,7 +243,8 @@ static void internal_request_begin(grpc_exec_ctx *exec_ctx, gpr_timespec deadline, grpc_closure *on_done, grpc_httpcli_response *response, const char *name, grpc_slice request_text) { - internal_request *req = gpr_malloc(sizeof(internal_request)); + internal_request *req = + (internal_request *)gpr_malloc(sizeof(internal_request)); memset(req, 0, sizeof(*req)); req->request_text = request_text; grpc_http_parser_init(&req->parser, GRPC_HTTP_RESPONSE, response); diff --git a/src/core/lib/http/parser.c b/src/core/lib/http/parser.c index 9c5e93f4e5..0950bd655e 100644 --- a/src/core/lib/http/parser.c +++ b/src/core/lib/http/parser.c @@ -28,7 +28,7 @@ grpc_tracer_flag grpc_http1_trace = GRPC_TRACER_INITIALIZER(false, "http1"); static char *buf2str(void *buffer, size_t length) { - char *out = gpr_malloc(length + 1); + char *out = (char *)gpr_malloc(length + 1); memcpy(out, buffer, length); out[length] = 0; return out; @@ -197,7 +197,8 @@ static grpc_error *add_header(grpc_http_parser *parser) { if (*hdr_count == parser->hdr_capacity) { parser->hdr_capacity = GPR_MAX(parser->hdr_capacity + 1, parser->hdr_capacity * 3 / 2); - *hdrs = gpr_realloc(*hdrs, parser->hdr_capacity * sizeof(**hdrs)); + *hdrs = (grpc_http_header *)gpr_realloc( + *hdrs, parser->hdr_capacity * sizeof(**hdrs)); } (*hdrs)[(*hdr_count)++] = hdr; @@ -255,7 +256,7 @@ static grpc_error *addbyte_body(grpc_http_parser *parser, uint8_t byte) { if (*body_length == parser->body_capacity) { parser->body_capacity = GPR_MAX(8, parser->body_capacity * 3 / 2); - *body = gpr_realloc((void *)*body, parser->body_capacity); + *body = (char *)gpr_realloc((void *)*body, parser->body_capacity); } (*body)[*body_length] = (char)byte; (*body_length)++; diff --git a/src/core/lib/iomgr/closure.c b/src/core/lib/iomgr/closure.c index 26f9cbe0fa..7236e23cf7 100644 --- a/src/core/lib/iomgr/closure.c +++ b/src/core/lib/iomgr/closure.c @@ -109,7 +109,7 @@ typedef struct { static void closure_wrapper(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - wrapped_closure *wc = arg; + wrapped_closure *wc = (wrapped_closure *)arg; grpc_iomgr_cb_func cb = wc->cb; void *cb_arg = wc->cb_arg; gpr_free(wc); @@ -124,7 +124,7 @@ grpc_closure *grpc_closure_create(const char *file, int line, grpc_closure *grpc_closure_create(grpc_iomgr_cb_func cb, void *cb_arg, grpc_closure_scheduler *scheduler) { #endif - wrapped_closure *wc = gpr_malloc(sizeof(*wc)); + wrapped_closure *wc = (wrapped_closure *)gpr_malloc(sizeof(*wc)); wc->cb = cb; wc->cb_arg = cb_arg; #ifndef NDEBUG diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index 3759dda992..dcd175a2e1 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -211,7 +211,7 @@ static uint8_t get_placement(grpc_error **err, size_t size) { #ifndef NDEBUG grpc_error *orig = *err; #endif - *err = gpr_realloc( + *err = (grpc_error *)gpr_realloc( *err, sizeof(grpc_error) + (*err)->arena_capacity * sizeof(intptr_t)); #ifndef NDEBUG if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { @@ -406,7 +406,8 @@ static grpc_error *copy_error_and_unref(grpc_error *in) { if (in->arena_capacity - in->arena_size < (uint8_t)SLOTS_PER_STR) { new_arena_capacity = (uint8_t)(3 * new_arena_capacity / 2); } - out = gpr_malloc(sizeof(*in) + new_arena_capacity * sizeof(intptr_t)); + out = (grpc_error *)gpr_malloc(sizeof(*in) + + new_arena_capacity * sizeof(intptr_t)); #ifndef NDEBUG if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { gpr_log(GPR_DEBUG, "%p create copying %p", out, in); @@ -530,7 +531,7 @@ typedef struct { static void append_chr(char c, char **s, size_t *sz, size_t *cap) { if (*sz == *cap) { *cap = GPR_MAX(8, 3 * *cap / 2); - *s = gpr_realloc(*s, *cap); + *s = (char *)gpr_realloc(*s, *cap); } (*s)[(*sz)++] = c; } @@ -582,7 +583,8 @@ static void append_esc_str(const uint8_t *str, size_t len, char **s, size_t *sz, static void append_kv(kv_pairs *kvs, char *key, char *value) { if (kvs->num_kvs == kvs->cap_kvs) { kvs->cap_kvs = GPR_MAX(3 * kvs->cap_kvs / 2, 4); - kvs->kvs = gpr_realloc(kvs->kvs, sizeof(*kvs->kvs) * kvs->cap_kvs); + kvs->kvs = + (kv_pair *)gpr_realloc(kvs->kvs, sizeof(*kvs->kvs) * kvs->cap_kvs); } kvs->kvs[kvs->num_kvs].key = key; kvs->kvs[kvs->num_kvs].value = value; @@ -695,8 +697,8 @@ static char *errs_string(grpc_error *err) { } static int cmp_kvs(const void *a, const void *b) { - const kv_pair *ka = a; - const kv_pair *kb = b; + const kv_pair *ka = (const kv_pair *)a; + const kv_pair *kb = (const kv_pair *)b; return strcmp(ka->key, kb->key); } diff --git a/src/core/lib/iomgr/ev_epoll1_linux.c b/src/core/lib/iomgr/ev_epoll1_linux.c index b76eb9e1c9..5bc7e878de 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.c +++ b/src/core/lib/iomgr/ev_epoll1_linux.c @@ -260,7 +260,7 @@ static grpc_fd *fd_create(int fd, const char *name) { gpr_mu_unlock(&fd_freelist_mu); if (new_fd == NULL) { - new_fd = gpr_malloc(sizeof(grpc_fd)); + new_fd = (grpc_fd *)gpr_malloc(sizeof(grpc_fd)); } new_fd->fd = fd; @@ -442,8 +442,8 @@ static grpc_error *pollset_global_init(void) { return GRPC_OS_ERROR(errno, "epoll_ctl"); } g_num_neighbourhoods = GPR_CLAMP(gpr_cpu_num_cores(), 1, MAX_NEIGHBOURHOODS); - g_neighbourhoods = - gpr_zalloc(sizeof(*g_neighbourhoods) * g_num_neighbourhoods); + g_neighbourhoods = (pollset_neighbourhood *)gpr_zalloc( + sizeof(*g_neighbourhoods) * g_num_neighbourhoods); for (size_t i = 0; i < g_num_neighbourhoods; i++) { gpr_mu_init(&g_neighbourhoods[i].mu); } |