From 2e302748962425d96300f32ec1c0739b6c9aaff1 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 1 Nov 2010 02:07:23 +0100 Subject: [PATCH] Use return value of result function to indicate to proceed or not --- gweb/gweb.h | 2 +- tools/web-test.c | 4 +++- tools/wispr.c | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gweb/gweb.h b/gweb/gweb.h index c07e00d..df947e0 100644 --- a/gweb/gweb.h +++ b/gweb/gweb.h @@ -42,7 +42,7 @@ typedef enum { G_WEB_METHOD_GET, } GWebMethod; -typedef void (*GWebResultFunc)(GWebResult *result, gpointer user_data); +typedef gboolean (*GWebResultFunc)(GWebResult *result, gpointer user_data); typedef void (*GWebDebugFunc)(const char *str, gpointer user_data); diff --git a/tools/web-test.c b/tools/web-test.c index c148c91..5a320ec 100644 --- a/tools/web-test.c +++ b/tools/web-test.c @@ -43,7 +43,7 @@ static void sig_term(int sig) g_main_loop_quit(main_loop); } -static void web_result(GWebResult *result, gpointer user_data) +static gboolean web_result(GWebResult *result, gpointer user_data) { guint16 status; gdouble elapsed; @@ -57,6 +57,8 @@ static void web_result(GWebResult *result, gpointer user_data) g_print("status: %03u\n", status); g_main_loop_quit(main_loop); + + return FALSE; } static gboolean option_debug = FALSE; diff --git a/tools/wispr.c b/tools/wispr.c index 1492e6b..fc1fe90 100644 --- a/tools/wispr.c +++ b/tools/wispr.c @@ -240,7 +240,7 @@ static void parser_callback(const char *str, gpointer user_data) static guint request_id; static GWebParser *request_parser; -static void web_result(GWebResult *result, gpointer user_data) +static gboolean web_result(GWebResult *result, gpointer user_data) { const guint8 *chunk; gsize length; @@ -256,7 +256,7 @@ static void web_result(GWebResult *result, gpointer user_data) if (length > 0) { //printf("%s\n", (char *) chunk); g_web_parser_feed_data(request_parser, chunk, length); - return; + return TRUE; } g_web_parser_end_data(request_parser); @@ -269,6 +269,8 @@ done: g_print("elapse: %f seconds\n", elapsed); g_main_loop_quit(main_loop); + + return FALSE; } static gboolean option_debug = FALSE; -- 2.7.4