summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-05-08 23:29:09 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-05-08 23:29:09 +0200
commit1b2fabe4cc87fc80e901893000f05ea671a7b444 (patch)
treebc6592b05553a05f1b5735766b57785aaa088985
parent29db25810244d06cf7729fa3de90d5528f8c2ef3 (diff)
downloadxK-1b2fabe4cc87fc80e901893000f05ea671a7b444.tar.gz
xK-1b2fabe4cc87fc80e901893000f05ea671a7b444.tar.xz
xK-1b2fabe4cc87fc80e901893000f05ea671a7b444.zip
Move code within common.c
-rw-r--r--common.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/common.c b/common.c
index 6006cde..820863d 100644
--- a/common.c
+++ b/common.c
@@ -47,6 +47,29 @@
#define LOG_LIBC_FAILURE(name) \
print_debug ("%s: %s: %s", __func__, (name), strerror (errno))
+// --- To be moved to liberty --------------------------------------------------
+
+static void
+split_str (const char *s, char delimiter, struct str_vector *out)
+{
+ const char *begin = s, *end;
+ while ((end = strchr (begin, delimiter)))
+ {
+ str_vector_add_owned (out, xstrndup (begin, end - begin));
+ begin = ++end;
+ }
+ str_vector_add (out, begin);
+}
+
+static ssize_t
+str_vector_find (const struct str_vector *v, const char *s)
+{
+ for (size_t i = 0; i < v->len; i++)
+ if (!strcmp (v->vector[i], s))
+ return i;
+ return -1;
+}
+
// --- Logging -----------------------------------------------------------------
static void
@@ -473,29 +496,6 @@ fail:
return result;
}
-// --- To be moved to liberty --------------------------------------------------
-
-static void
-split_str (const char *s, char delimiter, struct str_vector *out)
-{
- const char *begin = s, *end;
- while ((end = strchr (begin, delimiter)))
- {
- str_vector_add_owned (out, xstrndup (begin, end - begin));
- begin = ++end;
- }
- str_vector_add (out, begin);
-}
-
-static ssize_t
-str_vector_find (const struct str_vector *v, const char *s)
-{
- for (size_t i = 0; i < v->len; i++)
- if (!strcmp (v->vector[i], s))
- return i;
- return -1;
-}
-
// --- CTCP decoding -----------------------------------------------------------
#define CTCP_M_QUOTE '\020'