*/
#include "stdinc.h"
-#include "sprintf_irc.h"
-#include "irc_string.h"
+#include "match.h"
#include "client.h"
#include "setup.h"
#include "irc_dictionary.h"
dtree->compare_cb = compare_cb;
if (!elem_heap)
- elem_heap = rb_bh_create(sizeof(struct DictionaryElement), 1024);
+ elem_heap = rb_bh_create(sizeof(struct DictionaryElement), 1024, "dictionary_elem_heap");
return dtree;
}
dtree->id = rb_strdup(name);
if (!elem_heap)
- elem_heap = rb_bh_create(sizeof(struct DictionaryElement), 1024);
+ elem_heap = rb_bh_create(sizeof(struct DictionaryElement), 1024, "dictionary_elem_heap");
return dtree;
}
* 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;
* Side Effects:
* - a node is linked to the dictionary tree
*/
-void
+static void
irc_dictionary_link(struct Dictionary *dict,
struct DictionaryElement *delem)
{
* 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;
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;
}
* Side Effects:
* - data is inserted into the DTree.
*/
-struct DictionaryElement *irc_dictionary_add(struct Dictionary *dict, char *key, void *data)
+struct DictionaryElement *irc_dictionary_add(struct Dictionary *dict, const char *key, void *data)
{
struct DictionaryElement *delem;
s_assert(dict != NULL);
if (dict->id != NULL)
- snprintf(str, sizeof str, "Dictionary stats for %s (%d)",
+ rb_snprintf(str, sizeof str, "Dictionary stats for %s (%d)",
dict->id, dict->count);
else
- snprintf(str, sizeof str, "Dictionary stats for <%p> (%d)",
- dict, dict->count);
+ rb_snprintf(str, sizeof str, "Dictionary stats for <%p> (%d)",
+ (void *)dict, dict->count);
cb(str, privdata);
maxdepth = 0;
sum = stats_recurse(dict->root, 0, &maxdepth);
- snprintf(str, sizeof str, "Depth sum %d Avg depth %d Max depth %d", sum, sum / dict->count, maxdepth);
+ rb_snprintf(str, sizeof str, "Depth sum %d Avg depth %d Max depth %d", sum, sum / dict->count, maxdepth);
cb(str, privdata);
return;
}