aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/channel/channel_stack.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/channel/channel_stack.c')
-rw-r--r--src/core/lib/channel/channel_stack.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/src/core/lib/channel/channel_stack.c b/src/core/lib/channel/channel_stack.c
index 4e734ad113..4994b2484c 100644
--- a/src/core/lib/channel/channel_stack.c
+++ b/src/core/lib/channel/channel_stack.c
@@ -32,7 +32,6 @@
*/
#include "src/core/lib/channel/channel_stack.h"
-#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <stdlib.h>
@@ -271,16 +270,11 @@ grpc_call_stack *grpc_call_stack_from_top_element(grpc_call_element *elem) {
sizeof(grpc_call_stack)));
}
-static void destroy_op(grpc_exec_ctx *exec_ctx, void *op, grpc_error *error) {
- gpr_free(op);
-}
-
void grpc_call_element_send_cancel(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem) {
- grpc_transport_stream_op *op = gpr_malloc(sizeof(*op));
- memset(op, 0, sizeof(*op));
- op->cancel_error = GRPC_ERROR_CANCELLED;
- op->on_complete = grpc_closure_create(destroy_op, op);
+ grpc_transport_stream_op op;
+ memset(&op, 0, sizeof(op));
+ op.cancel_error = GRPC_ERROR_CANCELLED;
elem->filter->start_transport_stream_op(exec_ctx, elem, op);
}
@@ -288,10 +282,9 @@ void grpc_call_element_send_cancel_with_message(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem,
grpc_status_code status,
gpr_slice *optional_message) {
- grpc_transport_stream_op *op = gpr_malloc(sizeof(*op));
- memset(op, 0, sizeof(*op));
- op->on_complete = grpc_closure_create(destroy_op, op);
- grpc_transport_stream_op_add_cancellation_with_message(op, status,
+ grpc_transport_stream_op op;
+ memset(&op, 0, sizeof(op));
+ grpc_transport_stream_op_add_cancellation_with_message(&op, status,
optional_message);
elem->filter->start_transport_stream_op(exec_ctx, elem, op);
}
@@ -300,9 +293,8 @@ void grpc_call_element_send_close_with_message(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem,
grpc_status_code status,
gpr_slice *optional_message) {
- grpc_transport_stream_op *op = gpr_malloc(sizeof(*op));
- memset(op, 0, sizeof(*op));
- op->on_complete = grpc_closure_create(destroy_op, op);
- grpc_transport_stream_op_add_close(op, status, optional_message);
- elem->filter->start_transport_stream_op(exec_ctx, elem, op);
+ grpc_transport_stream_op op;
+ memset(&op, 0, sizeof(op));
+ grpc_transport_stream_op_add_close(&op, status, optional_message);
+ elem->filter->start_transport_stream_op(exec_ctx, elem, &op);
}