MCPcopy Create free account
hub / github.com/apache/brpc / clear

Method clear

src/butil/iobuf.cpp:615–633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

613}
614
615void IOBuf::clear() {
616 if (_small()) {
617 if (_sv.refs[0].block != NULL) {
618 _sv.refs[0].block->dec_ref();
619 reset_block_ref(_sv.refs[0]);
620
621 if (_sv.refs[1].block != NULL) {
622 _sv.refs[1].block->dec_ref();
623 reset_block_ref(_sv.refs[1]);
624 }
625 }
626 } else {
627 for (uint32_t i = 0; i < _bv.nref; ++i) {
628 _bv.ref_at(i).block->dec_ref();
629 }
630 iobuf::release_blockref_array(_bv.refs, _bv.capacity());
631 new (this) IOBuf;
632 }
633}
634
635size_t IOBuf::pop_front(size_t n) {
636 const size_t len = length();

Callers

nothing calls this directly

Calls 5

reset_block_refFunction · 0.85
release_blockref_arrayFunction · 0.85
clearFunction · 0.70
dec_refMethod · 0.45
capacityMethod · 0.45

Tested by

no test coverage detected