blob: ea9208c7e32dd1877f500d0bef910926e6007264 [file] [log] [blame]
Craig Tiller1a61b172015-02-16 11:53:47 -08001/*
2 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02003 * Copyright 2015 gRPC authors.
Craig Tiller1a61b172015-02-16 11:53:47 -08004 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02005 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
Craig Tiller1a61b172015-02-16 11:53:47 -08008 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02009 * http://www.apache.org/licenses/LICENSE-2.0
Craig Tiller1a61b172015-02-16 11:53:47 -080010 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +020011 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
Craig Tiller1a61b172015-02-16 11:53:47 -080016 *
17 */
18
Craig Tillerea61b072015-02-03 19:19:27 -080019#include <grpc/grpc.h>
20#include <grpc/support/alloc.h>
21
22#include <string.h>
23
Craig Tiller7c70b6c2017-01-23 07:48:42 -080024#include "src/core/lib/iomgr/exec_ctx.h"
25#include "src/core/lib/slice/slice_internal.h"
Craig Tiller9533d042016-03-25 17:11:06 -070026#include "src/core/lib/surface/api_trace.h"
Masood Malekghassemi76c3d742015-08-19 18:22:53 -070027
Craig Tillera82950e2015-09-22 12:33:20 -070028void grpc_call_details_init(grpc_call_details* cd) {
Masood Malekghassemi76c3d742015-08-19 18:22:53 -070029 GRPC_API_TRACE("grpc_call_details_init(cd=%p)", 1, (cd));
Craig Tillera82950e2015-09-22 12:33:20 -070030 memset(cd, 0, sizeof(*cd));
Craig Tiller7c70b6c2017-01-23 07:48:42 -080031 cd->method = grpc_empty_slice();
32 cd->host = grpc_empty_slice();
Craig Tillerea61b072015-02-03 19:19:27 -080033}
34
Craig Tillera82950e2015-09-22 12:33:20 -070035void grpc_call_details_destroy(grpc_call_details* cd) {
Masood Malekghassemi76c3d742015-08-19 18:22:53 -070036 GRPC_API_TRACE("grpc_call_details_destroy(cd=%p)", 1, (cd));
Craig Tiller7c70b6c2017-01-23 07:48:42 -080037 grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
38 grpc_slice_unref_internal(&exec_ctx, cd->method);
39 grpc_slice_unref_internal(&exec_ctx, cd->host);
40 grpc_exec_ctx_finish(&exec_ctx);
Craig Tillerea61b072015-02-03 19:19:27 -080041}