From db891ac3ca9a94d06bc30d0ee83dfbc6154b8f44 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 9 Jan 2016 01:00:55 -0600 Subject: [PATCH] ircd: irc_radixtree: add irc_radixtree_irccasecanon and irc_radixtree_strcasecanon helpers --- include/irc_radixtree.h | 3 +++ ircd/irc_radixtree.c | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/include/irc_radixtree.h b/include/irc_radixtree.h index ddc88ace..a2b59078 100644 --- a/include/irc_radixtree.h +++ b/include/irc_radixtree.h @@ -138,4 +138,7 @@ unsigned int irc_radixtree_size(struct irc_radixtree *dict); void irc_radixtree_stats(struct irc_radixtree *dict, void (*cb)(const char *line, void *privdata), void *privdata); void irc_radixtree_stats_walk(void (*cb)(const char *line, void *privdata), void *privdata); +void irc_radixtree_strcasecanon(char *key); +void irc_radixtree_irccasecanon(char *key); + #endif diff --git a/ircd/irc_radixtree.c b/ircd/irc_radixtree.c index 7fc00525..ace9ad61 100644 --- a/ircd/irc_radixtree.c +++ b/ircd/irc_radixtree.c @@ -34,6 +34,7 @@ #include "stdinc.h" #include "s_assert.h" +#include "match.h" #include "irc_radixtree.h" rb_dlink_list radixtree_list = {NULL, NULL, 0}; @@ -1056,3 +1057,24 @@ irc_radixtree_stats_walk(void (*cb)(const char *line, void *privdata), void *pri irc_radixtree_stats(ptr->data, cb, privdata); } } + +void irc_radixtree_irccasecanon(char *str) +{ + while (*str) + { + *str = ToUpper(*str); + str++; + } + return; +} + +void irc_radixtree_strcasecanon(char *str) +{ + while (*str) + { + *str = toupper((unsigned char)*str); + str++; + } + return; +} +