summaryrefslogblamecommitdiff
path: root/portability/memrchr.c
blob: 70547f9e8dfbbcd7037571987b661194a8673836 (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                      
#include <stddef.h>

void *memrchr(const void *m, int c, size_t n)
{
	const unsigned char *s = m;
	c = (unsigned char)c;
	while (n--) if (s[n]==c) return (void *)(s+n);
	return 0;
}