diff options
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | generic/tclBasic.c | 1 | ||||
-rw-r--r-- | generic/tclInt.h | 13 | ||||
-rw-r--r-- | generic/tclLiteral.c | 71 | ||||
-rw-r--r-- | generic/tclUtil.c | 2 | ||||
-rw-r--r-- | tests/namespace.test | 16 |
6 files changed, 42 insertions, 79 deletions
@@ -1,3 +1,21 @@ +2011-06-02 Don Porter <dgp@users.sourceforge.net> + + * generic/tclBasic.c: Removed TclCleanupLiteralTable(), and old + * generic/tclInt.h: band-aid routine put in place while a fix + * generic/tclLiteral.c: for [Bug 994838] took shape. No longer needed. + +2011-06-02 Donal K. Fellows <dkf@users.sf.net> + + * generic/tclInt.h (TclInvalidateNsCmdLookup): [Bug 3185407]: Extend + the set of epochs that are potentially bumped when a command is + created, for a slight performance drop (in some circumstances) and + improved semantics. + +2011-06-01 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tclUtil.c: Fix for [Bug 3309871]: Valgrind finds: + invalid read in TclMaxListLength() + 2011-05-25 Don Porter <dgp@users.sourceforge.net> * library/msgcat/msgcat.tcl: Backport improvements to msgcat diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 750c9e2..eb041c6 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -1257,7 +1257,6 @@ DeleteInterpProc( * table, as it will be freed later in this function without further use. */ - TclCleanupLiteralTable(interp, &(iPtr->literalTable)); TclHandleFree(iPtr->handle); TclTeardownNamespace(iPtr->globalNsPtr); diff --git a/generic/tclInt.h b/generic/tclInt.h index 1c1e615..679277a 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2564,8 +2564,6 @@ MODULE_SCOPE double TclCeil(mp_int *a); MODULE_SCOPE int TclCheckBadOctal(Tcl_Interp *interp, const char *value); MODULE_SCOPE int TclChanCaughtErrorBypass(Tcl_Interp *interp, Tcl_Channel chan); -MODULE_SCOPE void TclCleanupLiteralTable(Tcl_Interp *interp, - LiteralTable *tablePtr); MODULE_SCOPE ContLineLoc* TclContinuationsEnter(Tcl_Obj *objPtr, int num, int *loc); MODULE_SCOPE void TclContinuationsEnterDerived(Tcl_Obj *objPtr, @@ -3727,8 +3725,8 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, CONST char *file, */ #define TclUtfToUniChar(str, chPtr) \ - ((((unsigned char) *(str)) < 0xC0) ? \ - ((*(chPtr) = (Tcl_UniChar) *(str)), 1) \ + ((((unsigned char) *(str)) < 0xC0) ? \ + ((*(chPtr) = (Tcl_UniChar) *(str)), 1) \ : Tcl_UtfToUniChar(str, chPtr)) /* @@ -3759,8 +3757,11 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, CONST char *file, */ #define TclInvalidateNsCmdLookup(nsPtr) \ - if ((nsPtr)->numExportPatterns) { \ - (nsPtr)->exportLookupEpoch++; \ + if ((nsPtr)->numExportPatterns) { \ + (nsPtr)->exportLookupEpoch++; \ + } \ + if ((nsPtr)->commandPathLength) { \ + (nsPtr)->cmdRefEpoch++; \ } /* diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c index 62dc5c0..2c91b82 100644 --- a/generic/tclLiteral.c +++ b/generic/tclLiteral.c @@ -75,77 +75,6 @@ TclInitLiteralTable( /* *---------------------------------------------------------------------- * - * TclCleanupLiteralTable -- - * - * This function frees the internal representation of every literal in a - * literal table. It is called prior to deleting an interp, so that - * variable refs will be cleaned up properly. - * - * Results: - * None. - * - * Side effects: - * Each literal in the table has its internal representation freed. - * - *---------------------------------------------------------------------- - */ - -void -TclCleanupLiteralTable( - Tcl_Interp *interp, /* Interpreter containing literals to purge */ - LiteralTable *tablePtr) /* Points to the literal table being - * cleaned. */ -{ - int i; - LiteralEntry* entryPtr; /* Pointer to the current entry in the hash - * table of literals. */ - LiteralEntry* nextPtr; /* Pointer to the next entry in the bucket. */ - Tcl_Obj* objPtr; /* Pointer to a literal object whose internal - * rep is being freed. */ - const Tcl_ObjType* typePtr; /* Pointer to the object's type. */ - int didOne; /* Flag for whether we've removed a literal in - * the current bucket. */ - -#ifdef TCL_COMPILE_DEBUG - TclVerifyGlobalLiteralTable((Interp *) interp); -#endif /* TCL_COMPILE_DEBUG */ - - for (i=0 ; i<tablePtr->numBuckets ; i++) { - /* - * It is tempting simply to walk each hash bucket once and delete the - * internal representations of each literal in turn. It's also wrong. - * The problem is that freeing a literal's internal representation can - * delete other literals to which it refers, making nextPtr invalid. - * So each time we free an internal rep, we start its bucket over - * again. - */ - - do { - didOne = 0; - entryPtr = tablePtr->buckets[i]; - while (entryPtr != NULL) { - objPtr = entryPtr->objPtr; - nextPtr = entryPtr->nextPtr; - typePtr = objPtr->typePtr; - if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { - if (objPtr->bytes == NULL) { - Tcl_Panic( "literal without a string rep" ); - } - objPtr->typePtr = NULL; - typePtr->freeIntRepProc(objPtr); - didOne = 1; - break; - } else { - entryPtr = nextPtr; - } - } - } while (didOne); - } -} - -/* - *---------------------------------------------------------------------- - * * TclDeleteLiteralTable -- * * This function frees up everything associated with a literal table diff --git a/generic/tclUtil.c b/generic/tclUtil.c index b00489d..f5c2926 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -410,7 +410,7 @@ TclMaxListLength( bytes++; numBytes -= (numBytes != -1); } while (numBytes && TclIsSpaceProc(*bytes)); - if (numBytes == 0) { + if ((numBytes == 0) || ((numBytes == -1) && (*bytes == '\0'))) { break; } /* (*bytes) is non-space; return to counting state */ diff --git a/tests/namespace.test b/tests/namespace.test index 504d532..2be4cfc 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -2467,6 +2467,22 @@ test namespace-51.16 {Bug 1566526} { slave eval namespace eval demo namespace path :: interp delete slave } {} +test namespace-51.17 {Bug 3185407} -setup { + namespace eval ::test_ns_1 {} +} -body { + namespace eval ::test_ns_1 { + variable result {} + namespace eval ns {proc foo {} {}} + namespace eval ns2 {proc foo {} {}} + namespace path {ns ns2} + variable x foo + lappend result [namespace which $x] + proc foo {} {} + lappend result [namespace which $x] + } +} -cleanup { + namespace delete ::test_ns_1 +} -result {::test_ns_1::ns::foo ::test_ns_1::foo} # TIP 181 - namespace unknown tests test namespace-52.1 {unknown: default handler ::unknown} { |