aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver/util.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/libmdsserver/util.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libmdsserver/util.h b/src/libmdsserver/util.h
index b86ffd5..543a1c9 100644
--- a/src/libmdsserver/util.h
+++ b/src/libmdsserver/util.h
@@ -24,6 +24,20 @@
#include <sys/types.h>
+
+#ifndef __USE_GNU
+__attribute__((pure, nonnull))
+static inline void* rawmemchr(const void* str, int chr)
+{
+ intptr_t str_address = (intptr_t)str;
+ void* str_nonconst = (void*)str_address;
+ char* s = str_nonconst;
+ while ((int)*s++ != chr);
+ return s - 1;
+}
+#endif
+
+
/**
* Convert a client ID string into a client ID integer
*