aboutsummaryrefslogtreecommitdiffhomepage
path: root/io.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-01-04 00:22:12 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-01-04 00:22:12 -0800
commitac023f7588e562a03fdea7fd2feda487f18827c7 (patch)
treebf1728ce43de5ccb975095b7732c0c1bfcc744eb /io.h
parentf3c8f535a48d5fdd518bd60879ade948bc8be7e6 (diff)
Replace some shared_ptrs with const shared_ptr &. Don't use shared_ptr in postfork.cpp. Eliminate copy constructor in io_data_t. Simplify some other uses of shared_ptr<io_data_t>
Diffstat (limited to 'io.h')
-rw-r--r--io.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/io.h b/io.h
index af6f71bb..1d31a14f 100644
--- a/io.h
+++ b/io.h
@@ -20,9 +20,10 @@ private:
/** buffer to save output in for IO_BUFFER. Note that in the original fish, the buffer was a pointer to a buffer_t stored in the param2 union down below, and when an io_data_t was duplicated the pointer was copied so that two io_data_ts referenced the same buffer. It's not clear to me how this was ever cleaned up correctly. But it's important that they share the same buffer for reasons I don't yet understand either. We can get correct sharing and cleanup with shared_ptr. */
shared_ptr<std::vector<char> > out_buffer;
- /* No assignment allowed */
+ /* No assignment or copying allowed */
+ io_data_t(const io_data_t &rhs);
void operator=(const io_data_t &rhs);
-
+
public:
/** Type of redirect */
int io_mode;
@@ -117,9 +118,9 @@ class io_chain_t : public std::vector<shared_ptr<io_data_t> >
{
public:
io_chain_t();
- io_chain_t(shared_ptr<io_data_t> );
+ io_chain_t(const shared_ptr<io_data_t> &);
- void remove(shared_ptr<const io_data_t> element);
+ void remove(const shared_ptr<const io_data_t> &element);
io_chain_t duplicate() const;
void duplicate_prepend(const io_chain_t &src);
void destroy();
@@ -132,7 +133,7 @@ public:
/**
Remove the specified io redirection from the chain
*/
-void io_remove(io_chain_t &list, shared_ptr<const io_data_t> element);
+void io_remove(io_chain_t &list, const shared_ptr<const io_data_t> &element);
/** Make a copy of the specified chain of redirections. Uses operator new. */
io_chain_t io_duplicate(const io_chain_t &chain);
@@ -156,7 +157,7 @@ shared_ptr<io_data_t> io_chain_get(io_chain_t &src, int fd);
/**
Free all resources used by a IO_BUFFER type io redirection.
*/
-void io_buffer_destroy(shared_ptr<io_data_t> io_buffer);
+void io_buffer_destroy(const shared_ptr<io_data_t> &io_buffer);
/**
Create a IO_BUFFER type io redirection, complete with a pipe and a