From d1d70fd5d78af01040983831cbe9aa79f1d56425 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 23 Nov 2000 23:29:32 +0000 Subject: [PATCH] s/enum GInputCondition/int/ - enums aren't supposed to orred together i think.. at least MIPSpro gave warnings about it and it also feels wrong :) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@865 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/common.h | 13 +++++-------- src/core/misc.c | 8 ++++---- src/core/net-nonblock.c | 3 +-- src/core/servers.c | 3 +-- src/irc/dcc/dcc-chat.c | 2 +- src/irc/dcc/dcc-files.c | 2 +- src/perl/perl.c | 2 +- 7 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/common.h b/src/common.h index 762d3dec..460554bb 100644 --- a/src/common.h +++ b/src/common.h @@ -50,17 +50,14 @@ #define g_free_and_null(a) \ if (a) { g_free(a); (a) = NULL; } -typedef enum { - G_INPUT_READ = 1 << 0, - G_INPUT_WRITE = 1 << 1 -} GInputCondition; +#define G_INPUT_READ (1 << 0) +#define G_INPUT_WRITE (1 << 1) -typedef void (*GInputFunction) (void *data, int source, - GInputCondition condition); +typedef void (*GInputFunction) (void *data, int source, int condition); -int g_input_add(int source, GInputCondition condition, +int g_input_add(int source, int condition, GInputFunction function, void *data); -int g_input_add_full(int source, int priority, GInputCondition condition, +int g_input_add_full(int source, int priority, int condition, GInputFunction function, void *data); #define MAX_INT_STRLEN ((sizeof(int) * CHAR_BIT + 2) / 3 + 1) diff --git a/src/core/misc.c b/src/core/misc.c index 80b60871..d57c4881 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -28,7 +28,7 @@ #endif typedef struct { - GInputCondition condition; + int condition; GInputFunction function; void *data; } IRSSI_INPUT_REC; @@ -37,7 +37,7 @@ static int irssi_io_invoke(GIOChannel *source, GIOCondition condition, void *data) { IRSSI_INPUT_REC *rec = data; - GInputCondition icond = (GInputCondition)0; + int icond = 0; if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) { /* error, we have to call the function.. */ @@ -60,7 +60,7 @@ static int irssi_io_invoke(GIOChannel *source, GIOCondition condition, return TRUE; } -int g_input_add_full(int source, int priority, GInputCondition condition, +int g_input_add_full(int source, int priority, int condition, GInputFunction function, void *data) { IRSSI_INPUT_REC *rec; @@ -87,7 +87,7 @@ int g_input_add_full(int source, int priority, GInputCondition condition, return result; } -int g_input_add(int source, GInputCondition condition, +int g_input_add(int source, int condition, GInputFunction function, void *data) { return g_input_add_full(source, G_PRIORITY_DEFAULT, condition, diff --git a/src/core/net-nonblock.c b/src/core/net-nonblock.c index b21dca08..c6342e08 100644 --- a/src/core/net-nonblock.c +++ b/src/core/net-nonblock.c @@ -190,8 +190,7 @@ static void simple_readpipe(SIMPLE_THREAD_REC *rec, int pipe) return; } - rec->tag = g_input_add(handle, - (GInputCondition) (G_INPUT_READ|G_INPUT_WRITE), + rec->tag = g_input_add(handle, G_INPUT_READ | G_INPUT_WRITE, (GInputFunction) simple_init, rec); } diff --git a/src/core/servers.c b/src/core/servers.c index 1cdee751..9ec53902 100644 --- a/src/core/servers.c +++ b/src/core/servers.c @@ -200,8 +200,7 @@ static void server_connect_callback_readpipe(SERVER_REC *server) server->handle = net_sendbuffer_create(handle, 0); server->connect_tag = - g_input_add(handle, - (GInputCondition) (G_INPUT_WRITE|G_INPUT_READ), + g_input_add(handle, G_INPUT_WRITE | G_INPUT_READ, (GInputFunction) server_connect_callback_init, server); signal_emit("server connecting", 2, server, &iprec.ip); diff --git a/src/irc/dcc/dcc-chat.c b/src/irc/dcc/dcc-chat.c index f1f82647..7ebac58c 100644 --- a/src/irc/dcc/dcc-chat.c +++ b/src/irc/dcc/dcc-chat.c @@ -252,7 +252,7 @@ static void dcc_chat_connect(DCC_REC *dcc) source_host_ok ? source_host_ip : NULL); if (dcc->handle != -1) { dcc->tagconn = g_input_add(dcc->handle, - (GInputCondition) (G_INPUT_WRITE|G_INPUT_READ), + G_INPUT_WRITE | G_INPUT_READ, (GInputFunction) sig_chat_connected, dcc); } else { /* error connecting */ diff --git a/src/irc/dcc/dcc-files.c b/src/irc/dcc/dcc-files.c index 166734d5..b5e1a490 100644 --- a/src/irc/dcc/dcc-files.c +++ b/src/irc/dcc/dcc-files.c @@ -199,7 +199,7 @@ static void dcc_get_connect(DCC_REC *dcc) source_host_ok ? source_host_ip : NULL); if (dcc->handle != -1) { dcc->tagconn = g_input_add(dcc->handle, - (GInputCondition) (G_INPUT_WRITE|G_INPUT_READ), + G_INPUT_WRITE | G_INPUT_READ, (GInputFunction) sig_dccget_connected, dcc); } else { /* error connecting */ diff --git a/src/perl/perl.c b/src/perl/perl.c index 699cbcd5..9d31fa11 100644 --- a/src/perl/perl.c +++ b/src/perl/perl.c @@ -488,7 +488,7 @@ int perl_input_add(int source, int condition, rec = g_new(PERL_SOURCE_REC, 1); rec->func = g_strdup_printf("%s::%s", perl_get_package(), func); rec->data = g_strdup(data); - rec->tag = g_input_add(source, (GInputCondition) condition, + rec->tag = g_input_add(source, condition, (GInputFunction) perl_source_event, rec); perl_sources = g_slist_append(perl_sources, rec);