strcspn.c 631 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 __Wstrcspn __wcscspn
  10. # define Wstrcspn wcscspn
  11. #else
  12. # define __Wstrcspn __strcspn
  13. # define Wstrcspn strcspn
  14. #endif
  15. size_t attribute_hidden __Wstrcspn(const Wchar *s1, const Wchar *s2)
  16. {
  17. register const Wchar *s;
  18. register const Wchar *p;
  19. for ( s=s1 ; *s ; s++ ) {
  20. for ( p=s2 ; *p ; p++ ) {
  21. if (*p == *s) goto done;
  22. }
  23. }
  24. done:
  25. return s - s1;
  26. }
  27. strong_alias(__Wstrcspn,Wstrcspn)