source: compat/memrchr.c @ 811644f

release-1.7release-1.8release-1.9
Last change on this file since 811644f was 12a6616, checked in by David Benjamin <davidben@mit.edu>, 11 years ago
Add a compatibility implementation of memrchr It's a GNU extension and not available on Solaris.
  • Property mode set to 100644
File size: 217 bytes
Line 
1#include "compat.h"
2
3void *memrchr(const void *s, int c, size_t n) {
4  int i;
5  const unsigned char *ss = s;
6  for (i = n-1; i >= 0; i--) {
7    if (ss[i] == (unsigned char)c)
8      return ss + i;
9  }
10  return NULL;
11}
Note: See TracBrowser for help on using the repository browser.