From 1343b55ace9a167501b7522f4d5036c665ced36b Mon Sep 17 00:00:00 2001 From: jailbird777 Date: Mon, 27 Nov 2023 17:56:29 -0600 Subject: [PATCH] Add function parameter prototypes Modern clang (16+) requires all function prototypes to have arguments. This affects the old K&R style in librb/src/crypt.c and the 'DCF' declaration --- authd/authd.c | 2 +- ircd/authproc.c | 2 +- ircd/cache.c | 4 ++-- ircd/capability.c | 2 +- ircd/client.c | 2 +- ircd/parse.c | 2 +- ircd/s_conf.c | 2 +- librb/include/rb_dictionary.h | 2 +- librb/src/crypt.c | 23 +++++++---------------- 9 files changed, 16 insertions(+), 25 deletions(-) diff --git a/authd/authd.c b/authd/authd.c index 23ac2a4bb..5e431df23 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -199,7 +199,7 @@ main(int argc, char *argv[]) rb_set_time(); setup_signals(); - authd_option_handlers = rb_dictionary_create("authd options handlers", rb_strcasecmp); + authd_option_handlers = rb_dictionary_create("authd options handlers", (DCF)rb_strcasecmp); init_resolver(); init_providers(); diff --git a/ircd/authproc.c b/ircd/authproc.c index a8a5d0db8..dbc6620d5 100644 --- a/ircd/authproc.c +++ b/ircd/authproc.c @@ -601,7 +601,7 @@ add_dnsbl_entry(const char *host, const char *reason, uint8_t iptype, rb_dlink_l size_t s = 0; if(dnsbl_stats == NULL) - dnsbl_stats = rb_dictionary_create("dnsbl statistics", rb_strcasecmp); + dnsbl_stats = rb_dictionary_create("dnsbl statistics", (DCF)rb_strcasecmp); /* Build a list of comma-separated values for authd. * We don't check for validity - do it elsewhere. diff --git a/ircd/cache.c b/ircd/cache.c index ebf6ccae5..77e5cb6bc 100644 --- a/ircd/cache.c +++ b/ircd/cache.c @@ -68,8 +68,8 @@ init_cache(void) oper_motd = cache_file(ircd_paths[IRCD_PATH_IRCD_OMOTD], "opers.motd", 0); memset(&links_cache_list, 0, sizeof(links_cache_list)); - help_dict_oper = rb_dictionary_create("oper help", rb_strcasecmp); - help_dict_user = rb_dictionary_create("user help", rb_strcasecmp); + help_dict_oper = rb_dictionary_create("oper help", (DCF)rb_strcasecmp); + help_dict_user = rb_dictionary_create("user help", (DCF)rb_strcasecmp); } /* diff --git a/ircd/capability.c b/ircd/capability.c index 710bce106..25d9badf0 100644 --- a/ircd/capability.c +++ b/ircd/capability.c @@ -150,7 +150,7 @@ capability_index_create(const char *name) idx = rb_malloc(sizeof(struct CapabilityIndex)); idx->name = name; - idx->cap_dict = rb_dictionary_create(name, rb_strcasecmp); + idx->cap_dict = rb_dictionary_create(name, (DCF)rb_strcasecmp); idx->highest_bit = 1; rb_dlinkAdd(idx, &idx->node, &capability_indexes); diff --git a/ircd/client.c b/ircd/client.c index 9482b37c5..5a74563d2 100644 --- a/ircd/client.c +++ b/ircd/client.c @@ -120,7 +120,7 @@ init_client(void) rb_event_addish("exit_aborted_clients", exit_aborted_clients, NULL, 1); rb_event_add("flood_recalc", flood_recalc, NULL, 1); - nd_dict = rb_dictionary_create("nickdelay", irccmp); + nd_dict = rb_dictionary_create("nickdelay", (DCF)irccmp); } /* diff --git a/ircd/parse.c b/ircd/parse.c index bef6be15e..89b8aa46b 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -275,7 +275,7 @@ handle_encap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so void clear_hash_parse() { - cmd_dict = rb_dictionary_create("command", rb_strcasecmp); + cmd_dict = rb_dictionary_create("command", (DCF)rb_strcasecmp); } /* mod_add_cmd diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 87f18785c..2c811deb5 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -865,7 +865,7 @@ set_default_conf(void) ConfigFileEntry.hide_opers = 0; if (!alias_dict) - alias_dict = rb_dictionary_create("alias", rb_strcasecmp); + alias_dict = rb_dictionary_create("alias", (DCF)rb_strcasecmp); } /* diff --git a/librb/include/rb_dictionary.h b/librb/include/rb_dictionary.h index 09775f6df..13df23968 100644 --- a/librb/include/rb_dictionary.h +++ b/librb/include/rb_dictionary.h @@ -33,7 +33,7 @@ typedef struct rb_dictionary_iter rb_dictionary_iter; struct rb_dictionary; -typedef int (*DCF)(/* const void *a, const void *b */); +typedef int (*DCF)(const void *a, const void *b); struct rb_dictionary_element { diff --git a/librb/src/crypt.c b/librb/src/crypt.c index d3eb1c9af..440fef153 100644 --- a/librb/src/crypt.c +++ b/librb/src/crypt.c @@ -778,7 +778,7 @@ static void MD5Final (unsigned char [16], MD5_CTX *); */ static void -Encode (unsigned char *output, uint32_t *input, unsigned int len) +Encode(unsigned char *output, uint32_t *input, unsigned int len) { unsigned int i; uint32_t *op = (uint32_t *)output; @@ -793,7 +793,7 @@ Encode (unsigned char *output, uint32_t *input, unsigned int len) */ static void -Decode (uint32_t *output, const unsigned char *input, unsigned int len) +Decode(uint32_t *output, const unsigned char *input, unsigned int len) { unsigned int i; const uint32_t *ip = (const uint32_t *)input; @@ -846,8 +846,7 @@ static unsigned char PADDING[64] = { /* MD5 initialization. Begins an MD5 operation, writing a new context. */ static void -MD5Init (context) - MD5_CTX *context; +MD5Init(MD5_CTX *context) { context->count[0] = context->count[1] = 0; @@ -866,10 +865,7 @@ MD5Init (context) */ static void -MD5Update (context, in, inputLen) - MD5_CTX *context; - const void *in; - unsigned int inputLen; +MD5Update(MD5_CTX *context, const void *in, unsigned int inputLen) { unsigned int i, idx, partLen; const unsigned char *input = in; @@ -909,8 +905,7 @@ MD5Update (context, in, inputLen) */ static void -MD5Pad (context) - MD5_CTX *context; +MD5Pad(MD5_CTX *context) { unsigned char bits[8]; unsigned int idx, padLen; @@ -933,9 +928,7 @@ MD5Pad (context) */ static void -MD5Final (digest, context) - unsigned char digest[16]; - MD5_CTX *context; +MD5Final(unsigned char digest[16], MD5_CTX *context) { /* Do padding. */ MD5Pad (context); @@ -950,9 +943,7 @@ MD5Final (digest, context) /* MD5 basic transformation. Transforms state based on block. */ static void -MD5Transform (state, block) - uint32_t state[4]; - const unsigned char block[64]; +MD5Transform(uint32_t state[4], const unsigned char block[64]) { uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16];