diff options
Diffstat (limited to 'liberty-proto.c')
-rw-r--r-- | liberty-proto.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/liberty-proto.c b/liberty-proto.c index c2ea64c..1b5d53f 100644 --- a/liberty-proto.c +++ b/liberty-proto.c @@ -66,7 +66,7 @@ irc_parse_message_tags (const char *tags, struct str_map *out) { struct str_vector v; str_vector_init (&v); - split_str_ignore_empty (tags, ';', &v); + cstr_split_ignore_empty (tags, ';', &v); for (size_t i = 0; i < v.len; i++) { @@ -191,15 +191,18 @@ irc_tolower (int c) return c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c; } -static size_t -irc_strxfrm (char *dest, const char *src, size_t n) +static int +irc_tolower_strict (int c) { - size_t len = strlen (src); - while (n-- && (*dest++ = irc_tolower (*src++))) - ; - return len; + if (c == '[') return '{'; + if (c == ']') return '}'; + if (c == '\\') return '|'; + return c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c; } +TRIVIAL_STRXFRM (irc_strxfrm, irc_tolower) +TRIVIAL_STRXFRM (irc_strxfrm_strict, irc_tolower_strict) + static int irc_strcmp (const char *a, const char *b) { |