scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit f1aa70a21a4b85ef7f90510232de9516638e4255
parent a3a90734a04b065b429ab4810068a4f74386272e
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 30 May 2019 18:14:49 +0100

Revert "[dev] Add memrchr"

This reverts commit a3a90734a04b065b429ab4810068a4f74386272e.
Memrchr is a non standard function.

Diffstat:
Minclude/string.h | 1-
Msrc/libc/string/Makefile | 1-
Dsrc/libc/string/memrchr.c | 13-------------
3 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/include/string.h b/include/string.h @@ -19,7 +19,6 @@ extern int strcoll(const char *s1, const char *s2); 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); diff --git a/src/libc/string/Makefile b/src/libc/string/Makefile @@ -4,7 +4,6 @@ include $(PROJECTDIR)/scripts/rules.mk include ../rules.mk OBJS = memchr.o\ - memrchr.o \ memcmp.o\ memcpy.o\ memmove.o\ diff --git a/src/libc/string/memrchr.c b/src/libc/string/memrchr.c @@ -1,13 +0,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; -}