Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.2 KiB

  1. /***
  2. *wcslen.c - contains wcslen() routine
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * wcslen returns the length of a null-terminated wide-character string,
  8. * not including the null wchar_t itself.
  9. *
  10. *Revision History:
  11. * 09-09-91 ETC Created from strlen.c.
  12. * 04-07-92 KRS Updated and ripped out _INTL switches.
  13. * 04-06-93 SKS Replace _CRTAPI* with __cdecl
  14. * 02-07-94 CFW POSIXify.
  15. *
  16. *******************************************************************************/
  17. #ifndef _POSIX_
  18. #include <cruntime.h>
  19. #include <string.h>
  20. /***
  21. *wcslen - return the length of a null-terminated wide-character string
  22. *
  23. *Purpose:
  24. * Finds the length in wchar_t's of the given string, not including
  25. * the final null wchar_t (wide-characters).
  26. *
  27. *Entry:
  28. * const wchar_t * wcs - string whose length is to be computed
  29. *
  30. *Exit:
  31. * length of the string "wcs", exclusive of the final null wchar_t
  32. *
  33. *Exceptions:
  34. *
  35. *******************************************************************************/
  36. size_t __cdecl wcslen (
  37. const wchar_t * wcs
  38. )
  39. {
  40. const wchar_t *eos = wcs;
  41. while( *eos++ ) ;
  42. return( (size_t)(eos - wcs - 1) );
  43. }
  44. #endif /* _POSIX_ */