Example #1
0
folly::StringPiece getRange(const folly::IOBuf& buf) {
  assert(!buf.isChained());
  return {reinterpret_cast<const char*>(buf.data()), buf.length()};
}
Example #2
0
bool hasSameMemoryRegion(const folly::IOBuf& buf, folly::StringPiece range) {
  return !buf.isChained() &&
    (buf.length() == 0 ||
     (range.begin() == reinterpret_cast<const char*>(buf.data()) &&
      range.size() == buf.length()));
}
Example #3
0
bool hasSameMemoryRegion(const folly::IOBuf& a, const folly::IOBuf& b) {
  return !a.isChained() && !b.isChained() &&
    ((a.length() == 0 && b.length() == 0) ||
     (a.data() == b.data() && a.length() == b.length()));
}