From: Sage Weil Date: Wed, 29 Oct 2008 18:13:44 +0000 (-0700) Subject: buffer: print 'no raw' for 'null' bufferptrs X-Git-Tag: v0.5~167 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c20745e6f7ce40e6d1445c040fdfcf04e6184573;p=ceph.git buffer: print 'no raw' for 'null' bufferptrs Aids debugging... --- diff --git a/src/include/buffer.h b/src/include/buffer.h index d4fb4d3c04d2..588c5e3a087d 100644 --- a/src/include/buffer.h +++ b/src/include/buffer.h @@ -271,6 +271,8 @@ public: release(); } + bool have_raw() const { return _raw ? true:false; } + raw *clone() { return _raw->clone(); } @@ -1007,11 +1009,14 @@ inline std::ostream& operator<<(std::ostream& out, const buffer::raw &r) { } inline std::ostream& operator<<(std::ostream& out, const buffer::ptr& bp) { - out << "buffer::ptr(" << bp.offset() << "~" << bp.length() - << " " << (void*)bp.c_str() - << " in raw " << (void*)bp.raw_c_str() - << " len " << bp.raw_length() - << " nref " << bp.raw_nref() << ")"; + if (bp.have_raw()) + out << "buffer::ptr(" << bp.offset() << "~" << bp.length() + << " " << (void*)bp.c_str() + << " in raw " << (void*)bp.raw_c_str() + << " len " << bp.raw_length() + << " nref " << bp.raw_nref() << ")"; + else + out << "buffer:ptr(" << bp.offset() << "~" << bp.length() << " no raw)"; return out; }