Changeset 95814 in vbox for trunk/src/VBox
- Timestamp:
- Jul 25, 2022 1:25:01 PM (2 years ago)
- Location:
- trunk/src/VBox/Runtime/common/string
- Files:
-
- 2 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/strcspn.cpp
r95811 r95814 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - strpbrk().3 * IPRT - CRT Strings, strcspn(). 4 4 */ 5 5 … … 33 33 34 34 /** 35 * Find the first occurrence of a character in pszChars in pszStr. 36 * 37 * @returns 35 * strpbrk with a offset return instead of a pointer. 38 36 */ 39 #ifdef IPRT_NO_CRT 40 char *strpbrk(const char *pszStr, const char *pszBreakChars) 41 #elif defined(_MSC_VER) 42 # if _MSC_VER >= 1400 43 _CRTIMP __checkReturn _CONST_RETURN char * __cdecl strpbrk(__in_z const char *pszStr, __in_z const char *pszBreakChars) 44 # else 45 _CRTIMP char * __cdecl strpbrk(const char *pszStr, const char *pszBreakChars) 46 # endif 47 #elif defined(__WATCOMC__) 48 _WCRTLINK char *std::strpbrk(const char *pszStr, const char *pszBreakChars) 49 #else 50 char *strpbrk(const char *pszStr, const char *pszBreakChars) 51 # if defined(__THROW) && !defined(RT_OS_WINDOWS) && !defined(RT_OS_OS2) 52 __THROW 53 # endif 54 #endif 37 size_t strcspn(const char *pszString, const char *pszBreakChars) 55 38 { 56 int chCur; 57 while ((chCur = *pszStr++) != '\0') 39 const char * const pszStringStart = pszString; 40 int chCur; 41 while ((chCur = *pszString++) != '\0') 58 42 { 59 int chBreak;60 const char *psz = pszBreakChars;43 int chBreak; 44 const char *psz = pszBreakChars; 61 45 while ((chBreak = *psz++) != '\0') 62 46 if (chBreak == chCur) 63 return ( char *)(pszStr -1);47 return (size_t)(pszString - pszStringStart + 1); 64 48 65 49 } 66 return NULL;50 return (size_t)(pszString - pszStringStart); 67 51 } 68 52
Note:
See TracChangeset
for help on using the changeset viewer.