aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2016-06-24 11:57:07 -0700
committerGravatar yang-g <yangg@google.com>2016-06-24 11:59:35 -0700
commita324c4fea63840eb06dadb4f0d920226b034404e (patch)
tree8b51c4ae9ae07720fc5f8cc4c9566f448186ee40 /include
parentd605b63383678313aaf3a6a3be7d8f9fc7ca67e9 (diff)
Add API to get c slice from c++ Slice.
Diffstat (limited to 'include')
-rw-r--r--include/grpc++/support/slice.h3
1 files changed, 3 insertions, 0 deletions
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;