Changeset 35464 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Jan 10, 2011 4:30:27 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 69335
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/strspace.cpp
r33540 r35464 91 91 92 92 while ((c = *pu8++)) 93 hash = c + (hash << 6) + (hash << 16) - hash; 94 95 *pcch = (uintptr_t)pu8 - (uintptr_t)str - 1; 96 return hash; 97 } 98 99 DECLINLINE(uint32_t) sdbmN(const char *str, size_t cchMax, size_t *pcch) 100 { 101 uint8_t *pu8 = (uint8_t *)str; 102 uint32_t hash = 0; 103 int c; 104 105 while ((c = *pu8++) && cchMax-- > 0) 93 106 hash = c + (hash << 6) + (hash << 16) - hash; 94 107 … … 200 213 201 214 215 /** 216 * Gets a string from a unique string space. 217 * 218 * @returns Pointer to the string node. 219 * @returns NULL if the string was not found in the string space. 220 * @param pStrSpace The space to insert it into. 221 * @param pszString The string to get. 222 * @param cchMax The max string length to evaluate. Passing 223 * RTSTR_MAX is ok and makes it behave just like 224 * RTStrSpaceGet. 225 */ 226 RTDECL(PRTSTRSPACECORE) RTStrSpaceGetN(PRTSTRSPACE pStrSpace, const char *pszString, size_t cchMax) 227 { 228 size_t cchString; 229 KAVLKEY Key = sdbmN(pszString, cchMax, &cchString); 230 PRTSTRSPACECORE pCur = KAVL_FN(Get)(pStrSpace, Key); 231 if (!pCur) 232 return NULL; 233 234 /* Linear search. */ 235 for (; pCur; pCur = pCur->pList) 236 if ( pCur->cchString == cchString 237 && !memcmp(pCur->pszString, pszString, cchString)) 238 return pCur; 239 return NULL; 240 } 241 RT_EXPORT_SYMBOL(RTStrSpaceGetN); 242 202 243 203 244 /**
Note:
See TracChangeset
for help on using the changeset viewer.