ref: 39c2438cf25b7cc066151b49b2d112a1b9209006
parent: 3bcf1091863844fc22dbbdb70117c883c242dfdf
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu May 30 14:14:49 EDT 2019
Revert "[dev] Add memrchr" This reverts commit a3a90734a04b065b429ab4810068a4f74386272e. Memrchr is a non standard function.
--- a/include/string.h
+++ b/include/string.h
@@ -19,7 +19,6 @@
extern int strncmp(const char *s1, const char *s2, size_t n);
extern size_t strxfrm(char * restrict s1, const char * restrict s2, size_t n);
extern void *memchr(const void *s, int c, size_t n);
-extern void *memrchr(const void *s, int c, size_t n);
extern char *strchr(const char *s, int c);
extern size_t strcspn(const char *s1, const char *s2);
extern char *strpbrk(const char *s1, const char *s2);
--- a/src/libc/string/Makefile
+++ b/src/libc/string/Makefile
@@ -4,7 +4,6 @@
include ../rules.mk
OBJS = memchr.o\
- memrchr.o \
memcmp.o\
memcpy.o\
memmove.o\
--- a/src/libc/string/memrchr.c
+++ /dev/null
@@ -1,13 +1,0 @@
-#include <string.h>
-
-#undef memrchr
-
-void *
-memrchr(const void *s, int c, size_t n)
-{
- unsigned char *p = s;
-
- for (p += n-1; n > 0 && *p != c; --p)
- n--;
- return (n == 0) ? NULL : p;
-}