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.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-11-29 10:27:36 +01:00
parent bdb1e2ec56
commit 4b194d7bc7
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -38,12 +38,11 @@ strchr (char const *s, int c)
int int
main () main ()
{ {
char *p = strchr ("hello", 'l'); char *hello = "hello";
char *p = strchr (hello, 'l');
if (!p) if (!p)
return 1; return 1;
int i = p - "hello"; int i = p - hello;
// int i;
// i = p - "hello";
if (i != 2) if (i != 2)
return i; return i;