aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver/util.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-18 08:57:51 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-18 08:57:51 +0200
commit9b72a7e795d74e4dceec516d592609de12b69e85 (patch)
tree899f5a0a6e455969ab367caf76205e25c87c39f9 /src/libmdsserver/util.h
parentm (diff)
downloadmds-9b72a7e795d74e4dceec516d592609de12b69e85.tar.gz
mds-9b72a7e795d74e4dceec516d592609de12b69e85.tar.bz2
mds-9b72a7e795d74e4dceec516d592609de12b69e85.tar.xz
reduce code complexity
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libmdsserver/util.h')
-rw-r--r--src/libmdsserver/util.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libmdsserver/util.h b/src/libmdsserver/util.h
index da2cb9f..1b533bb 100644
--- a/src/libmdsserver/util.h
+++ b/src/libmdsserver/util.h
@@ -92,6 +92,18 @@ int full_write(int fd, const char* buffer, size_t length);
*/
char* full_read(int fd);
+/**
+ * Check whether a string begins with a specific string,
+ * where neither of the strings are necessarily NUL-terminated
+ *
+ * @param haystack The string that should start with the other string
+ * @param needle The string the first string should start with
+ * @param haystack_n The length of `haystack`
+ * @param needle_n The length of `needle`
+ * @return Whether the `haystack` begins with `needle`
+ */
+int startswith_n(const char* haystack, const char* needle, size_t haystack_n, size_t needle_n) __attribute__((pure));
+
#endif