diff options
author | dgp <dgp@users.sourceforge.net> | 2007-07-02 21:10:50 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2007-07-02 21:10:50 (GMT) |
commit | 98eee8b9d8af4e5fff52f63d323e3bef3fc84725 (patch) | |
tree | 8313a19cf5977de0d0fb765b18bd2a81c915167d | |
parent | b56947219139a3ea4cd1fa607c4fb4a2aea1b292 (diff) | |
download | tcl-98eee8b9d8af4e5fff52f63d323e3bef3fc84725.zip tcl-98eee8b9d8af4e5fff52f63d323e3bef3fc84725.tar.gz tcl-98eee8b9d8af4e5fff52f63d323e3bef3fc84725.tar.bz2 |
* generic/tcl.h: Removed TCL_PRESERVE_BINARY_COMPATIBILITY and
* generic/tclHash.c: any code enabled when it is set to 0. We will
* generic/tclStubInit.c: always want to preserve binary compat
of the structs that appear in the interface through the 8.* series of
releases, so it's pointless to drag around this never-enabled
alternative.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | generic/tcl.h | 57 | ||||
-rw-r--r-- | generic/tclHash.c | 77 | ||||
-rw-r--r-- | generic/tclStubInit.c | 8 |
4 files changed, 21 insertions, 128 deletions
@@ -7,6 +7,13 @@ 2007-07-02 Don Porter <dgp@users.sourceforge.net> + * generic/tcl.h: Removed TCL_PRESERVE_BINARY_COMPATIBILITY and + * generic/tclHash.c: any code enabled when it is set to 0. We will + * generic/tclStubInit.c: always want to preserve binary compat + of the structs that appear in the interface through the 8.* series of + releases, so it's pointless to drag around this never-enabled + alternative. + * generic/tclIO.c: Removed dead code. * unix/tclUnixChan.c: diff --git a/generic/tcl.h b/generic/tcl.h index 873a72c..a636988 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.232 2007/06/21 12:43:17 dkf Exp $ + * RCS: @(#) $Id: tcl.h,v 1.233 2007/07/02 21:10:51 dgp Exp $ */ #ifndef _TCL @@ -437,16 +437,6 @@ typedef struct stat Tcl_StatBuf; #endif /* TCL_WIDE_INT_IS_LONG */ /* - * This flag controls whether binary compatability is maintained with - * extensions built against a previous version of Tcl. This is true by - * default. - */ - -#ifndef TCL_PRESERVE_BINARY_COMPATABILITY -# define TCL_PRESERVE_BINARY_COMPATABILITY 1 -#endif - -/* * Data structures defined opaquely in this module. The definitions below just * provide dummy types. A few fields are made visible in Tcl_Interp * structures, namely those used for returning a string result from commands. @@ -1117,13 +1107,9 @@ struct Tcl_HashEntry { * or NULL for end of chain. */ Tcl_HashTable *tablePtr; /* Pointer to table containing entry. */ #if TCL_HASH_KEY_STORE_HASH -# if TCL_PRESERVE_BINARY_COMPATABILITY VOID *hash; /* Hash value, stored as pointer to ensure * that the offsets of the fields in this * structure are not changed. */ -# else - unsigned int hash; /* Hash value. */ -# endif #else Tcl_HashEntry **bucketPtr; /* Pointer to bucket that points to first * entry in this entry's chain: used for @@ -1232,12 +1218,10 @@ struct Tcl_HashTable { * TCL_ONE_WORD_KEYS, or an integer giving the * number of ints that is the size of the * key. */ -#if TCL_PRESERVE_BINARY_COMPATABILITY Tcl_HashEntry *(*findProc) _ANSI_ARGS_((Tcl_HashTable *tablePtr, CONST char *key)); Tcl_HashEntry *(*createProc) _ANSI_ARGS_((Tcl_HashTable *tablePtr, CONST char *key, int *newPtr)); -#endif Tcl_HashKeyType *typePtr; /* Type of the keys used in the * Tcl_HashTable. */ }; @@ -1278,14 +1262,8 @@ typedef struct Tcl_HashSearch { #define TCL_STRING_KEYS 0 #define TCL_ONE_WORD_KEYS 1 - -#if TCL_PRESERVE_BINARY_COMPATABILITY -# define TCL_CUSTOM_TYPE_KEYS -2 -# define TCL_CUSTOM_PTR_KEYS -1 -#else -# define TCL_CUSTOM_TYPE_KEYS TCL_STRING_KEYS -# define TCL_CUSTOM_PTR_KEYS TCL_ONE_WORD_KEYS -#endif +#define TCL_CUSTOM_TYPE_KEYS -2 +#define TCL_CUSTOM_PTR_KEYS -1 /* * Structure definition for information used to keep track of searches through @@ -2367,42 +2345,23 @@ EXTERN void Tcl_Main _ANSI_ARGS_((int argc, char **argv, #define Tcl_GetHashValue(h) ((h)->clientData) #define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData) (value)) -#if TCL_PRESERVE_BINARY_COMPATABILITY -# define Tcl_GetHashKey(tablePtr, h) \ +#define Tcl_GetHashKey(tablePtr, h) \ ((char *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS || \ (tablePtr)->keyType == TCL_CUSTOM_PTR_KEYS) \ ? (h)->key.oneWordValue \ : (h)->key.string)) -#else -# define Tcl_GetHashKey(tablePtr, h) \ - ((char *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS) \ - ? (h)->key.oneWordValue \ - : (h)->key.string)) -#endif /* * Macros to use for clients to use to invoke find and create functions for * hash tables: */ -#if TCL_PRESERVE_BINARY_COMPATABILITY -# undef Tcl_FindHashEntry -# define Tcl_FindHashEntry(tablePtr, key) \ +#undef Tcl_FindHashEntry +#define Tcl_FindHashEntry(tablePtr, key) \ (*((tablePtr)->findProc))(tablePtr, key) -# undef Tcl_CreateHashEntry -# define Tcl_CreateHashEntry(tablePtr, key, newPtr) \ +#undef Tcl_CreateHashEntry +#define Tcl_CreateHashEntry(tablePtr, key, newPtr) \ (*((tablePtr)->createProc))(tablePtr, key, newPtr) -#else /* !TCL_PRESERVE_BINARY_COMPATABILITY */ -/* - * Macro to use new extended version of Tcl_InitHashTable. - */ -# undef Tcl_InitHashTable -# define Tcl_InitHashTable(tablePtr, keyType) \ - Tcl_InitHashTableEx((tablePtr), (keyType), NULL) -# undef Tcl_FindHashEntry -# define Tcl_FindHashEntry(tablePtr, key) \ - Tcl_CreateHashEntry((tablePtr), (key), NULL) -#endif /* TCL_PRESERVE_BINARY_COMPATABILITY */ /* * Macros that eliminate the overhead of the thread synchronization functions diff --git a/generic/tclHash.c b/generic/tclHash.c index 3bb863d..35de98c 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.30 2007/07/02 20:30:50 dkf Exp $ + * RCS: @(#) $Id: tclHash.c,v 1.31 2007/07/02 21:10:52 dgp Exp $ */ #include "tclInt.h" @@ -19,10 +19,8 @@ * Prevent macros from clashing with function definitions. */ -#if TCL_PRESERVE_BINARY_COMPATABILITY -# undef Tcl_FindHashEntry -# undef Tcl_CreateHashEntry -#endif +#undef Tcl_FindHashEntry +#undef Tcl_CreateHashEntry /* * When there are this many entries per bucket, on average, rebuild the hash @@ -73,12 +71,9 @@ static unsigned int HashStringKey(Tcl_HashTable *tablePtr, VOID *keyPtr); * Function prototypes for static functions in this file: */ -#if TCL_PRESERVE_BINARY_COMPATABILITY static Tcl_HashEntry * BogusFind(Tcl_HashTable *tablePtr, const char *key); static Tcl_HashEntry * BogusCreate(Tcl_HashTable *tablePtr, const char *key, int *newPtr); -#endif - static void RebuildTable(Tcl_HashTable *tablePtr); Tcl_HashKeyType tclArrayHashKeyType = { @@ -191,7 +186,6 @@ Tcl_InitCustomHashTable( tablePtr->downShift = 28; tablePtr->mask = 3; tablePtr->keyType = keyType; -#if TCL_PRESERVE_BINARY_COMPATABILITY tablePtr->findProc = Tcl_FindHashEntry; tablePtr->createProc = Tcl_CreateHashEntry; @@ -212,33 +206,6 @@ Tcl_InitCustomHashTable( * The caller has not been rebuilt so the hash table is not extended. */ } -#else - if (typePtr == NULL) { - /* - * Use the key type to decide which key type is needed. - */ - - if (keyType == TCL_STRING_KEYS) { - typePtr = &tclStringHashKeyType; - } else if (keyType == TCL_ONE_WORD_KEYS) { - typePtr = &tclOneWordHashKeyType; - } else if (keyType == TCL_CUSTOM_TYPE_KEYS) { - Tcl_Panic ("No type structure specified for TCL_CUSTOM_TYPE_KEYS"); - } else if (keyType == TCL_CUSTOM_PTR_KEYS) { - Tcl_Panic ("No type structure specified for TCL_CUSTOM_PTR_KEYS"); - } else { - typePtr = &tclArrayHashKeyType; - } - } else if (typePtr == (Tcl_HashKeyType *) -1) { - /* - * If the caller has not been rebuilt then we cannot continue as the - * hash table is not an extended version. - */ - - Tcl_Panic("Hash table is not compatible"); - } - tablePtr->typePtr = typePtr; -#endif } /* @@ -302,7 +269,6 @@ Tcl_CreateHashEntry( unsigned int hash; int index; -#if TCL_PRESERVE_BINARY_COMPATABILITY if (tablePtr->keyType == TCL_STRING_KEYS) { typePtr = &tclStringHashKeyType; } else if (tablePtr->keyType == TCL_ONE_WORD_KEYS) { @@ -313,13 +279,6 @@ Tcl_CreateHashEntry( } else { typePtr = &tclArrayHashKeyType; } -#else - typePtr = tablePtr->typePtr; - if (typePtr == NULL) { - Tcl_Panic("called %s on deleted table", "Tcl_CreateHashEntry"); - return NULL; - } -#endif if (typePtr->hashKeyProc) { hash = typePtr->hashKeyProc(tablePtr, (VOID *) key); @@ -388,11 +347,7 @@ Tcl_CreateHashEntry( hPtr->tablePtr = tablePtr; #if TCL_HASH_KEY_STORE_HASH -# if TCL_PRESERVE_BINARY_COMPATABILITY hPtr->hash = UINT2PTR(hash); -# else - hPtr->hash = hash; -# endif hPtr->nextPtr = tablePtr->buckets[index]; tablePtr->buckets[index] = hPtr; #else @@ -446,7 +401,6 @@ Tcl_DeleteHashEntry( tablePtr = entryPtr->tablePtr; -#if TCL_PRESERVE_BINARY_COMPATABILITY if (tablePtr->keyType == TCL_STRING_KEYS) { typePtr = &tclStringHashKeyType; } else if (tablePtr->keyType == TCL_ONE_WORD_KEYS) { @@ -457,9 +411,6 @@ Tcl_DeleteHashEntry( } else { typePtr = &tclArrayHashKeyType; } -#else - typePtr = tablePtr->typePtr; -#endif #if TCL_HASH_KEY_STORE_HASH if (typePtr->hashKeyProc == NULL @@ -521,7 +472,6 @@ Tcl_DeleteHashTable( const Tcl_HashKeyType *typePtr; int i; -#if TCL_PRESERVE_BINARY_COMPATABILITY if (tablePtr->keyType == TCL_STRING_KEYS) { typePtr = &tclStringHashKeyType; } else if (tablePtr->keyType == TCL_ONE_WORD_KEYS) { @@ -532,9 +482,6 @@ Tcl_DeleteHashTable( } else { typePtr = &tclArrayHashKeyType; } -#else - typePtr = tablePtr->typePtr; -#endif /* * Free up all the entries in the table. @@ -570,12 +517,8 @@ Tcl_DeleteHashTable( * re-initialization. */ -#if TCL_PRESERVE_BINARY_COMPATABILITY tablePtr->findProc = BogusFind; tablePtr->createProc = BogusCreate; -#else - tablePtr->typePtr = NULL; -#endif } /* @@ -682,7 +625,6 @@ Tcl_HashStats( char *result, *p; const Tcl_HashKeyType *typePtr; -#if TCL_PRESERVE_BINARY_COMPATABILITY if (tablePtr->keyType == TCL_STRING_KEYS) { typePtr = &tclStringHashKeyType; } else if (tablePtr->keyType == TCL_ONE_WORD_KEYS) { @@ -693,13 +635,6 @@ Tcl_HashStats( } else { typePtr = &tclArrayHashKeyType; } -#else - typePtr = tablePtr->typePtr; - if (typePtr == NULL) { - Tcl_Panic("called %s on deleted table", "Tcl_HashStats"); - return NULL; - } -#endif /* * Compute a histogram of bucket usage. @@ -979,7 +914,6 @@ HashStringKey( return result; } -#if TCL_PRESERVE_BINARY_COMPATABILITY /* *---------------------------------------------------------------------- * @@ -1036,7 +970,6 @@ BogusCreate( Tcl_Panic("called %s on deleted table", "Tcl_CreateHashEntry"); return NULL; } -#endif /* *---------------------------------------------------------------------- @@ -1066,7 +999,6 @@ RebuildTable( register Tcl_HashEntry *hPtr; const Tcl_HashKeyType *typePtr; -#if TCL_PRESERVE_BINARY_COMPATABILITY if (tablePtr->keyType == TCL_STRING_KEYS) { typePtr = &tclStringHashKeyType; } else if (tablePtr->keyType == TCL_ONE_WORD_KEYS) { @@ -1077,9 +1009,6 @@ RebuildTable( } else { typePtr = &tclArrayHashKeyType; } -#else - typePtr = tablePtr->typePtr; -#endif oldSize = tablePtr->numBuckets; oldBuckets = tablePtr->buckets; diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 361d7d7..35bfa12 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStubInit.c,v 1.140 2007/05/05 23:36:36 dkf Exp $ + * RCS: @(#) $Id: tclStubInit.c,v 1.141 2007/07/02 21:10:52 dgp Exp $ */ #include "tclInt.h" @@ -31,10 +31,8 @@ #undef Tcl_NewStringObj #undef Tcl_DumpActiveMemory #undef Tcl_ValidateAllMemory -#if TCL_PRESERVE_BINARY_COMPATABILITY -# undef Tcl_FindHashEntry -# undef Tcl_CreateHashEntry -#endif +#undef Tcl_FindHashEntry +#undef Tcl_CreateHashEntry /* * Keep a record of the original Notifier procedures, created in the |