strspn.c 593 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (C) 2002 Manuel Novoa III
  3. * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
  4. *
  5. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. */
  7. #include "_string.h"
  8. #ifdef WANT_WIDE
  9. # define __Wstrspn __wcsspn
  10. # define Wstrspn wcsspn
  11. #else
  12. # define __Wstrspn __strspn
  13. # define Wstrspn strspn
  14. #endif
  15. size_t attribute_hidden __Wstrspn(const Wchar *s1, const Wchar *s2)
  16. {
  17. register const Wchar *s = s1;
  18. register const Wchar *p = s2;
  19. while (*p) {
  20. if (*p++ == *s) {
  21. ++s;
  22. p = s2;
  23. }
  24. }
  25. return s - s1;
  26. }
  27. strong_alias(__Wstrspn,Wstrspn)