Bug 46711. Removed nsAutoString travisty from nsStringKey. Introduced nsCStringKey. Made them both share the underlying string when possible. r=waterson

git-svn-id: svn://10.0.0.236/trunk@75975 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
warren%netscape.com
2000-08-10 06:19:37 +00:00
parent 0a2d2db689
commit e5706a7236
90 changed files with 739 additions and 892 deletions

View File

@@ -780,25 +780,10 @@ CBufDescriptor::CBufDescriptor(const PRUnichar* aString,PRBool aStackBased,PRUin
PRUint32
nsStr::HashCode(const nsStr& aDest)
{
if (aDest.mCharSize == eTwoByte) {
PRUint32 h;
PRUint32 n = aDest.mLength;
PRUint32 m;
const PRUnichar* c;
h = 0;
c = aDest.mUStr;
if (n < 16) { /* Hash every char in a short string. */
for(; n; c++, n--)
h = (h >> 28) ^ (h << 4) ^ *c;
}
else { /* Sample a la java.lang.String.hash(). */
for(m = n / 8; n >= m; c += m, n -= m)
h = (h >> 28) ^ (h << 4) ^ *c;
}
return h;
}
return (PRUint32)PL_HashString((const void*) aDest.mStr);
if (aDest.mCharSize == eTwoByte)
return nsCRT::HashCode(aDest.mUStr, aDest.mLength);
else
return nsCRT::HashCode(aDest.mStr, aDest.mLength);
}
#ifdef NS_STR_STATS