From bc0a30f0bc58ef1406e595d101b70c067b80ea53 Mon Sep 17 00:00:00 2001 From: Nicholas Piggin Date: Fri, 10 May 2019 14:46:26 +1000 Subject: libfdt: upgrade to upstream dtc.git 243176c Upgrade libfdt/ to github.com/dgibson/dtc.git 243176c ("Fix bogus error on rebuild") This copies dtc/libfdt/ to skiboot/libfdt/, with the only change in that directory being the addition of README.skiboot and Makefile.inc. This adds about 14kB text, 2.5kB compressed xz. This could be reduced or mostly eliminated by cutting out fdt version checks and unused code, but tracking upstream is a bigger benefit at the moment. This loses commits: 14ed2b842f61 ("libfdt: add basic sanity check to fdt_open_into") bc7bb3d12bc1 ("sparse: fix declaration of fdt_strerror") As well as some prehistoric similar kinds of things, which is the punishment for us not being good downstream citizens and sending things upstream! Syncing to upstream will make that effort simpler in future. Signed-off-by: Nicholas Piggin Signed-off-by: Stewart Smith --- libc/test/run-memops-test.c | 7 +++++++ libc/test/run-memops.c | 7 +++++++ 2 files changed, 14 insertions(+) (limited to 'libc/test') diff --git a/libc/test/run-memops-test.c b/libc/test/run-memops-test.c index cb2d7f8..6303b33 100644 --- a/libc/test/run-memops-test.c +++ b/libc/test/run-memops-test.c @@ -32,6 +32,7 @@ #include "../string/strcasecmp.c" #include "../string/strcat.c" #include "../string/strchr.c" +#include "../string/strrchr.c" #include "../string/strcmp.c" #include "../string/strcpy.c" /* #include "../string/strdup.c" */ @@ -48,6 +49,7 @@ int test_memchr(const void *ptr, int c, size_t n, void* expected); int test_memcmp(const void *ptr1, const void *ptr2, size_t n, int expected); int test_strcmp(const void *ptr1, const void *ptr2, int expected); int test_strchr(const char *s, int c, char *expected); +int test_strrchr(const char *s, int c, char *expected); int test_strcasecmp(const char *s1, const char *s2, int expected); int test_strncasecmp(const char *s1, const char *s2, size_t n, int expected); int test_memmove(void *dest, const void *src, size_t n, const void *r, const void *expected, size_t expected_n); @@ -85,6 +87,11 @@ int test_strchr(const char *s, int c, char *expected) return(expected == strchr(s, c)); } +int test_strrchr(const char *s, int c, char *expected) +{ + return(expected == strrchr(s, c)); +} + int test_strcasecmp(const char *s1, const char *s2, int expected) { return(expected == strcasecmp(s1, s2)); diff --git a/libc/test/run-memops.c b/libc/test/run-memops.c index 5c425f2..55912ea 100644 --- a/libc/test/run-memops.c +++ b/libc/test/run-memops.c @@ -26,6 +26,7 @@ int test_memchr(const void *ptr, int c, size_t n, void* expected); int test_memcmp(const void *ptr1, const void *ptr2, size_t n, int expected); int test_strcmp(const void *ptr1, const void *ptr2, int expected); int test_strchr(const char *s, int c, char *expected); +int test_strrchr(const char *s, int c, char *expected); int test_strcasecmp(const char *s1, const char *s2, int expected); int test_strncasecmp(const char *s1, const char *s2, size_t n, int expected); int test_memmove(void *dest, const void *src, size_t n, const void *r, const void *expected, size_t expected_n); @@ -64,6 +65,12 @@ int main(void) assert(test_strchr(buf, 'a', NULL)); assert(test_strchr(buf, '!', buf+11)); + assert(test_strrchr(buf, 'H', buf)); + assert(test_strrchr(buf, 'o', buf+7)); + assert(test_strrchr(buf, 'a', NULL)); + assert(test_strrchr(buf, 'l', buf+9)); + assert(test_strrchr(buf, '!', buf+11)); + assert(test_strcasecmp(buf, "Hello World!", 0)); assert(test_strcasecmp(buf, "HELLO WORLD!", 0)); assert(test_strcasecmp(buf, "IELLO world!", -1)); -- cgit v1.1