Leaked source code of windows server 2003
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.

57 lines
1.4 KiB

  1. /***
  2. *strlen.c - contains strlen() routine
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * strlen returns the length of a null-terminated string,
  8. * not including the null byte itself.
  9. *
  10. *Revision History:
  11. * 05-31-89 JCR C version created.
  12. * 02-27-90 GJF Fixed calling type, #include <cruntime.h>, fixed
  13. * copyright.
  14. * 10-02-90 GJF New-style function declarator.
  15. * 04-01-91 SRW Add #pragma function for i386 _WIN32_ and _CRUISER_
  16. * builds
  17. * 04-05-91 GJF Speed up just a little bit.
  18. * 09-02-93 GJF Replaced _CALLTYPE1 with __cdecl.
  19. * 12-03-93 GJF Turn on #pragma function for all MS front-ends (esp.,
  20. * Alpha compiler).
  21. *
  22. *******************************************************************************/
  23. #include <cruntime.h>
  24. #include <string.h>
  25. #ifdef _MSC_VER
  26. #pragma function(strlen)
  27. #endif
  28. /***
  29. *strlen - return the length of a null-terminated string
  30. *
  31. *Purpose:
  32. * Finds the length in bytes of the given string, not including
  33. * the final null character.
  34. *
  35. *Entry:
  36. * const char * str - string whose length is to be computed
  37. *
  38. *Exit:
  39. * length of the string "str", exclusive of the final null byte
  40. *
  41. *Exceptions:
  42. *
  43. *******************************************************************************/
  44. size_t __cdecl strlen (
  45. const char * str
  46. )
  47. {
  48. const char *eos = str;
  49. while( *eos++ ) ;
  50. return( eos - str - 1 );
  51. }