diff --git a/include/cache.h b/include/cache.h index 33c75bbc..095354d8 100644 --- a/include/cache.h +++ b/include/cache.h @@ -1,6 +1,8 @@ #ifndef INCLUDED_CACHE_H #define INCLUDED_CACHE_H +#include "rb_dictionary.h" + #define HELP_MAX 100 #define CACHEFILELEN 30 @@ -43,8 +45,7 @@ void send_user_motd(struct Client *); void send_oper_motd(struct Client *); void cache_user_motd(void); -struct Dictionary; -extern struct Dictionary *help_dict_oper; -extern struct Dictionary *help_dict_user; +extern rb_dictionary *help_dict_oper; +extern rb_dictionary *help_dict_user; #endif diff --git a/include/capability.h b/include/capability.h index 0030b7e4..76e58c97 100644 --- a/include/capability.h +++ b/include/capability.h @@ -21,9 +21,12 @@ #ifndef __CAPABILITY_H__ #define __CAPABILITY_H__ +#include "stdinc.h" +#include "rb_dictionary.h" + struct CapabilityIndex { const char *name; - struct Dictionary *cap_dict; + rb_dictionary *cap_dict; unsigned int highest_bit; rb_dlink_node node; }; diff --git a/include/hash.h b/include/hash.h index 1a5a66ba..18ba9f88 100644 --- a/include/hash.h +++ b/include/hash.h @@ -25,10 +25,10 @@ #ifndef INCLUDED_hash_h #define INCLUDED_hash_h -struct Dictionary; -struct rb_radixtree; +#include "rb_dictionary.h" +#include "rb_radixtree.h" -extern struct Dictionary *nd_dict; +extern rb_dictionary *nd_dict; extern struct rb_radixtree *resv_tree; extern struct rb_radixtree *channel_tree; diff --git a/include/parse.h b/include/parse.h index a61754f1..a60068dd 100644 --- a/include/parse.h +++ b/include/parse.h @@ -39,7 +39,7 @@ extern void mod_add_cmd(struct Message *msg); extern void mod_del_cmd(struct Message *msg); extern char *reconstruct_parv(int parc, const char *parv[]); -extern struct Dictionary *alias_dict; -extern struct Dictionary *cmd_dict; +extern rb_dictionary *alias_dict; +extern rb_dictionary *cmd_dict; #endif /* INCLUDED_parse_h_h */ diff --git a/ircd/cache.c b/ircd/cache.c index 3b267170..f596dfa5 100644 --- a/ircd/cache.c +++ b/ircd/cache.c @@ -47,8 +47,8 @@ struct cacheline *emptyline = NULL; rb_dlink_list links_cache_list; char user_motd_changed[MAX_DATE_STRING]; -struct Dictionary *help_dict_oper = NULL; -struct Dictionary *help_dict_user = NULL; +rb_dictionary *help_dict_oper = NULL; +rb_dictionary *help_dict_user = NULL; /* init_cache() * @@ -237,7 +237,7 @@ load_help(void) struct dirent *ldirent= NULL; char filename[PATH_MAX]; struct cachefile *cacheptr; - struct DictionaryIter iter; + rb_dictionary_iter iter; #if defined(S_ISLNK) && defined(HAVE_LSTAT) struct stat sb; diff --git a/ircd/capability.c b/ircd/capability.c index e818d919..2eb5c60e 100644 --- a/ircd/capability.c +++ b/ircd/capability.c @@ -129,7 +129,7 @@ capability_require(struct CapabilityIndex *idx, const char *cap) } static void -capability_destroy(struct DictionaryElement *delem, void *privdata) +capability_destroy(rb_dictionary_element *delem, void *privdata) { s_assert(delem != NULL); @@ -165,7 +165,7 @@ capability_index_destroy(struct CapabilityIndex *idx) const char * capability_index_list(struct CapabilityIndex *idx, unsigned int cap_mask) { - struct DictionaryIter iter; + rb_dictionary_iter iter; struct CapabilityEntry *entry; static char buf[BUFSIZE]; char *t = buf; @@ -193,7 +193,7 @@ capability_index_list(struct CapabilityIndex *idx, unsigned int cap_mask) unsigned int capability_index_mask(struct CapabilityIndex *idx) { - struct DictionaryIter iter; + rb_dictionary_iter iter; struct CapabilityEntry *entry; unsigned int mask = 0; @@ -211,7 +211,7 @@ capability_index_mask(struct CapabilityIndex *idx) unsigned int capability_index_get_required(struct CapabilityIndex *idx) { - struct DictionaryIter iter; + rb_dictionary_iter iter; struct CapabilityEntry *entry; unsigned int mask = 0; @@ -235,7 +235,7 @@ capability_index_stats(void (*cb)(const char *line, void *privdata), void *privd RB_DLINK_FOREACH(node, capability_indexes.head) { struct CapabilityIndex *idx = node->data; - struct DictionaryIter iter; + rb_dictionary_iter iter; struct CapabilityEntry *entry; snprintf(buf, sizeof buf, "'%s': allocated bits - %d", idx->name, (idx->highest_bit - 1)); diff --git a/ircd/client.c b/ircd/client.c index 1c8504fe..3ae434f5 100644 --- a/ircd/client.c +++ b/ircd/client.c @@ -79,7 +79,7 @@ static rb_bh *away_heap = NULL; static char current_uid[IDLEN]; static int32_t current_connid = 0; -struct Dictionary *nd_dict = NULL; +rb_dictionary *nd_dict = NULL; enum { diff --git a/ircd/dns.c b/ircd/dns.c index c9d23152..ce3cd6c2 100644 --- a/ircd/dns.c +++ b/ircd/dns.c @@ -58,8 +58,8 @@ struct dnsstatreq }; /* These serve as a form of sparse array */ -static struct Dictionary *query_dict; -static struct Dictionary *stat_dict; +static rb_dictionary *query_dict; +static rb_dictionary *stat_dict; rb_dlink_list nameservers; diff --git a/ircd/hash.c b/ircd/hash.c index 894fe325..fa491375 100644 --- a/ircd/hash.c +++ b/ircd/hash.c @@ -40,8 +40,8 @@ #include "rb_dictionary.h" #include "rb_radixtree.h" -struct Dictionary *client_connid_tree = NULL; -struct Dictionary *client_zconnid_tree = NULL; +rb_dictionary *client_connid_tree = NULL; +rb_dictionary *client_zconnid_tree = NULL; struct rb_radixtree *client_id_tree = NULL; struct rb_radixtree *client_name_tree = NULL; diff --git a/ircd/parse.c b/ircd/parse.c index e26afd13..76a3585d 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -42,8 +42,8 @@ #include "packet.h" #include "s_assert.h" -struct Dictionary *cmd_dict = NULL; -struct Dictionary *alias_dict = NULL; +rb_dictionary *cmd_dict = NULL; +rb_dictionary *alias_dict = NULL; static void cancel_clients(struct Client *, struct Client *); static void remove_unknown(struct Client *, const char *, char *); diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 65023627..ae7675e4 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -1417,7 +1417,7 @@ read_conf_files(bool cold) * free an alias{} entry. */ static void -free_alias_cb(struct DictionaryElement *ptr, void *unused) +free_alias_cb(rb_dictionary_element *ptr, void *unused) { struct alias_entry *aptr = ptr->data; diff --git a/librb/include/rb_dictionary.h b/librb/include/rb_dictionary.h index d27db305..2baf027d 100644 --- a/librb/include/rb_dictionary.h +++ b/librb/include/rb_dictionary.h @@ -27,21 +27,25 @@ #include "librb-config.h" -struct Dictionary; /* defined in src/dictionary.c */ +typedef struct rb_dictionary rb_dictionary; +typedef struct rb_dictionary_element rb_dictionary_element; +typedef struct rb_dictionary_iter rb_dictionary_iter; + +struct rb_dictionary; typedef int (*DCF)(/* const void *a, const void *b */); -struct DictionaryElement +struct rb_dictionary_element { - struct DictionaryElement *left, *right, *prev, *next; + rb_dictionary_element *left, *right, *prev, *next; void *data; const void *key; int position; }; -struct DictionaryIter +struct rb_dictionary_iter { - struct DictionaryElement *cur, *next; + rb_dictionary_element *cur, *next; }; /* @@ -53,33 +57,33 @@ struct DictionaryIter * rb_dictionary_create_named() creates a new dictionary tree which has a name. * name is the name, compare_cb is the comparator. */ -extern struct Dictionary *rb_dictionary_create(const char *name, DCF compare_cb); +extern rb_dictionary *rb_dictionary_create(const char *name, DCF compare_cb); /* * rb_dictionary_set_comparator_func() resets the comparator used for lookups and * insertions in the DTree structure. */ -extern void rb_dictionary_set_comparator_func(struct Dictionary *dict, +extern void rb_dictionary_set_comparator_func(rb_dictionary *dict, DCF compare_cb); /* * rb_dictionary_get_comparator_func() returns the comparator used for lookups and * insertions in the DTree structure. */ -extern DCF rb_dictionary_get_comparator_func(struct Dictionary *dict); +extern DCF rb_dictionary_get_comparator_func(rb_dictionary *dict); /* * rb_dictionary_get_linear_index() returns the linear index of an object in the * DTree structure. */ -extern int rb_dictionary_get_linear_index(struct Dictionary *dict, const void *key); +extern int rb_dictionary_get_linear_index(rb_dictionary *dict, const void *key); /* * rb_dictionary_destroy() destroys all entries in a dtree, and also optionally calls * a defined callback function to destroy any data attached to it. */ -extern void rb_dictionary_destroy(struct Dictionary *dtree, - void (*destroy_cb)(struct DictionaryElement *delem, void *privdata), +extern void rb_dictionary_destroy(rb_dictionary *dtree, + void (*destroy_cb)(rb_dictionary_element *delem, void *privdata), void *privdata); /* @@ -88,8 +92,8 @@ extern void rb_dictionary_destroy(struct Dictionary *dtree, * * To shortcircuit iteration, return non-zero from the callback function. */ -extern void rb_dictionary_foreach(struct Dictionary *dtree, - int (*foreach_cb)(struct DictionaryElement *delem, void *privdata), +extern void rb_dictionary_foreach(rb_dictionary *dtree, + int (*foreach_cb)(rb_dictionary_element *delem, void *privdata), void *privdata); /* @@ -99,8 +103,8 @@ extern void rb_dictionary_foreach(struct Dictionary *dtree, * When the object is found, a non-NULL is returned from the callback, which results * in that object being returned to the user. */ -extern void *rb_dictionary_search(struct Dictionary *dtree, - void *(*foreach_cb)(struct DictionaryElement *delem, void *privdata), +extern void *rb_dictionary_search(rb_dictionary *dtree, + void *(*foreach_cb)(rb_dictionary_element *delem, void *privdata), void *privdata); /* @@ -109,48 +113,48 @@ extern void *rb_dictionary_search(struct Dictionary *dtree, * in progress at a time, it is permitted to remove the current element * of the iteration (but not any other element). */ -extern void rb_dictionary_foreach_start(struct Dictionary *dtree, - struct DictionaryIter *state); +extern void rb_dictionary_foreach_start(rb_dictionary *dtree, + rb_dictionary_iter *state); /* * rb_dictionary_foreach_cur() returns the current element of the iteration, * or NULL if there are no more elements. */ -extern void *rb_dictionary_foreach_cur(struct Dictionary *dtree, - struct DictionaryIter *state); +extern void *rb_dictionary_foreach_cur(rb_dictionary *dtree, + rb_dictionary_iter *state); /* * rb_dictionary_foreach_next() moves to the next element. */ -extern void rb_dictionary_foreach_next(struct Dictionary *dtree, - struct DictionaryIter *state); +extern void rb_dictionary_foreach_next(rb_dictionary *dtree, + rb_dictionary_iter *state); /* * rb_dictionary_add() adds a key->value entry to the dictionary tree. */ -extern struct DictionaryElement *rb_dictionary_add(struct Dictionary *dtree, const void *key, void *data); +extern rb_dictionary_element *rb_dictionary_add(rb_dictionary *dtree, const void *key, void *data); /* - * rb_dictionary_find() returns a struct DictionaryElement container from a dtree for key 'key'. + * rb_dictionary_find() returns a rb_dictionary_element container from a dtree for key 'key'. */ -extern struct DictionaryElement *rb_dictionary_find(struct Dictionary *dtree, const void *key); +extern rb_dictionary_element *rb_dictionary_find(rb_dictionary *dtree, const void *key); /* * rb_dictionary_find() returns data from a dtree for key 'key'. */ -extern void *rb_dictionary_retrieve(struct Dictionary *dtree, const void *key); +extern void *rb_dictionary_retrieve(rb_dictionary *dtree, const void *key); /* * rb_dictionary_delete() deletes a key->value entry from the dictionary tree. */ -extern void *rb_dictionary_delete(struct Dictionary *dtree, const void *key); +extern void *rb_dictionary_delete(rb_dictionary *dtree, const void *key); /* * rb_dictionary_size() returns the number of elements in a dictionary tree. */ -extern unsigned int rb_dictionary_size(struct Dictionary *dtree); +extern unsigned int rb_dictionary_size(rb_dictionary *dtree); -void rb_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata); +void rb_dictionary_stats(rb_dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata); void rb_dictionary_stats_walk(void (*cb)(const char *line, void *privdata), void *privdata); #ifndef _WIN32 diff --git a/librb/src/dictionary.c b/librb/src/dictionary.c index 5bc285da..eeac439f 100644 --- a/librb/src/dictionary.c +++ b/librb/src/dictionary.c @@ -26,10 +26,10 @@ #include #include -struct Dictionary +struct rb_dictionary { DCF compare_cb; - struct DictionaryElement *root, *head, *tail; + rb_dictionary_element *root, *head, *tail; unsigned int count; char *id; unsigned int dirty:1; @@ -55,10 +55,10 @@ static rb_dlink_list dictionary_list = {NULL, NULL, 0}; * - if services runs out of memory and cannot allocate the object, * the program will abort. */ -struct Dictionary *rb_dictionary_create(const char *name, +rb_dictionary *rb_dictionary_create(const char *name, DCF compare_cb) { - struct Dictionary *dtree = (struct Dictionary *) rb_malloc(sizeof(struct Dictionary)); + rb_dictionary *dtree = (rb_dictionary *) rb_malloc(sizeof(rb_dictionary)); dtree->compare_cb = compare_cb; dtree->id = rb_strdup(name); @@ -69,7 +69,7 @@ struct Dictionary *rb_dictionary_create(const char *name, } /* - * rb_dictionary_set_comparator_func(struct Dictionary *dict, + * rb_dictionary_set_comparator_func(rb_dictionary *dict, * DCF compare_cb) * * Resets the comparator function used by the dictionary code for @@ -85,7 +85,7 @@ struct Dictionary *rb_dictionary_create(const char *name, * Side Effects: * - the dictionary comparator function is reset. */ -void rb_dictionary_set_comparator_func(struct Dictionary *dict, +void rb_dictionary_set_comparator_func(rb_dictionary *dict, DCF compare_cb) { lrb_assert(dict != NULL); @@ -95,7 +95,7 @@ void rb_dictionary_set_comparator_func(struct Dictionary *dict, } /* - * rb_dictionary_get_comparator_func(struct Dictionary *dict) + * rb_dictionary_get_comparator_func(rb_dictionary *dict) * * Returns the current comparator function used by the dictionary. * @@ -109,7 +109,7 @@ void rb_dictionary_set_comparator_func(struct Dictionary *dict, * - none */ DCF -rb_dictionary_get_comparator_func(struct Dictionary *dict) +rb_dictionary_get_comparator_func(rb_dictionary *dict) { lrb_assert(dict != NULL); @@ -117,7 +117,7 @@ rb_dictionary_get_comparator_func(struct Dictionary *dict) } /* - * rb_dictionary_get_linear_index(struct Dictionary *dict, + * rb_dictionary_get_linear_index(rb_dictionary *dict, * const void *key) * * Gets a linear index number for key. @@ -133,9 +133,9 @@ rb_dictionary_get_comparator_func(struct Dictionary *dict) * - rebuilds the linear index if the tree is marked as dirty. */ int -rb_dictionary_get_linear_index(struct Dictionary *dict, const void *key) +rb_dictionary_get_linear_index(rb_dictionary *dict, const void *key) { - struct DictionaryElement *elem; + rb_dictionary_element *elem; lrb_assert(dict != NULL); lrb_assert(key != NULL); @@ -148,7 +148,7 @@ rb_dictionary_get_linear_index(struct Dictionary *dict, const void *key) return elem->position; else { - struct DictionaryElement *delem; + rb_dictionary_element *delem; int i; for (delem = dict->head, i = 0; delem != NULL; delem = delem->next, i++) @@ -161,7 +161,7 @@ rb_dictionary_get_linear_index(struct Dictionary *dict, const void *key) } /* - * rb_dictionary_retune(struct Dictionary *dict, const void *key) + * rb_dictionary_retune(rb_dictionary *dict, const void *key) * * Retunes the tree, self-optimizing for the element which belongs to key. * @@ -175,9 +175,9 @@ rb_dictionary_get_linear_index(struct Dictionary *dict, const void *key) * - a new root node is nominated. */ static void -rb_dictionary_retune(struct Dictionary *dict, const void *key) +rb_dictionary_retune(rb_dictionary *dict, const void *key) { - struct DictionaryElement n, *tn, *left, *right, *node; + rb_dictionary_element n, *tn, *left, *right, *node; int ret; lrb_assert(dict != NULL); @@ -253,8 +253,8 @@ rb_dictionary_retune(struct Dictionary *dict, const void *key) } /* - * rb_dictionary_link(struct Dictionary *dict, - * struct DictionaryElement *delem) + * rb_dictionary_link(rb_dictionary *dict, + * rb_dictionary_element *delem) * * Links a dictionary tree element to the dictionary. * @@ -274,8 +274,8 @@ rb_dictionary_retune(struct Dictionary *dict, const void *key) * - a node is linked to the dictionary tree */ static void -rb_dictionary_link(struct Dictionary *dict, - struct DictionaryElement *delem) +rb_dictionary_link(rb_dictionary *dict, + rb_dictionary_element *delem) { lrb_assert(dict != NULL); lrb_assert(delem != NULL); @@ -340,7 +340,7 @@ rb_dictionary_link(struct Dictionary *dict, } /* - * rb_dictionary_unlink_root(struct Dictionary *dict) + * rb_dictionary_unlink_root(rb_dictionary *dict) * * Unlinks the root dictionary tree element from the dictionary. * @@ -354,9 +354,9 @@ rb_dictionary_link(struct Dictionary *dict, * - the root node is unlinked from the dictionary tree */ static void -rb_dictionary_unlink_root(struct Dictionary *dict) +rb_dictionary_unlink_root(rb_dictionary *dict) { - struct DictionaryElement *delem, *nextnode, *parentofnext; + rb_dictionary_element *delem, *nextnode, *parentofnext; dict->dirty = TRUE; @@ -409,7 +409,7 @@ rb_dictionary_unlink_root(struct Dictionary *dict) } /* - * rb_dictionary_destroy(struct Dictionary *dtree, + * rb_dictionary_destroy(rb_dictionary *dtree, * void (*destroy_cb)(dictionary_elem_t *delem, void *privdata), * void *privdata); * @@ -430,11 +430,11 @@ rb_dictionary_unlink_root(struct Dictionary *dict) * - if this is called without a callback, the objects bound to the * DTree will not be destroyed. */ -void rb_dictionary_destroy(struct Dictionary *dtree, - void (*destroy_cb)(struct DictionaryElement *delem, void *privdata), +void rb_dictionary_destroy(rb_dictionary *dtree, + void (*destroy_cb)(rb_dictionary_element *delem, void *privdata), void *privdata) { - struct DictionaryElement *n, *tn; + rb_dictionary_element *n, *tn; lrb_assert(dtree != NULL); @@ -452,7 +452,7 @@ void rb_dictionary_destroy(struct Dictionary *dtree, } /* - * rb_dictionary_foreach(struct Dictionary *dtree, + * rb_dictionary_foreach(rb_dictionary *dtree, * void (*destroy_cb)(dictionary_elem_t *delem, void *privdata), * void *privdata); * @@ -469,18 +469,18 @@ void rb_dictionary_destroy(struct Dictionary *dtree, * Side Effects: * - on success, a dtree is iterated */ -void rb_dictionary_foreach(struct Dictionary *dtree, - int (*foreach_cb)(struct DictionaryElement *delem, void *privdata), +void rb_dictionary_foreach(rb_dictionary *dtree, + int (*foreach_cb)(rb_dictionary_element *delem, void *privdata), void *privdata) { - struct DictionaryElement *n, *tn; + rb_dictionary_element *n, *tn; lrb_assert(dtree != NULL); RB_DLINK_FOREACH_SAFE(n, tn, dtree->head) { /* delem_t is a subclass of node_t. */ - struct DictionaryElement *delem = (struct DictionaryElement *) n; + rb_dictionary_element *delem = (rb_dictionary_element *) n; if (foreach_cb != NULL) (*foreach_cb)(delem, privdata); @@ -488,8 +488,8 @@ void rb_dictionary_foreach(struct Dictionary *dtree, } /* - * rb_dictionary_search(struct Dictionary *dtree, - * void (*destroy_cb)(struct DictionaryElement *delem, void *privdata), + * rb_dictionary_search(rb_dictionary *dtree, + * void (*destroy_cb)(rb_dictionary_element *delem, void *privdata), * void *privdata); * * Searches all entries in a DTree using a custom callback. @@ -506,11 +506,11 @@ void rb_dictionary_foreach(struct Dictionary *dtree, * Side Effects: * - a dtree is iterated until the requested conditions are met */ -void *rb_dictionary_search(struct Dictionary *dtree, - void *(*foreach_cb)(struct DictionaryElement *delem, void *privdata), +void *rb_dictionary_search(rb_dictionary *dtree, + void *(*foreach_cb)(rb_dictionary_element *delem, void *privdata), void *privdata) { - struct DictionaryElement *n, *tn; + rb_dictionary_element *n, *tn; void *ret = NULL; lrb_assert(dtree != NULL); @@ -518,7 +518,7 @@ void *rb_dictionary_search(struct Dictionary *dtree, RB_DLINK_FOREACH_SAFE(n, tn, dtree->head) { /* delem_t is a subclass of node_t. */ - struct DictionaryElement *delem = (struct DictionaryElement *) n; + rb_dictionary_element *delem = (rb_dictionary_element *) n; if (foreach_cb != NULL) ret = (*foreach_cb)(delem, privdata); @@ -531,8 +531,8 @@ void *rb_dictionary_search(struct Dictionary *dtree, } /* - * rb_dictionary_foreach_start(struct Dictionary *dtree, - * struct DictionaryIter *state); + * rb_dictionary_foreach_start(rb_dictionary *dtree, + * rb_dictionary_iter *state); * * Initializes a static DTree iterator. * @@ -546,8 +546,8 @@ void *rb_dictionary_search(struct Dictionary *dtree, * Side Effects: * - the static iterator, &state, is initialized. */ -void rb_dictionary_foreach_start(struct Dictionary *dtree, - struct DictionaryIter *state) +void rb_dictionary_foreach_start(rb_dictionary *dtree, + rb_dictionary_iter *state) { lrb_assert(dtree != NULL); lrb_assert(state != NULL); @@ -568,8 +568,8 @@ void rb_dictionary_foreach_start(struct Dictionary *dtree, } /* - * rb_dictionary_foreach_cur(struct Dictionary *dtree, - * struct DictionaryIter *state); + * rb_dictionary_foreach_cur(rb_dictionary *dtree, + * rb_dictionary_iter *state); * * Returns the data from the current node being iterated by the * static iterator. @@ -584,8 +584,8 @@ void rb_dictionary_foreach_start(struct Dictionary *dtree, * Side Effects: * - none */ -void *rb_dictionary_foreach_cur(struct Dictionary *dtree, - struct DictionaryIter *state) +void *rb_dictionary_foreach_cur(rb_dictionary *dtree, + rb_dictionary_iter *state) { lrb_assert(dtree != NULL); lrb_assert(state != NULL); @@ -594,8 +594,8 @@ void *rb_dictionary_foreach_cur(struct Dictionary *dtree, } /* - * rb_dictionary_foreach_next(struct Dictionary *dtree, - * struct DictionaryIter *state); + * rb_dictionary_foreach_next(rb_dictionary *dtree, + * rb_dictionary_iter *state); * * Advances a static DTree iterator. * @@ -609,8 +609,8 @@ void *rb_dictionary_foreach_cur(struct Dictionary *dtree, * Side Effects: * - the static iterator, &state, is advanced to a new DTree node. */ -void rb_dictionary_foreach_next(struct Dictionary *dtree, - struct DictionaryIter *state) +void rb_dictionary_foreach_next(rb_dictionary *dtree, + rb_dictionary_iter *state) { lrb_assert(dtree != NULL); lrb_assert(state != NULL); @@ -630,7 +630,7 @@ void rb_dictionary_foreach_next(struct Dictionary *dtree, } /* - * rb_dictionary_find(struct Dictionary *dtree, const void *key) + * rb_dictionary_find(rb_dictionary *dtree, const void *key) * * Looks up a DTree node by name. * @@ -645,7 +645,7 @@ void rb_dictionary_foreach_next(struct Dictionary *dtree, * Side Effects: * - none */ -struct DictionaryElement *rb_dictionary_find(struct Dictionary *dict, const void *key) +rb_dictionary_element *rb_dictionary_find(rb_dictionary *dict, const void *key) { lrb_assert(dict != NULL); lrb_assert(key != NULL); @@ -660,7 +660,7 @@ struct DictionaryElement *rb_dictionary_find(struct Dictionary *dict, const void } /* - * rb_dictionary_add(struct Dictionary *dtree, const void *key, void *data) + * rb_dictionary_add(rb_dictionary *dtree, const void *key, void *data) * * Creates a new DTree node and binds data to it. * @@ -676,9 +676,9 @@ struct DictionaryElement *rb_dictionary_find(struct Dictionary *dict, const void * Side Effects: * - data is inserted into the DTree. */ -struct DictionaryElement *rb_dictionary_add(struct Dictionary *dict, const void *key, void *data) +rb_dictionary_element *rb_dictionary_add(rb_dictionary *dict, const void *key, void *data) { - struct DictionaryElement *delem; + rb_dictionary_element *delem; lrb_assert(dict != NULL); lrb_assert(key != NULL); @@ -695,7 +695,7 @@ struct DictionaryElement *rb_dictionary_add(struct Dictionary *dict, const void } /* - * rb_dictionary_delete(struct Dictionary *dtree, const void *key) + * rb_dictionary_delete(rb_dictionary *dtree, const void *key) * * Deletes data from a dictionary tree. * @@ -713,9 +713,9 @@ struct DictionaryElement *rb_dictionary_add(struct Dictionary *dict, const void * Notes: * - the returned data needs to be mowgli_freed/released manually! */ -void *rb_dictionary_delete(struct Dictionary *dtree, const void *key) +void *rb_dictionary_delete(rb_dictionary *dtree, const void *key) { - struct DictionaryElement *delem = rb_dictionary_find(dtree, key); + rb_dictionary_element *delem = rb_dictionary_find(dtree, key); void *data; if (delem == NULL) @@ -730,7 +730,7 @@ void *rb_dictionary_delete(struct Dictionary *dtree, const void *key) } /* - * rb_dictionary_retrieve(struct Dictionary *dtree, const void *key) + * rb_dictionary_retrieve(rb_dictionary *dtree, const void *key) * * Retrieves data from a dictionary. * @@ -745,9 +745,9 @@ void *rb_dictionary_delete(struct Dictionary *dtree, const void *key) * Side Effects: * - none */ -void *rb_dictionary_retrieve(struct Dictionary *dtree, const void *key) +void *rb_dictionary_retrieve(rb_dictionary *dtree, const void *key) { - struct DictionaryElement *delem = rb_dictionary_find(dtree, key); + rb_dictionary_element *delem = rb_dictionary_find(dtree, key); if (delem != NULL) return delem->data; @@ -756,7 +756,7 @@ void *rb_dictionary_retrieve(struct Dictionary *dtree, const void *key) } /* - * rb_dictionary_size(struct Dictionary *dict) + * rb_dictionary_size(rb_dictionary *dict) * * Returns the size of a dictionary. * @@ -769,7 +769,7 @@ void *rb_dictionary_retrieve(struct Dictionary *dtree, const void *key) * Side Effects: * - none */ -unsigned int rb_dictionary_size(struct Dictionary *dict) +unsigned int rb_dictionary_size(rb_dictionary *dict) { lrb_assert(dict != NULL); @@ -778,7 +778,7 @@ unsigned int rb_dictionary_size(struct Dictionary *dict) /* returns the sum of the depths of the subtree rooted in delem at depth depth */ static int -stats_recurse(struct DictionaryElement *delem, int depth, int *pmaxdepth) +stats_recurse(rb_dictionary_element *delem, int depth, int *pmaxdepth) { int result; @@ -793,7 +793,7 @@ stats_recurse(struct DictionaryElement *delem, int depth, int *pmaxdepth) } /* - * rb_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata) + * rb_dictionary_stats(rb_dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata) * * Returns the size of a dictionary. * @@ -808,7 +808,7 @@ stats_recurse(struct DictionaryElement *delem, int depth, int *pmaxdepth) * Side Effects: * - callback called with stats text */ -void rb_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata) +void rb_dictionary_stats(rb_dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata) { char str[256]; int sum, maxdepth; diff --git a/modules/m_cap.c b/modules/m_cap.c index 0ce25ac6..a1dd5b29 100644 --- a/modules/m_cap.c +++ b/modules/m_cap.c @@ -157,7 +157,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags) int buflen = 0; int mlen; struct CapabilityEntry *entry; - struct DictionaryIter iter; + rb_dictionary_iter iter; mlen = snprintf(buf, sizeof buf, ":%s CAP %s %s", me.name, diff --git a/modules/m_stats.c b/modules/m_stats.c index 2602042b..2ab45860 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -285,7 +285,7 @@ static void stats_delay(struct Client *source_p) { struct nd_entry *nd; - struct DictionaryIter iter; + rb_dictionary_iter iter; RB_DICTIONARY_FOREACH(nd, &iter, nd_dict) { @@ -734,7 +734,7 @@ stats_klines(struct Client *source_p) static void stats_messages(struct Client *source_p) { - struct DictionaryIter iter; + rb_dictionary_iter iter; struct Message *msg; struct alias_entry *amsg;