diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Makefile.am | 2 | ||||
-rw-r--r-- | src/core/expandos.c | 8 | ||||
-rw-r--r-- | src/core/memdebug.h | 11 | ||||
-rw-r--r-- | src/core/net-nonblock.c | 6 | ||||
-rw-r--r-- | src/core/net-sendbuffer.c | 2 | ||||
-rw-r--r-- | src/core/network.c | 10 |
6 files changed, 25 insertions, 14 deletions
diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 1c206581..c1e12337 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -36,6 +36,7 @@ libcore_a_SOURCES = \ net-sendbuffer.c \ network.c \ nicklist.c \ + nickmatch-cache.c \ pidwait.c \ queries.c \ rawlog.c \ @@ -81,6 +82,7 @@ noinst_HEADERS = \ network.h \ nick-rec.h \ nicklist.h \ + nickmatch-cache.h \ pidwait.h \ queries.h \ rawlog.h \ diff --git a/src/core/expandos.c b/src/core/expandos.c index a0fd3a28..fe01b8df 100644 --- a/src/core/expandos.c +++ b/src/core/expandos.c @@ -55,6 +55,9 @@ static char *last_sent_msg, *last_sent_msg_body; static char *last_privmsg_from, *last_public_from; static char *sysname, *sysrelease; +#define CHAR_EXPANDOS_COUNT \ + ((int) (sizeof(char_expandos) / sizeof(char_expandos[0]))) + /* Create expando - overrides any existing ones. */ void expando_create(const char *key, EXPANDO_FUNC func, ...) { @@ -207,8 +210,7 @@ void expando_unbind(const char *key, int funccount, SIGNAL_FUNC *funcs) EXPANDO_FUNC expando_find_char(char chr) { - g_return_val_if_fail(chr < sizeof(char_expandos) / - sizeof(char_expandos[0]), NULL); + g_return_val_if_fail(chr < CHAR_EXPANDOS_COUNT, NULL); return char_expandos[(int) chr] == NULL ? NULL : char_expandos[(int) chr]->func; @@ -533,7 +535,7 @@ void expandos_deinit(void) { int n; - for (n = 0; n < sizeof(char_expandos)/sizeof(char_expandos[0]); n++) + for (n = 0; n < CHAR_EXPANDOS_COUNT; n++) g_free_not_null(char_expandos[n]); expando_destroy("sysname", expando_sysname); diff --git a/src/core/memdebug.h b/src/core/memdebug.h index 16534741..49bd3f84 100644 --- a/src/core/memdebug.h +++ b/src/core/memdebug.h @@ -19,15 +19,18 @@ char *ig_dirname(const char *file, int line, const char *fname); #define g_malloc(a) ig_malloc(a, __FILE__, __LINE__) #define g_malloc0(a) ig_malloc0(a, __FILE__, __LINE__) +#define g_free ig_free #define g_realloc(a,b) ig_realloc(a, b, __FILE__, __LINE__) #define g_strdup(a) ig_strdup(a, __FILE__, __LINE__) #define g_strndup(a, b) ig_strndup(a, b, __FILE__, __LINE__) -#define g_strconcat(a...) ig_strconcat(__FILE__, __LINE__, ##a) -#define g_strdup_printf(a, b...) ig_strdup_printf(__FILE__, __LINE__, a, ##b) -#define g_strdup_vprintf(a, b...) ig_strdup_vprintf(__FILE__, __LINE__, a, ##b) -#define g_free ig_free #define g_string_new(a) ig_string_new(__FILE__, __LINE__, a) #define g_string_free(a, b) ig_string_free(__FILE__, __LINE__, a, b) #define g_strjoinv(a,b) ig_strjoinv(__FILE__, __LINE__, a, b) #define g_dirname(a) ig_dirname(__FILE__, __LINE__, a) + +#ifndef __STRICT_ANSI__ +#define g_strconcat(a...) ig_strconcat(__FILE__, __LINE__, ##a) +#define g_strdup_printf(a, b...) ig_strdup_printf(__FILE__, __LINE__, a, ##b) +#define g_strdup_vprintf(a, b...) ig_strdup_vprintf(__FILE__, __LINE__, a, ##b) +#endif #endif diff --git a/src/core/net-nonblock.c b/src/core/net-nonblock.c index f029b14d..2b38e79b 100644 --- a/src/core/net-nonblock.c +++ b/src/core/net-nonblock.c @@ -40,7 +40,8 @@ typedef struct { static int g_io_channel_write_block(GIOChannel *channel, void *data, int len) { - int err, ret, sent; + unsigned int ret; + int err, sent; sent = 0; do { @@ -55,7 +56,8 @@ static int g_io_channel_write_block(GIOChannel *channel, void *data, int len) static int g_io_channel_read_block(GIOChannel *channel, void *data, int len) { time_t maxwait; - int err, ret, received; + unsigned int ret; + int err, received; maxwait = time(NULL)+2; received = 0; diff --git a/src/core/net-sendbuffer.c b/src/core/net-sendbuffer.c index 18870294..eee654dd 100644 --- a/src/core/net-sendbuffer.c +++ b/src/core/net-sendbuffer.c @@ -124,7 +124,7 @@ int net_sendbuffer_send(NET_SENDBUF_REC *rec, const void *data, int size) ret = net_transmit(rec->handle, data, size); if (ret < 0) return -1; size -= ret; - data = ((char *) data) + ret; + data = ((const char *) data) + ret; } if (size <= 0) diff --git a/src/core/network.c b/src/core/network.c index 3377e71e..3cf42013 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -277,7 +277,8 @@ GIOChannel *net_accept(GIOChannel *handle, IPADDR *addr, int *port) /* Read data from socket, return number of bytes read, -1 = error */ int net_receive(GIOChannel *handle, char *buf, int len) { - int ret, err; + unsigned int ret; + int err; g_return_val_if_fail(handle != NULL, -1); g_return_val_if_fail(buf != NULL, -1); @@ -289,13 +290,14 @@ int net_receive(GIOChannel *handle, char *buf, int len) if (err == G_IO_ERROR_AGAIN || (err != 0 && errno == EINTR)) return 0; /* no bytes received */ - return err == 0 ? ret : -1; + return err == 0 ? (int)ret : -1; } /* Transmit data, return number of bytes sent, -1 = error */ int net_transmit(GIOChannel *handle, const char *data, int len) { - int ret, err; + unsigned int ret; + int err; g_return_val_if_fail(handle != NULL, -1); g_return_val_if_fail(data != NULL, -1); @@ -305,7 +307,7 @@ int net_transmit(GIOChannel *handle, const char *data, int len) (err != 0 && (errno == EINTR || errno == EPIPE))) return 0; - return err == 0 ? ret : -1; + return err == 0 ? (int)ret : -1; } /* Get socket address/port */ |