From 92d5506d7fe5036999cca50d6b9b9cce3f29daff Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Mon, 13 Aug 2012 17:53:08 -0400 Subject: simplify output callback by calculating string size automatically --- response.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'response.c') diff --git a/response.c b/response.c index a597ea8..10cc941 100644 --- a/response.c +++ b/response.c @@ -15,7 +15,7 @@ extern GAsyncQueue* stdinQueue; //our queue SignalObject* signalObject; //the signal object which registered the signal id //write output to client -static gssize writeOutput(GPollableOutputStream* stream, gchar* data, gssize size); +static gssize writeOutput(GPollableOutputStream* stream, gchar* data); //callback for client output, this is where the queue messages are sent to the client gboolean cbClientOutput(gpointer data, gpointer additional) @@ -89,9 +89,9 @@ gboolean cbClientInput(gpointer data, gpointer additional) } //write output to client -static gssize writeOutput(GPollableOutputStream* stream, gchar* data, gssize size) +static gssize writeOutput(GPollableOutputStream* stream, gchar* data) { - return g_pollable_output_stream_write_nonblocking(stream, data, size, NULL, NULL); + return g_pollable_output_stream_write_nonblocking(stream, data, strlen(data), NULL, NULL); } //initialize the signals @@ -138,7 +138,7 @@ void responseCb(gpointer instance, GObject *arg1, gpointer user_data) strcat(out, "\n"); } - written = data->cb(stream, out, strlen(out)); + written = data->cb(stream, out); if (written == -1) { g_print("Could not send message to client\n"); } -- cgit