From 4b194d7bc7079fd2d132776265e3d4fc38e8de60 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Sun, 29 Nov 2020 10:27:36 +0100 Subject: [PATCH] tests: 70-strchr.c: Rewrite for TinyCC. * lib/tests/string/70-strchr.c (main): Use char* hello for comparison. Allows for duplication of "hello" string. --- lib/tests/string/70-strchr.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/tests/string/70-strchr.c b/lib/tests/string/70-strchr.c index 5275e533..34a91eca 100644 --- a/lib/tests/string/70-strchr.c +++ b/lib/tests/string/70-strchr.c @@ -38,12 +38,11 @@ strchr (char const *s, int c) int main () { - char *p = strchr ("hello", 'l'); + char *hello = "hello"; + char *p = strchr (hello, 'l'); if (!p) return 1; - int i = p - "hello"; - // int i; - // i = p - "hello"; + int i = p - hello; if (i != 2) return i;