diff options
author | yang-g <yangg@google.com> | 2016-06-24 11:57:07 -0700 |
---|---|---|
committer | yang-g <yangg@google.com> | 2016-06-24 11:59:35 -0700 |
commit | a324c4fea63840eb06dadb4f0d920226b034404e (patch) | |
tree | 8b51c4ae9ae07720fc5f8cc4c9566f448186ee40 /include | |
parent | d605b63383678313aaf3a6a3be7d8f9fc7ca67e9 (diff) |
Add API to get c slice from c++ Slice.
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc++/support/slice.h | 3 |
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; |