aboutsummaryrefslogtreecommitdiff
path: root/liberty-proto.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-07-11 17:44:37 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-07-11 17:44:37 +0200
commit7fa873fb964156e71a00174f50e3f4bc343bcc04 (patch)
tree818063aec32e853e93e97370d787e00934311ed0 /liberty-proto.c
parent34569e2b623df164ee965aa508fed274c7c15aaa (diff)
downloadliberty-7fa873fb964156e71a00174f50e3f4bc343bcc04.tar.gz
liberty-7fa873fb964156e71a00174f50e3f4bc343bcc04.tar.xz
liberty-7fa873fb964156e71a00174f50e3f4bc343bcc04.zip
Import stuff from uirc3
Diffstat (limited to 'liberty-proto.c')
-rw-r--r--liberty-proto.c17
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)
{