From 2e819b6b3e8b5ef6ba8fc77ea2f236c9aa10aaac Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 20 Apr 2008 15:20:10 +0200 Subject: [PATCH] Fix various compiler warnings. --- include/hook.h | 26 +++++++++++++------------- include/irc_dictionary.h | 5 +++++ include/s_conf.h | 6 +++--- include/s_newconf.h | 2 +- src/channel.c | 3 --- src/chmode.c | 8 +------- src/hook.c | 1 + src/irc_dictionary.c | 10 +++++----- src/newconf.c | 2 +- src/reject.c | 2 -- src/res.c | 2 -- src/substitution.c | 1 + 12 files changed, 31 insertions(+), 37 deletions(-) diff --git a/include/hook.h b/include/hook.h index 24da17e7..b1bad117 100644 --- a/include/hook.h +++ b/include/hook.h @@ -15,20 +15,20 @@ typedef struct typedef void (*hookfn) (void *data); -int h_iosend_id; -int h_iorecv_id; -int h_iorecvctrl_id; +extern int h_iosend_id; +extern int h_iorecv_id; +extern int h_iorecvctrl_id; -int h_burst_client; -int h_burst_channel; -int h_burst_finished; -int h_server_introduced; -int h_server_eob; -int h_client_exit; -int h_umode_changed; -int h_new_local_user; -int h_new_remote_user; -int h_introduce_client; +extern int h_burst_client; +extern int h_burst_channel; +extern int h_burst_finished; +extern int h_server_introduced; +extern int h_server_eob; +extern int h_client_exit; +extern int h_umode_changed; +extern int h_new_local_user; +extern int h_new_remote_user; +extern int h_introduce_client; void init_hook(void); int register_hook(const char *name); diff --git a/include/irc_dictionary.h b/include/irc_dictionary.h index 5d762848..69f3babc 100644 --- a/include/irc_dictionary.h +++ b/include/irc_dictionary.h @@ -150,6 +150,11 @@ extern void *irc_dictionary_retrieve(struct Dictionary *dtree, const char *key); */ extern void *irc_dictionary_delete(struct Dictionary *dtree, const char *key); +/* + * irc_dictionary_size() returns the number of elements in a dictionary tree. + */ +extern unsigned int irc_dictionary_size(struct Dictionary *dtree); + void irc_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata); #endif diff --git a/include/s_conf.h b/include/s_conf.h index 16c4987b..72e24eb4 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -303,7 +303,7 @@ extern struct server_info ServerInfo; /* defined in ircd.c */ extern struct admin_info AdminInfo; /* defined in ircd.c */ /* End GLOBAL section */ -rb_dlink_list service_list; +extern rb_dlink_list service_list; typedef enum temp_list { @@ -314,8 +314,8 @@ typedef enum temp_list LAST_TEMP_TYPE } temp_list; -rb_dlink_list temp_klines[LAST_TEMP_TYPE]; -rb_dlink_list temp_dlines[LAST_TEMP_TYPE]; +extern rb_dlink_list temp_klines[LAST_TEMP_TYPE]; +extern rb_dlink_list temp_dlines[LAST_TEMP_TYPE]; extern void init_s_conf(void); diff --git a/include/s_newconf.h b/include/s_newconf.h index 9c6dbdb1..de73d859 100644 --- a/include/s_newconf.h +++ b/include/s_newconf.h @@ -53,7 +53,7 @@ extern rb_dlink_list resv_conf_list; extern rb_dlink_list nd_list; extern rb_dlink_list tgchange_list; -struct _rb_patricia_tree_t *tgchange_tree; +extern struct _rb_patricia_tree_t *tgchange_tree; extern void init_s_newconf(void); extern void clear_s_newconf(void); diff --git a/src/channel.c b/src/channel.c index db8d327e..5909f275 100644 --- a/src/channel.c +++ b/src/channel.c @@ -41,9 +41,6 @@ #include "s_newconf.h" #include "logger.h" -extern rb_dlink_list global_channel_list; - -extern struct config_channel_entry ConfigChannel; extern rb_bh *channel_heap; extern rb_bh *ban_heap; extern rb_bh *topic_heap; diff --git a/src/chmode.c b/src/chmode.c index 82adf8a3..6c3fc36f 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -57,18 +57,12 @@ #define SM_ERR_RPL_Q 0x00000800 #define SM_ERR_RPL_F 0x00001000 -void set_channel_mode(struct Client *, struct Client *, - struct Channel *, struct membership *, int, const char **); - -int add_id(struct Client *source_p, struct Channel *chptr, - const char *banid, rb_dlink_list * list, long mode_type); - static struct ChModeChange mode_changes[BUFSIZE]; static int mode_count; static int mode_limit; static int mask_pos; -int +static int get_channel_access(struct Client *source_p, struct membership *msptr) { if(!MyClient(source_p) || is_chanop(msptr)) diff --git a/src/hook.c b/src/hook.c index 5ef51f0c..79a9a107 100644 --- a/src/hook.c +++ b/src/hook.c @@ -59,6 +59,7 @@ int h_burst_finished; int h_server_introduced; int h_server_eob; int h_client_exit; +int h_umode_changed; int h_new_local_user; int h_new_remote_user; int h_introduce_client; diff --git a/src/irc_dictionary.c b/src/irc_dictionary.c index 9096790c..0de08b6d 100644 --- a/src/irc_dictionary.c +++ b/src/irc_dictionary.c @@ -203,7 +203,7 @@ irc_dictionary_get_linear_index(struct Dictionary *dict, const char *key) * Side Effects: * - a new root node is nominated. */ -void +static void irc_dictionary_retune(struct Dictionary *dict, const char *key) { struct DictionaryElement n, *tn, *left, *right, *node; @@ -302,7 +302,7 @@ irc_dictionary_retune(struct Dictionary *dict, const char *key) * Side Effects: * - a node is linked to the dictionary tree */ -void +static void irc_dictionary_link(struct Dictionary *dict, struct DictionaryElement *delem) { @@ -382,7 +382,7 @@ irc_dictionary_link(struct Dictionary *dict, * Side Effects: * - the root node is unlinked from the dictionary tree */ -void +static void irc_dictionary_unlink_root(struct Dictionary *dict) { struct DictionaryElement *delem, *nextnode, *parentofnext; @@ -644,7 +644,7 @@ void irc_dictionary_foreach_next(struct Dictionary *dtree, if (state->cur == NULL) { - ilog(L_MAIN, "irc_dictionary_foreach_next(): called again after iteration finished on dtree<%p>", dtree); + ilog(L_MAIN, "irc_dictionary_foreach_next(): called again after iteration finished on dtree<%p>", (void *)dtree); return; } @@ -854,7 +854,7 @@ void irc_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, dict->id, dict->count); else snprintf(str, sizeof str, "Dictionary stats for <%p> (%d)", - dict, dict->count); + (void *)dict, dict->count); cb(str, privdata); maxdepth = 0; sum = stats_recurse(dict->root, 0, &maxdepth); diff --git a/src/newconf.c b/src/newconf.c index 5e726846..47f95690 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -1754,7 +1754,7 @@ conf_set_generic_string(void *data, int len, void *location) char **loc = location; char *input = data; - if(len && strlen(input) > len) + if(len && strlen(input) > (unsigned int)len) input[len] = '\0'; rb_free(*loc); diff --git a/src/reject.c b/src/reject.c index 9dacd401..d2422a4c 100644 --- a/src/reject.c +++ b/src/reject.c @@ -46,8 +46,6 @@ struct reject_data uint32_t mask_hashv; }; -static rb_patricia_tree_t *unknown_tree; - static void reject_exit(void *unused) { diff --git a/src/res.c b/src/res.c index 7af69af0..81260c8b 100644 --- a/src/res.c +++ b/src/res.c @@ -99,8 +99,6 @@ static int proc_answer(struct reslist *request, HEADER * header, char *, char *) static struct reslist *find_id(int id); static struct DNSReply *make_dnsreply(struct reslist *request); -extern struct rb_sockaddr_storage irc_nsaddr_list[IRCD_MAXNS]; -extern int irc_nscount; extern char irc_domain[HOSTLEN + 1]; diff --git a/src/substitution.c b/src/substitution.c index e92fae4a..37fc3404 100644 --- a/src/substitution.c +++ b/src/substitution.c @@ -36,6 +36,7 @@ #include "stdinc.h" #include "s_user.h" #include "match.h" +#include "substitution.h" /* * Simple mappings for $foo -> 'bar'.