From a324c4fea63840eb06dadb4f0d920226b034404e Mon Sep 17 00:00:00 2001 From: yang-g Date: Fri, 24 Jun 2016 11:57:07 -0700 Subject: Add API to get c slice from c++ Slice. --- include/grpc++/support/slice.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/grpc++') diff --git a/include/grpc++/support/slice.h b/include/grpc++/support/slice.h index cec9062d4f..5874b4f5ae 100644 --- a/include/grpc++/support/slice.h +++ b/include/grpc++/support/slice.h @@ -77,6 +77,9 @@ class Slice GRPC_FINAL { /// Raw pointer to the end (one byte \em past the last element) of the slice. const uint8_t* end() const { return GPR_SLICE_END_PTR(slice_); } + /// Raw C slice. Caller needs to call gpr_slice_unref when done. + gpr_slice c_slice() const { return gpr_slice_ref(slice_); } + private: friend class ByteBuffer; -- cgit v1.2.3