string.c 347 B

123456789101112131415161718192021
  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. #include <stddef.h>
  8. /**
  9. * strlen - Find the length of a string
  10. * @s: The string to be sized
  11. */
  12. size_t test_strlen(const char *s)
  13. {
  14. const char *sc;
  15. for (sc = s; *sc != '\0'; ++sc)
  16. /* nothing */;
  17. return sc - s;
  18. }