aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc/impl/codegen/slice.h
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-12-12 06:36:43 -0800
committerGravatar Craig Tiller <ctiller@google.com>2016-12-12 06:36:43 -0800
commitb995e8bcdabd5e40bf5384a64ee57e83cc9691ff (patch)
tree4c1441e5648faad865e7480d36b063882e9fd77b /include/grpc/impl/codegen/slice.h
parent298d481f1e8348cb7713d53a26fc2c41eb9d8f7c (diff)
parentb62bffbea5eef106bfbe644e8af161889c927401 (diff)
Merge github.com:grpc/grpc into slice_with_exec_ctx
Diffstat (limited to 'include/grpc/impl/codegen/slice.h')
-rw-r--r--include/grpc/impl/codegen/slice.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/grpc/impl/codegen/slice.h b/include/grpc/impl/codegen/slice.h
index 4d4a86fa22..00781bb76b 100644
--- a/include/grpc/impl/codegen/slice.h
+++ b/include/grpc/impl/codegen/slice.h
@@ -38,6 +38,7 @@
#include <stdint.h>
#include <grpc/impl/codegen/exec_ctx_fwd.h>
+#include <grpc/impl/codegen/gpr_slice.h>
/* Slice API
@@ -117,4 +118,22 @@ typedef struct {
GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
#define GRPC_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
+#ifdef GRPC_ALLOW_GPR_SLICE_FUNCTIONS
+
+/* Duplicate GPR_* definitions */
+#define GPR_SLICE_START_PTR(slice) \
+ ((slice).refcount ? (slice).data.refcounted.bytes \
+ : (slice).data.inlined.bytes)
+#define GPR_SLICE_LENGTH(slice) \
+ ((slice).refcount ? (slice).data.refcounted.length \
+ : (slice).data.inlined.length)
+#define GPR_SLICE_SET_LENGTH(slice, newlen) \
+ ((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
+ : ((slice).data.inlined.length = (uint8_t)(newlen)))
+#define GPR_SLICE_END_PTR(slice) \
+ GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
+#define GPR_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
+
+#endif /* GRPC_ALLOW_GPR_SLICE_FUNCTIONS */
+
#endif /* GRPC_IMPL_CODEGEN_SLICE_H */