diff options
| author | Marcel Holtmann <marcel@holtmann.org> | 2006-06-06 00:22:54 +0000 | 
|---|---|---|
| committer | Marcel Holtmann <marcel@holtmann.org> | 2006-06-06 00:22:54 +0000 | 
| commit | 6370466ffd8daab036ed507ac6a99c27e3140c2e (patch) | |
| tree | 8849d4908fbe715e39e450537748e2f33bc49d83 | |
| parent | 48911619f75e2809b145c0bd5cd60cb80b1c1b69 (diff) | |
Use GSourceFunc function type
| -rw-r--r-- | common/glib-ectomy.c | 9 | ||||
| -rw-r--r-- | common/glib-ectomy.h | 7 | 
2 files changed, 7 insertions, 9 deletions
| diff --git a/common/glib-ectomy.c b/common/glib-ectomy.c index d78b6172..d5d4a611 100644 --- a/common/glib-ectomy.c +++ b/common/glib-ectomy.c @@ -171,7 +171,6 @@ static void timeout_free(void *data, void *user_data)  static GMainContext *g_main_context_default()  { -  	if (default_context)  		return default_context; @@ -249,7 +248,7 @@ static void timeout_handlers_check(GMainContext *context)  			 tv.tv_usec < t->expiration.tv_usec))  			continue; -		if (t->func(t->data)) { +		if (t->function(t->data)) {  			/* if false/expired: remove it from the list */  			context->ltimeout = slist_remove(context->ltimeout, t);  			free(t); @@ -345,14 +344,14 @@ void g_main_loop_unref(GMainLoop *loop)  	free(loop->context);  } -guint g_timeout_add(guint interval, timeout_func_t *func, void *data) +guint g_timeout_add(guint interval, GSourceFunc function, void *data)  {  	struct timeval tv;  	guint secs;  	guint msecs;  	struct timeout *t; -	if (!default_context || !func) +	if (!default_context || !function)  		return 0;  	t = malloc(sizeof(*t)); @@ -361,7 +360,7 @@ guint g_timeout_add(guint interval, timeout_func_t *func, void *data)  		return 0;  	t->interval = interval; -	t->func = func; +	t->function = function;  	t->data = data;  	gettimeofday(&tv, NULL); diff --git a/common/glib-ectomy.h b/common/glib-ectomy.h index 56dac08b..18525f78 100644 --- a/common/glib-ectomy.h +++ b/common/glib-ectomy.h @@ -34,7 +34,7 @@ typedef struct _GIOChannel {  	int fd;  } GIOChannel; -typedef int (timeout_func_t)(void *data); +typedef gboolean (*GSourceFunc) (gpointer data);  typedef struct {  	glong tv_sec; @@ -46,7 +46,7 @@ struct timeout {  	guint interval;  	time_val_t expiration;  	void *data; -	timeout_func_t *func; +	GSourceFunc function;  };  typedef struct _GMainContext { @@ -110,10 +110,9 @@ GMainLoop *g_main_loop_new(GMainContext *context, gboolean is_running);  void g_main_loop_run(GMainLoop *loop);  void g_main_loop_quit(GMainLoop *loop);  void g_main_loop_unref(GMainLoop *loop); -guint g_timeout_add(guint interval, timeout_func_t *func, void *data); +guint g_timeout_add(guint interval, GSourceFunc function, void *data);  gint g_timeout_remove(const guint id); -  #define g_main_new(is_running)	g_main_loop_new(NULL, is_running);  #define g_main_run(loop)	g_main_loop_run(loop)  #define g_main_quit(loop)	g_main_loop_quit(loop) | 
