diff options
Diffstat (limited to 'tools/testing/selftests/powerpc/stringloops/string.c')
-rw-r--r-- | tools/testing/selftests/powerpc/stringloops/string.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/stringloops/string.c b/tools/testing/selftests/powerpc/stringloops/string.c new file mode 100644 index 000000000000..45e7775415c7 --- /dev/null +++ b/tools/testing/selftests/powerpc/stringloops/string.c | |||
@@ -0,0 +1,21 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | /* | ||
3 | * Copied from linux/lib/string.c | ||
4 | * | ||
5 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
6 | */ | ||
7 | |||
8 | #include <stddef.h> | ||
9 | |||
10 | /** | ||
11 | * strlen - Find the length of a string | ||
12 | * @s: The string to be sized | ||
13 | */ | ||
14 | size_t test_strlen(const char *s) | ||
15 | { | ||
16 | const char *sc; | ||
17 | |||
18 | for (sc = s; *sc != '\0'; ++sc) | ||
19 | /* nothing */; | ||
20 | return sc - s; | ||
21 | } | ||