]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
buffer: print 'no raw' for 'null' bufferptrs
authorSage Weil <sage@newdream.net>
Wed, 29 Oct 2008 18:13:44 +0000 (11:13 -0700)
committerSage Weil <sage@newdream.net>
Wed, 29 Oct 2008 18:13:44 +0000 (11:13 -0700)
Aids debugging...

src/include/buffer.h

index d4fb4d3c04d202787cd992a767fa957dd8da534b..588c5e3a087dbf0b4561288d5959dae3f40845e0 100644 (file)
@@ -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;
 }