aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-06-04 08:42:02 +0200
committerMax Kellermann <max@duempel.org>2009-06-04 08:42:02 +0200
commit427dd816780c495097619353ab5c6d423072dcb4 (patch)
tree959d20b8db569a59eef1e0475fb410e9bc2fe13a
parented475718e6d21434c76cea0e76c6cf3cfd4e1f7d (diff)
downloadmpd-427dd816780c495097619353ab5c6d423072dcb4.tar.gz
mpd-427dd816780c495097619353ab5c6d423072dcb4.tar.xz
mpd-427dd816780c495097619353ab5c6d423072dcb4.zip
client: added assertions on channel!=NULL
I'm hunting down a bug where client->channel==NULL during I/O operations. These new assertions help avoid this kind of bug in the future.
-rw-r--r--src/client.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/client.c b/src/client.c
index 54d4f8b7c..1133be483 100644
--- a/src/client.c
+++ b/src/client.c
@@ -430,6 +430,9 @@ static int client_read(struct client *client)
GIOStatus status;
gsize bytes_read;
+ assert(client != NULL);
+ assert(client->channel != NULL);
+
p = fifo_buffer_write(client->input, &max_length);
if (p == NULL) {
g_warning("[%u] buffer overflow", client->num);
@@ -617,6 +620,10 @@ client_write_deferred_buffer(struct client *client,
GIOStatus status;
gsize bytes_written;
+ assert(client != NULL);
+ assert(client->channel != NULL);
+ assert(buffer != NULL);
+
status = g_io_channel_write_chars
(client->channel, buffer->data, buffer->size,
&bytes_written, &error);
@@ -723,6 +730,9 @@ static void client_write_direct(struct client *client,
GIOStatus status;
gsize bytes_written;
+ assert(client != NULL);
+ assert(client->channel != NULL);
+ assert(data != NULL);
assert(length > 0);
assert(g_queue_is_empty(client->deferred_send));