aboutsummaryrefslogtreecommitdiffstats
path: root/memory/memchr.c
blob: 61c10e318f6219a60dccfdb7c12819c07b0506d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
#include "memory.h"

void *memchr(void const *buf, int value, size_t size)
{
	unsigned char const *buffer = buf;
	for (size_t i = 0; i < size; i++)
		if (buffer[i] == (unsigned char)value)
			return (void *)&buffer[i];
	return NULL;
}