aboutsummaryrefslogtreecommitdiffstats
path: root/jnlib/stringhelp.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--jnlib/stringhelp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/jnlib/stringhelp.c b/jnlib/stringhelp.c
index 4e2768251..1731dd946 100644
--- a/jnlib/stringhelp.c
+++ b/jnlib/stringhelp.c
@@ -796,3 +796,15 @@ memicmp( const char *a, const char *b, size_t n )
#endif
+#ifndef HAVE_MEMRCHR
+void *
+memrchr (const void *buffer, int c, size_t n)
+{
+ const unsigned char *p = buffer;
+
+ for (p += n; n ; n--)
+ if (*--p == c)
+ return p;
+ return NULL;
+}
+#endif /*HAVE_MEMRCHR*/