summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--generic/tclHash.c10
-rw-r--r--generic/tclLiteral.c6
3 files changed, 9 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 125a461..d89d30f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2004-03-30 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * generic/tclHash.c (HashStringKey): Cleaned up. This function is
+ not faster, but it is a little bit clearer.
+ * generic/tclLiteral.c (HashString): Applied logic from HashObjKey.
* generic/tclObj.c (HashObjKey): Rewrote to fix fault which hashed
every single-character object to the same hash bucket. The new
code is shorter, simpler, clearer, and (happily) faster.
diff --git a/generic/tclHash.c b/generic/tclHash.c
index 3d8fd00..99502b3 100644
--- a/generic/tclHash.c
+++ b/generic/tclHash.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclHash.c,v 1.16 2003/12/24 04:18:19 davygrvy Exp $
+ * RCS: @(#) $Id: tclHash.c,v 1.17 2004/03/30 22:27:49 dkf Exp $
*/
#include "tclInt.h"
@@ -1047,13 +1047,9 @@ HashStringKey(tablePtr, keyPtr)
*/
result = 0;
- while (1) {
- c = *string;
- if (c == 0) {
- break;
- }
+
+ for (c=*string++ ; c ; c=*string++) {
result += (result<<3) + c;
- string++;
}
return result;
}
diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c
index d5d354f..de41e64 100644
--- a/generic/tclLiteral.c
+++ b/generic/tclLiteral.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclLiteral.c,v 1.12 2003/12/24 04:18:20 davygrvy Exp $
+ * RCS: @(#) $Id: tclLiteral.c,v 1.13 2004/03/30 22:27:49 dkf Exp $
*/
#include "tclInt.h"
@@ -789,8 +789,8 @@ HashString(bytes, length)
*/
result = 0;
- for (i = 0; i < length; i++) {
- result += (result<<3) + *bytes++;
+ for (i=0 ; i<length ; i++) {
+ result += (result<<3) + bytes[i];
}
return result;
}