aboutsummaryrefslogtreecommitdiffhomepage
path: root/env_universal_common.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-02-16 00:02:40 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-02-16 00:02:40 -0800
commit6d522e6ed6b2e87b193e928e888ca4747a4f974d (patch)
treee052a6ee43d9111d08373e12bcc7515cc4030266 /env_universal_common.h
parent635c87d6298d7c30651e266105ef72f3e1876209 (diff)
First round of fixes based on cppcheck
Diffstat (limited to 'env_universal_common.h')
-rw-r--r--env_universal_common.h25
1 files changed, 11 insertions, 14 deletions
diff --git a/env_universal_common.h b/env_universal_common.h
index 21fcd8eb..e5f44f76 100644
--- a/env_universal_common.h
+++ b/env_universal_common.h
@@ -76,20 +76,22 @@ typedef std::queue<message_t *> message_queue_t;
/**
This struct represents a connection between a universal variable server/client
*/
-typedef struct connection
+struct connection_t
{
/**
The file descriptor this socket lives on
*/
int fd;
+
/**
- Queue of onsent messages
+ Queue of unsent messages
*/
- message_queue_t *unsent;
+ std::queue<message_t *> unsent;
+
/**
Set to one when this connection should be killed
*/
- int killme;
+ bool killme;
/**
The input string. Input from the socket goes here. When a
newline is encountered, the buffer is parsed and cleared.
@@ -111,13 +113,14 @@ typedef struct connection
*/
size_t buffer_used;
-
/**
Link to the next connection
*/
- struct connection *next;
-}
-connection_t;
+ struct connection_t *next;
+
+ /* Constructor */
+ connection_t(int input_fd);
+};
/**
Read all available messages on this connection
@@ -194,12 +197,6 @@ bool env_universal_common_get_export(const wcstring &name);
void enqueue_all(connection_t *c);
/**
- Fill in the specified connection_t struct. Use the specified file
- descriptor for communication.
-*/
-void connection_init(connection_t *c, int fd);
-
-/**
Close and destroy the specified connection struct. This frees
allstructures allocated by the connection, such as ques of unsent
messages.