aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/utils.c10
-rw-r--r--src/utils.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index 332c73587..f23f8c1fa 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -268,3 +268,13 @@ void xpthread_cond_destroy(pthread_cond_t *cond)
if ((err = pthread_cond_destroy(cond)))
FATAL("failed to destroy cond: %s\n", strerror(err));
}
+
+int prefixcmp(const char *str, const char *prefix)
+{
+ for (; ; str++, prefix++)
+ if (!*prefix)
+ return 0;
+ else if (*str != *prefix)
+ return (unsigned char)*prefix - (unsigned char)*str;
+}
+
diff --git a/src/utils.h b/src/utils.h
index 77e143702..a6e26d191 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -103,4 +103,6 @@ void xpthread_mutex_destroy(pthread_mutex_t *mutex);
void xpthread_cond_destroy(pthread_cond_t *cond);
+int prefixcmp(const char *str, const char *prefix);
+
#endif