[ircd-ratbox] [PATCH] ratbox-services CVS 20050517: gcc 4.1 20050515
Ralf S. Engelschall
rse at engelschall.com
Tue May 17 12:59:48 EDT 2005
The following patch against Ratbox-Services CVS snapshot as of 20050517
fixes a type conflict on an assignment, an initialization warning
(although the code is correct) and removes two nasty conflicts of "void"
pointer vs. function pointer assignment (which is not allowed under
strict ISO-C) by using the usual intermediate "union". This allows
Ratbox-Services to pass GCC 4.1.0 20050515 even under -Wall -pedantic.
Index: src/c_mode.c
--- src/c_mode.c.orig 2005-04-27 23:48:22 +0200
+++ src/c_mode.c 2005-05-17 18:48:16 +0200
@@ -58,7 +58,7 @@
{
static char buf[KEYLEN+1];
u_char *s, c;
- u_char *fix = buf;
+ u_char *fix = (u_char *)buf;
strlcpy(buf, data, sizeof(buf));
Index: src/hook.c
--- src/hook.c.orig 2005-04-07 15:12:33 +0200
+++ src/hook.c 2005-05-17 18:54:48 +0200
@@ -39,15 +39,18 @@
void
hook_add(hook_func func, int hook)
{
+ union { hook_func fp; void *vp; } u;
if(hook >= HOOK_LAST_HOOK)
return;
- dlink_add_tail_alloc(func, &hooks[hook]);
+ u.fp = func;
+ dlink_add_tail_alloc(u.vp, &hooks[hook]);
}
int
hook_call(int hook, void *arg, void *arg2)
{
+ union { hook_func fp; void *vp; } u;
hook_func func;
dlink_node *ptr;
@@ -56,7 +59,8 @@
DLINK_FOREACH(ptr, hooks[hook].head)
{
- func = ptr->data;
+ u.vp = ptr->data;
+ func = u.fp;
if((*func)(arg, arg2) < 0)
return -1;
}
Index: src/io.c
--- src/io.c.orig 2005-05-06 16:45:46 +0200
+++ src/io.c 2005-05-17 18:51:13 +0200
@@ -524,7 +524,7 @@
unsigned long local_ip;
int client_fd;
int port;
- int res;
+ int res = -1;
client_fd = sock_create(AF_INET);
Ralf S. Engelschall
rse at engelschall.com
www.engelschall.com
More information about the ircd-ratbox
mailing list