Tcl Source Code

View Ticket
Login
Ticket UUID: 715751
Title: several bugs in tclDictObj.c
Type: Bug Version: obsolete: 8.5a0
Submitter: dgp Created on: 2003-04-05 08:22:52
Subsystem: 15. Dict Object Assigned To: dkf
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-04-07 17:25:31
Resolution: Fixed Closed By: dkf
    Closed on: 2003-04-07 10:25:31
Description:
This script panics:

proc foo bar {}
while 1 {
    set dictv [dict create a 0]
    set share [dict values $dictv]
    foo [dict incr dictv a]
}

due to broken refcount initialization
in the Dict struct.

Some C compilers are not happy with
a label like valueAlreadyInDictionary
on line 1769 that does not label any
C statement, but the end of a block.

There are several typos in comments.

The name for the new Tcl_ObjType
is "hashDictionary", but the name
"dict" fits in better with other type names.

A patch to be filed in a moment fixes these
problems.

The file tclDictObj.c also will not compile
on any platform where 
TCL_WIDE_INT_IS_LONG is #define'd
because it refers to &tclWideIntType which
does not exist on those platforms.  I prefer
to fix that bug by applying the patch for
Tcl Bug 713562.
User Comments: dkf added on 2003-04-07 17:25:31:
Logged In: YES 
user_id=79902

First point:  Uck.  Forgot to put the refcount init in
everywhere it was needed when I added reference counts to
the Dict structure (I previously used Tcl_Preserve to manage
it, but that was far less reliable and had quite a tendency
to lose the representation at unfortunate times, which I
only discovered during testing...)

Second point:  *sigh*  One of the few times GCC's
permissiveness has caught me out.

Third point:  D'oh!

Fourth point:  Not my problem, as the code I checked in
never used "hashDictionary", but rather always "dict".  :^)

dgp added on 2003-04-05 15:26:24:

File Added - 46859: 715751.patch

Logged In: YES 
user_id=80530

...and here's that patch.

Attachments: