}
#endif
-#ifndef __HAVE_ARCH_MEMSCAN
-/**
- * memscan - Find a character in an area of memory.
- * @addr: The memory area
- * @c: The byte to search for
- * @size: The size of the area.
- *
- * returns the address of the first occurrence of @c, or 1 byte past
- * the area if @c is not found
- */
-void * memscan(void * addr, int c, size_t size)
-{
- unsigned char * p = (unsigned char *) addr;
-
- while (size) {
- if (*p == c)
- return (void *) p;
- p++;
- size--;
- }
- return (void *) p;
-}
-#endif
-
#ifndef __HAVE_ARCH_STRSTR
/**
* strstr - Find the first substring in a %NUL terminated string
void *(memchr)(const void *s, int c, size_t n)
{
const unsigned char *p = s;
- while (n-- != 0) {
- if ((unsigned char)c == *p++) {
- return (void *)(p-1);
- }
- }
+
+ while (n--)
+ if ((unsigned char)c == *p++)
+ return (void *)(p - 1);
+
return NULL;
}
-
#endif
/*
#define memmove(d, s, n) __builtin_memmove(d, s, n)
#endif
-#ifndef __HAVE_ARCH_MEMSCAN
-void *memscan(void *, int, size_t);
-#endif
-
#ifndef __HAVE_ARCH_MEMCMP
int memcmp(const void *, const void *, size_t);
#define memcmp(s1, s2, n) __builtin_memcmp(s1, s2, n)