summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-07-12 14:40:12 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-07-12 14:40:12 (GMT)
commite5fd8b4eb2d091baf4f9985ec32a51ba6a5614a1 (patch)
tree8160d7f7f3f65ca19b5b22fd16ce872dcc7d0da2
parent483ddea557a1ba591e0e1fe489ff8fc6a8dab073 (diff)
parent800148e0621ab1e28457aa915d37dd5c36c1ba77 (diff)
downloadtcl-e5fd8b4eb2d091baf4f9985ec32a51ba6a5614a1.zip
tcl-e5fd8b4eb2d091baf4f9985ec32a51ba6a5614a1.tar.gz
tcl-e5fd8b4eb2d091baf4f9985ec32a51ba6a5614a1.tar.bz2
Merge trunk
-rw-r--r--doc/Hash.32
-rw-r--r--generic/tcl.h6
-rw-r--r--generic/tclCmdAH.c7
-rw-r--r--generic/tclCompile.h2
-rw-r--r--generic/tclHash.c12
-rw-r--r--generic/tclInt.h2
-rw-r--r--generic/tclLiteral.c14
-rw-r--r--generic/tclObj.c8
8 files changed, 31 insertions, 22 deletions
diff --git a/doc/Hash.3 b/doc/Hash.3
index 4dc3623..aa79b86 100644
--- a/doc/Hash.3
+++ b/doc/Hash.3
@@ -281,7 +281,7 @@ The \fIhashKeyProc\fR member contains the address of a function called to
calculate a hash value for the key.
.PP
.CS
-typedef unsigned int \fBTcl_HashKeyProc\fR(
+typedef TCL_HASH_TYPE \fBTcl_HashKeyProc\fR(
Tcl_HashTable *\fItablePtr\fR,
void *\fIkeyPtr\fR);
.CE
diff --git a/generic/tcl.h b/generic/tcl.h
index aaef7c6..a8f4dd1 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -936,11 +936,15 @@ typedef struct Tcl_DString {
* Forward declarations of Tcl_HashTable and related types.
*/
+#ifndef TCL_HASH_TYPE
+# define TCL_HASH_TYPE unsigned
+#endif
+
typedef struct Tcl_HashKeyType Tcl_HashKeyType;
typedef struct Tcl_HashTable Tcl_HashTable;
typedef struct Tcl_HashEntry Tcl_HashEntry;
-typedef unsigned (Tcl_HashKeyProc) (Tcl_HashTable *tablePtr, void *keyPtr);
+typedef TCL_HASH_TYPE (Tcl_HashKeyProc) (Tcl_HashTable *tablePtr, void *keyPtr);
typedef int (Tcl_CompareHashKeysProc) (void *keyPtr, Tcl_HashEntry *hPtr);
typedef Tcl_HashEntry * (Tcl_AllocHashEntryProc) (Tcl_HashTable *tablePtr,
void *keyPtr);
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index a834278..eebc63b 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -1460,14 +1460,19 @@ FileAttrIsOwnedCmd(
int objc,
Tcl_Obj *const objv[])
{
+#ifdef __CYGWIN__
+#define geteuid() (short)(geteuid)()
+#endif
+#if !defined(_WIN32)
Tcl_StatBuf buf;
+#endif
int value = 0;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
return TCL_ERROR;
}
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
value = TclWinFileOwned(objv[1]);
#else
if (GetStatBuf(NULL, objv[1], Tcl_FSStat, &buf) == TCL_OK) {
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index db3e764..ab8edf7 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -1096,7 +1096,7 @@ MODULE_SCOPE int TclCreateExceptRange(ExceptionRangeType type,
CompileEnv *envPtr);
MODULE_SCOPE ExecEnv * TclCreateExecEnv(Tcl_Interp *interp, int size);
MODULE_SCOPE Tcl_Obj * TclCreateLiteral(Interp *iPtr, char *bytes,
- int length, unsigned int hash, int *newPtr,
+ size_t length, TCL_HASH_TYPE hash, int *newPtr,
Namespace *nsPtr, int flags,
LiteralEntry **globalPtrPtr);
MODULE_SCOPE void TclDeleteExecEnv(ExecEnv *eePtr);
diff --git a/generic/tclHash.c b/generic/tclHash.c
index 27919c5..66b1b79 100644
--- a/generic/tclHash.c
+++ b/generic/tclHash.c
@@ -36,7 +36,7 @@
static Tcl_HashEntry * AllocArrayEntry(Tcl_HashTable *tablePtr, void *keyPtr);
static int CompareArrayKeys(void *keyPtr, Tcl_HashEntry *hPtr);
-static unsigned int HashArrayKey(Tcl_HashTable *tablePtr, void *keyPtr);
+static TCL_HASH_TYPE HashArrayKey(Tcl_HashTable *tablePtr, void *keyPtr);
/*
* Prototypes for the one word hash key methods. Not actually declared because
@@ -58,7 +58,7 @@ static unsigned int HashOneWordKey(Tcl_HashTable *tablePtr, void *keyPtr);
static Tcl_HashEntry * AllocStringEntry(Tcl_HashTable *tablePtr,
void *keyPtr);
static int CompareStringKeys(void *keyPtr, Tcl_HashEntry *hPtr);
-static unsigned int HashStringKey(Tcl_HashTable *tablePtr, void *keyPtr);
+static TCL_HASH_TYPE HashStringKey(Tcl_HashTable *tablePtr, void *keyPtr);
/*
* Function prototypes for static functions in this file:
@@ -731,13 +731,13 @@ CompareArrayKeys(
*----------------------------------------------------------------------
*/
-static unsigned int
+static TCL_HASH_TYPE
HashArrayKey(
Tcl_HashTable *tablePtr, /* Hash table. */
void *keyPtr) /* Key from which to compute hash value. */
{
register const int *array = (const int *) keyPtr;
- register unsigned int result;
+ register TCL_HASH_TYPE result;
int count;
for (result = 0, count = tablePtr->keyType; count > 0;
@@ -827,13 +827,13 @@ CompareStringKeys(
*----------------------------------------------------------------------
*/
-static unsigned
+static TCL_HASH_TYPE
HashStringKey(
Tcl_HashTable *tablePtr, /* Hash table. */
void *keyPtr) /* Key from which to compute hash value. */
{
register const char *string = keyPtr;
- register unsigned int result;
+ register TCL_HASH_TYPE result;
register char c;
/*
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 316118f..8a88b72 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -3913,7 +3913,7 @@ MODULE_SCOPE int TclObjCallVarTraces(Interp *iPtr, Var *arrayPtr,
MODULE_SCOPE int TclCompareObjKeys(void *keyPtr, Tcl_HashEntry *hPtr);
MODULE_SCOPE void TclFreeObjEntry(Tcl_HashEntry *hPtr);
-MODULE_SCOPE unsigned TclHashObjKey(Tcl_HashTable *tablePtr, void *keyPtr);
+MODULE_SCOPE TCL_HASH_TYPE TclHashObjKey(Tcl_HashTable *tablePtr, void *keyPtr);
MODULE_SCOPE int TclFullFinalizationRequested(void);
diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c
index e0425cf..3864ad5 100644
--- a/generic/tclLiteral.c
+++ b/generic/tclLiteral.c
@@ -176,8 +176,8 @@ TclCreateLiteral(
Interp *iPtr,
char *bytes, /* The start of the string. Note that this is
* not a NUL-terminated string. */
- int length, /* Number of bytes in the string. */
- unsigned hash, /* The string's hash. If -1, it will be
+ size_t length, /* Number of bytes in the string. */
+ TCL_HASH_TYPE hash, /* The string's hash. If -1, it will be
* computed here. */
int *newPtr,
Namespace *nsPtr,
@@ -186,14 +186,14 @@ TclCreateLiteral(
{
LiteralTable *globalTablePtr = &iPtr->literalTable;
LiteralEntry *globalPtr;
- int globalHash;
+ TCL_HASH_TYPE globalHash;
Tcl_Obj *objPtr;
/*
* Is it in the interpreter's global literal table?
*/
- if (hash == (unsigned) -1) {
+ if (hash == (TCL_HASH_TYPE) -1) {
hash = HashString(bytes, length);
}
globalHash = (hash & globalTablePtr->mask);
@@ -201,9 +201,9 @@ TclCreateLiteral(
globalPtr = globalPtr->nextPtr) {
objPtr = globalPtr->objPtr;
if ((globalPtr->nsPtr == nsPtr)
- && (objPtr->length == length) && ((length == 0)
+ && ((size_t)objPtr->length == length) && ((length == 0)
|| ((objPtr->bytes[0] == bytes[0])
- && (memcmp(objPtr->bytes, bytes, (unsigned) length) == 0)))) {
+ && (memcmp(objPtr->bytes, bytes, length) == 0)))) {
/*
* A literal was found: return it
*/
@@ -245,7 +245,7 @@ TclCreateLiteral(
#ifdef TCL_COMPILE_DEBUG
if (LookupLiteralEntry((Tcl_Interp *) iPtr, objPtr) != NULL) {
Tcl_Panic("%s: literal \"%.*s\" found globally but shouldn't be",
- "TclRegisterLiteral", (length>60? 60 : length), bytes);
+ "TclRegisterLiteral", (length>60? 60 : (int)length), bytes);
}
#endif
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 16afaa5..af1b4c9 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -4049,15 +4049,15 @@ TclFreeObjEntry(
*----------------------------------------------------------------------
*/
-unsigned int
+TCL_HASH_TYPE
TclHashObjKey(
Tcl_HashTable *tablePtr, /* Hash table. */
void *keyPtr) /* Key from which to compute hash value. */
{
Tcl_Obj *objPtr = keyPtr;
- int length;
- const char *string = TclGetStringFromObj(objPtr, &length);
- unsigned int result = 0;
+ const char *string = TclGetString(objPtr);
+ size_t length = objPtr->length;
+ TCL_HASH_TYPE result = 0;
/*
* I tried a zillion different hash functions and asked many other people