Remove legacy ChainBufferWriter::create_empty.

GitOrigin-RevId: 18e9d13a1472a97f920cf980eb4276309f6b518d
This commit is contained in:
levlam 2018-09-10 18:00:28 +03:00
parent c6afabd633
commit 6329ebf6bc
5 changed files with 9 additions and 17 deletions

View File

@ -46,7 +46,6 @@ class HttpReaderBench : public td::Benchmark {
td::HttpReader http_reader_;
void start_up() override {
writer_ = td::ChainBufferWriter::create_empty();
reader_ = writer_.extract_reader();
http_reader_.init(&reader_, 10000, 0);
}
@ -74,7 +73,6 @@ class BufferBench : public td::Benchmark {
td::HttpReader http_reader_;
void start_up() override {
writer_ = td::ChainBufferWriter::create_empty();
reader_ = writer_.extract_reader();
}
};
@ -105,7 +103,6 @@ class FindBoundaryBench : public td::Benchmark {
td::HttpReader http_reader_;
void start_up() override {
writer_ = td::ChainBufferWriter::create_empty();
reader_ = writer_.extract_reader();
}
};

View File

@ -140,7 +140,7 @@ Gzip::~Gzip() {
BufferSlice gzdecode(Slice s) {
Gzip gzip;
gzip.init_decode().ensure();
auto message = ChainBufferWriter::create_empty();
ChainBufferWriter message;
gzip.set_input(s);
gzip.close_input();
double k = 2;

View File

@ -637,11 +637,6 @@ class ChainBufferWriter {
init();
}
// legacy
static ChainBufferWriter create_empty() {
return ChainBufferWriter();
}
void init(size_t size = 0) {
writer_ = BufferWriter(size);
tail_ = ChainBufferNodeAllocator::create(writer_.as_buffer_slice(), true);

View File

@ -39,7 +39,7 @@ TEST(Gzip, flow) {
auto str = td::rand_string('a', 'z', 1000000);
auto parts = td::rand_split(str);
auto input_writer = td::ChainBufferWriter::create_empty();
td::ChainBufferWriter input_writer;
auto input = input_writer.extract_reader();
td::ByteFlowSource source(&input);
td::GzipByteFlow gzip_flow(td::Gzip::Encode);
@ -89,7 +89,7 @@ TEST(Gzip, flow_error) {
TEST(Gzip, encode_decode_flow) {
auto str = td::rand_string('a', 'z', 1000000);
auto parts = td::rand_split(str);
auto input_writer = td::ChainBufferWriter::create_empty();
td::ChainBufferWriter input_writer;
auto input = input_writer.extract_reader();
td::ByteFlowSource source(&input);
td::GzipByteFlow gzip_encode_flow(td::Gzip::Encode);

View File

@ -133,7 +133,7 @@ TEST(Http, reader) {
SET_VERBOSITY_LEVEL(VERBOSITY_NAME(ERROR));
auto start_mem = BufferAllocator::get_buffer_mem();
{
auto input_writer = ChainBufferWriter::create_empty();
td::ChainBufferWriter input_writer;
auto input = input_writer.extract_reader();
HttpReader reader;
int max_post_size = 10000;
@ -195,7 +195,7 @@ TEST(Http, gzip_bomb) {
auto query = make_http_query("", false, true, 0.01, gzip_bomb_str);
auto parts = rand_split(query);
auto input_writer = ChainBufferWriter::create_empty();
td::ChainBufferWriter input_writer;
auto input = input_writer.extract_reader();
HttpReader reader;
HttpQuery q;
@ -215,7 +215,7 @@ TEST(Http, gzip_bomb) {
TEST(Http, aes_ctr_encode_decode_flow) {
auto str = rand_string('a', 'z', 1000000);
auto parts = rand_split(str);
auto input_writer = ChainBufferWriter::create_empty();
td::ChainBufferWriter input_writer;
auto input = input_writer.extract_reader();
ByteFlowSource source(&input);
UInt256 key;
@ -306,7 +306,7 @@ TEST(Http, aes_file_encryption) {
TEST(Http, chunked_flow) {
auto str = rand_string('a', 'z', 100);
auto parts = rand_split(make_chunked(str));
auto input_writer = ChainBufferWriter::create_empty();
td::ChainBufferWriter input_writer;
auto input = input_writer.extract_reader();
ByteFlowSource source(&input);
HttpChunkedByteFlow chunked_flow;
@ -332,7 +332,7 @@ TEST(Http, chunked_flow_error) {
auto new_str = make_chunked(str);
new_str.resize(str.size() - d);
auto parts = rand_split(new_str);
auto input_writer = ChainBufferWriter::create_empty();
td::ChainBufferWriter input_writer;
auto input = input_writer.extract_reader();
ByteFlowSource source(&input);
HttpChunkedByteFlow chunked_flow;
@ -354,7 +354,7 @@ TEST(Http, gzip_chunked_flow) {
auto str = rand_string('a', 'z', 1000000);
auto parts = rand_split(make_chunked(gzencode(str).as_slice().str()));
auto input_writer = ChainBufferWriter::create_empty();
td::ChainBufferWriter input_writer;
auto input = input_writer.extract_reader();
ByteFlowSource source(&input);
HttpChunkedByteFlow chunked_flow;