diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 59f0fde44dd..98ce67c7e1e 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -900,6 +900,18 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; buffer_c_str_accesses.inc(); return _raw->get_data() + _off; } + const char *buffer::ptr::end_c_str() const { + assert(_raw); + if (buffer_track_c_str) + buffer_c_str_accesses.inc(); + return _raw->get_data() + _off + _len; + } + char *buffer::ptr::end_c_str() { + assert(_raw); + if (buffer_track_c_str) + buffer_c_str_accesses.inc(); + return _raw->get_data() + _off + _len; + } unsigned buffer::ptr::unused_tail_length() const { diff --git a/src/include/buffer.h b/src/include/buffer.h index e900fc7ca26..f5b2826b85b 100644 --- a/src/include/buffer.h +++ b/src/include/buffer.h @@ -209,6 +209,8 @@ namespace buffer CEPH_BUFFER_API { raw *get_raw() const { return _raw; } const char *c_str() const; char *c_str(); + const char *end_c_str() const; + char *end_c_str(); unsigned length() const { return _len; } unsigned offset() const { return _off; } unsigned start() const { return _off; }