Convert all io_data_t copying to shared_ptr copying.

Copy constructor of io_data_t is removed.
This commit is contained in:
Cheer Xiao 2013-01-01 00:37:50 +08:00
parent a9ada13a23
commit 8b10b0a614
3 changed files with 3 additions and 14 deletions

View file

@ -397,7 +397,7 @@ static bool io_transmogrify(const io_chain_t &in_chain, io_chain_t &out_chain, s
case IO_BUFFER: case IO_BUFFER:
case IO_CLOSE: case IO_CLOSE:
{ {
out.reset(new io_data_t(*in)); out = in;
break; break;
} }

4
io.cpp
View file

@ -172,7 +172,7 @@ io_chain_t io_chain_t::duplicate() const
result.reserve(this->size()); result.reserve(this->size());
for (io_chain_t::const_iterator iter = this->begin(); iter != this->end(); iter++) for (io_chain_t::const_iterator iter = this->begin(); iter != this->end(); iter++)
{ {
result.push_back(shared_ptr<io_data_t>(new io_data_t(**iter))); result.push_back(*iter);
} }
return result; return result;
} }
@ -183,7 +183,7 @@ void io_chain_t::duplicate_prepend(const io_chain_t &src)
this->insert(this->begin(), src.size(), shared_ptr<io_data_t>()); this->insert(this->begin(), src.size(), shared_ptr<io_data_t>());
for (size_t idx = 0; idx < src.size(); idx++) for (size_t idx = 0; idx < src.size(); idx++)
{ {
this->at(idx).reset(new io_data_t(*src.at(idx))); this->at(idx) = src.at(idx);
} }
} }

11
io.h
View file

@ -107,17 +107,6 @@ public:
{ {
} }
io_data_t(const io_data_t &rhs) :
out_buffer(rhs.out_buffer),
io_mode(rhs.io_mode),
fd(rhs.fd),
param1(rhs.param1),
param2(rhs.param2),
filename_cstr(rhs.filename_cstr ? strdup(rhs.filename_cstr) : NULL),
is_input(rhs.is_input)
{
}
~io_data_t() ~io_data_t()
{ {
free((void *)filename_cstr); free((void *)filename_cstr);