mirror of https://gitee.com/bigwinds/arangodb
Tiny change in velocypack: steal more efficient.
This commit is contained in:
parent
7ed6754389
commit
af107de6f9
|
@ -253,8 +253,9 @@ class Builder {
|
||||||
std::shared_ptr<Buffer<uint8_t>> const& buffer() const { return _buffer; }
|
std::shared_ptr<Buffer<uint8_t>> const& buffer() const { return _buffer; }
|
||||||
|
|
||||||
std::shared_ptr<Buffer<uint8_t>> steal() {
|
std::shared_ptr<Buffer<uint8_t>> steal() {
|
||||||
std::shared_ptr<Buffer<uint8_t>> res = std::move(_buffer);
|
// After a steal the Builder is broken!
|
||||||
_buffer.reset(new Buffer<uint8_t>());
|
std::shared_ptr<Buffer<uint8_t>> res = _buffer;
|
||||||
|
_buffer.reset();
|
||||||
_pos = 0;
|
_pos = 0;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,8 +164,9 @@ class Parser {
|
||||||
// Not with this high-performance two-pass approach. :-(
|
// Not with this high-performance two-pass approach. :-(
|
||||||
|
|
||||||
std::shared_ptr<Builder> steal() {
|
std::shared_ptr<Builder> steal() {
|
||||||
|
// Parser object is broken after a steal()
|
||||||
std::shared_ptr<Builder> res(_b);
|
std::shared_ptr<Builder> res(_b);
|
||||||
_b.reset(new Builder());
|
_b.reset();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue