Skip to content
Tcl Source Code View Ticket
Login

View Ticket

several bugs in tclDictObj.c

Closed / Fixed715751ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2003-04-05 08:22:52
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.
dgpplain2003-04-05 15:26:24
File Added - 46859: 715751.patch

Logged In: YES 
user_id=80530

...and here's that patch.
dkfplain2003-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".  :^)
Log in (anonymous is fine) to add a comment.

Attachments: