strchr.c 625 B

123456789101112131415161718192021222324252627282930313233
  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 __Wstrchr __wcschr
  10. # define Wstrchr wcschr
  11. #else
  12. # define __Wstrchr __strchr
  13. # define Wstrchr strchr
  14. #endif
  15. Wchar attribute_hidden *__Wstrchr(register const Wchar *s, Wint c)
  16. {
  17. do {
  18. if (*s == ((Wchar)c)) {
  19. return (Wchar *) s; /* silence the warning */
  20. }
  21. } while (*s++);
  22. return NULL;
  23. }
  24. strong_alias(__Wstrchr,Wstrchr)
  25. #ifndef WANT_WIDE
  26. strong_alias(__strchr,index)
  27. #endif