Attachment "715751.patch" to
ticket [715751ffff]
added by
dgp
2003-04-05 15:26:24.
Index: tclDictObj.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclDictObj.c,v
retrieving revision 1.3
diff -u -r1.3 tclDictObj.c
--- tclDictObj.c 5 Apr 2003 07:32:32 -0000 1.3
+++ tclDictObj.c 5 Apr 2003 08:10:03 -0000
@@ -9,10 +9,12 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclDictObj.c,v 1.3 2003/04/05 07:32:32 dgp Exp $
+ * RCS: @(#) $Id$
*/
#include "tclInt.h"
+
+/*----------------------------------------------------------------------*/
/*
* Prototypes for procedures defined later in this file:
@@ -91,7 +93,7 @@
*/
Tcl_ObjType tclDictType = {
- "dict",
+ "hashDictionary",
FreeDictInternalRep, /* freeIntRepProc */
DupDictInternalRep, /* dupIntRepProc */
UpdateStringOfDict, /* updateStringProc */
@@ -185,7 +187,7 @@
Dict *dict = (Dict *) dictPtr->internalRep.otherValuePtr;
--dict->refcount;
- if (dict->refcount == 0) {
+ if (dict->refcount <= 0) {
DeleteDict(dict);
}
@@ -1093,7 +1095,7 @@
/*
*----------------------------------------------------------------------
*
- * Tcl_NewListObj --
+ * Tcl_NewDictObj --
*
* This procedure is normally called when not debugging: i.e., when
* TCL_MEM_DEBUG is not defined. It creates a new dict object
@@ -1127,6 +1129,7 @@
dict = (Dict *) ckalloc(sizeof(Dict));
Tcl_InitObjHashTable(&dict->table);
dict->epoch = 0;
+ dict->refcount = 1;
dict->chain = NULL;
dictPtr->internalRep.otherValuePtr = (VOID *) dict;
dictPtr->typePtr = &tclDictType;
@@ -1137,7 +1140,7 @@
/*
*----------------------------------------------------------------------
*
- * Tcl_DbNewListObj --
+ * Tcl_DbNewDictObj --
*
* This procedure is normally called when debugging: i.e., when
* TCL_MEM_DEBUG is defined. It creates new dict objects. It is the
@@ -1175,6 +1178,7 @@
dict = (Dict *) ckalloc(sizeof(Dict));
Tcl_InitObjHashTable(&dict->table);
dict->epoch = 0;
+ dict->refcount = 1;
dict->chain = NULL;
dictPtr->internalRep.otherValuePtr = (VOID *) dict;
dictPtr->typePtr = &tclDictType;
@@ -1766,8 +1770,8 @@
Tcl_DecrRefCount(valuePtr);
return TCL_ERROR;
}
- valueAlreadyInDictionary:
}
+ valueAlreadyInDictionary:
resultPtr = Tcl_ObjSetVar2(interp, objv[2], NULL, dictPtr,
TCL_LEAVE_ERR_MSG);
if (resultPtr == NULL) {