diff options
Diffstat (limited to 'cgit/cgit.h')
| -rw-r--r-- | cgit/cgit.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cgit/cgit.h b/cgit/cgit.h index b7b95e0f08..b712135196 100644 --- a/cgit/cgit.h +++ b/cgit/cgit.h @@ -35,6 +35,21 @@ #undef isgraph #define isgraph(x) (isprint((x)) && !isspace((x))) +/* memrchr is a GNU extension, not available on macOS/BSD */ +#ifndef HAVE_MEMRCHR +#if !defined(__GLIBC__) && !defined(__linux__) +static inline void *memrchr(const void *s, int c, size_t n) +{ + const unsigned char *p = (const unsigned char *)s + n; + while (n--) { + if (*--p == (unsigned char)c) + return (void *)p; + } + return NULL; +} +#endif +#endif + /* * Limits used for relative dates |
