diff options
author | nijtmans <nijtmans> | 2008-11-17 22:15:34 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2008-11-17 22:15:34 (GMT) |
commit | db2e6bf825388498ab5798bbeca26fce23d4286f (patch) | |
tree | 2f8215b09f523671c94a4acc837892ad9160b950 | |
parent | 984e58b8dfc72a94b8827802e7234f66ce8aa7e4 (diff) | |
download | tcl-db2e6bf825388498ab5798bbeca26fce23d4286f.zip tcl-db2e6bf825388498ab5798bbeca26fce23d4286f.tar.gz tcl-db2e6bf825388498ab5798bbeca26fce23d4286f.tar.bz2 |
Fix signature and implementation of Tcl_HashStats,
such that it conforms to the documentation.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | doc/Hash.3 | 4 | ||||
-rw-r--r-- | generic/tcl.decls | 4 | ||||
-rw-r--r-- | generic/tclDecls.h | 6 | ||||
-rw-r--r-- | generic/tclDictObj.c | 11 | ||||
-rw-r--r-- | generic/tclHash.c | 10 | ||||
-rw-r--r-- | generic/tclVar.c | 4 |
7 files changed, 26 insertions, 22 deletions
@@ -1,3 +1,12 @@ +2008-11-16 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tcl.decls: Fix signature and implementation of + * generic/tclDecls.h: Tcl_HashStats, such that it conforms + * generic/tclHash.c: to the documentation. + * generic/tclVar.c: + * doc/Hash.3 + * generic/tclDictObj.c Convert Tcl_SetResult call to Tcl_SetObjResult. + 2008-11-17 Alexandre Ferrieux <ferrieux@users.sourceforge.net> * tests/for.test: Check for uncompiled-for-continue [Bug 2186888] @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: Hash.3,v 1.30 2008/10/17 10:22:25 dkf Exp $ +'\" RCS: @(#) $Id: Hash.3,v 1.31 2008/11/17 22:15:34 nijtmans Exp $ '\" .so man.macros .TH Tcl_Hash 3 "" Tcl "Tcl Library Procedures" @@ -46,7 +46,7 @@ Tcl_HashEntry * Tcl_HashEntry * \fBTcl_NextHashEntry\fR(\fIsearchPtr\fR) .sp -const char * +char * \fBTcl_HashStats\fR(\fItablePtr\fR) .SH ARGUMENTS .AS "const Tcl_HashKeyType" *searchPtr out diff --git a/generic/tcl.decls b/generic/tcl.decls index 53604a6..715c2ad 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -12,7 +12,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.decls,v 1.153 2008/10/22 20:23:59 nijtmans Exp $ +# RCS: @(#) $Id: tcl.decls,v 1.154 2008/11/17 22:15:34 nijtmans Exp $ library tcl @@ -953,7 +953,7 @@ declare 268 generic { void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, va_list argList) } declare 269 generic { - CONST84_RETURN char * Tcl_HashStats(Tcl_HashTable *tablePtr) + char * Tcl_HashStats(Tcl_HashTable *tablePtr) } declare 270 generic { CONST84_RETURN char * Tcl_ParseVar(Tcl_Interp *interp, const char *start, diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 784f1ca..2578df2 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -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: tclDecls.h,v 1.155 2008/10/22 20:23:59 nijtmans Exp $ + * RCS: @(#) $Id: tclDecls.h,v 1.156 2008/11/17 22:15:34 nijtmans Exp $ */ #ifndef _TCLDECLS @@ -1692,7 +1692,7 @@ EXTERN void Tcl_AppendStringsToObjVA (Tcl_Obj * objPtr, #ifndef Tcl_HashStats_TCL_DECLARED #define Tcl_HashStats_TCL_DECLARED /* 269 */ -EXTERN CONST84_RETURN char * Tcl_HashStats (Tcl_HashTable * tablePtr); +EXTERN char * Tcl_HashStats (Tcl_HashTable * tablePtr); #endif #ifndef Tcl_ParseVar_TCL_DECLARED #define Tcl_ParseVar_TCL_DECLARED @@ -3985,7 +3985,7 @@ typedef struct TclStubs { void (*tcl_ValidateAllMemory) (const char * file, int line); /* 266 */ void (*tcl_AppendResultVA) (Tcl_Interp * interp, va_list argList); /* 267 */ void (*tcl_AppendStringsToObjVA) (Tcl_Obj * objPtr, va_list argList); /* 268 */ - CONST84_RETURN char * (*tcl_HashStats) (Tcl_HashTable * tablePtr); /* 269 */ + char * (*tcl_HashStats) (Tcl_HashTable * tablePtr); /* 269 */ CONST84_RETURN char * (*tcl_ParseVar) (Tcl_Interp * interp, const char * start, CONST84 char ** termPtr); /* 270 */ CONST84_RETURN char * (*tcl_PkgPresent) (Tcl_Interp * interp, const char * name, const char * version, int exact); /* 271 */ CONST84_RETURN char * (*tcl_PkgPresentEx) (Tcl_Interp * interp, const char * name, const char * version, int exact, ClientData * clientDataPtr); /* 272 */ diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 2b87c01..75e1478 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -9,7 +9,7 @@ * 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.69 2008/10/15 06:17:04 nijtmans Exp $ + * RCS: @(#) $Id: tclDictObj.c,v 1.70 2008/11/17 22:15:34 nijtmans Exp $ */ #include "tclInt.h" @@ -2061,6 +2061,7 @@ DictInfoCmd( { Tcl_Obj *dictPtr; Dict *dict; + char *buf; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "dictionary"); @@ -2076,11 +2077,9 @@ DictInfoCmd( } dict = dictPtr->internalRep.otherValuePtr; - /* - * This next cast is actually OK. - */ - - Tcl_SetResult(interp, (char *) Tcl_HashStats(&dict->table), TCL_DYNAMIC); + buf = Tcl_HashStats(&dict->table); + Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1)); + ckfree(buf); return TCL_OK; } diff --git a/generic/tclHash.c b/generic/tclHash.c index dd995f0..89fbb6f 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.36 2008/10/15 06:17:03 nijtmans Exp $ + * RCS: @(#) $Id: tclHash.c,v 1.37 2008/11/17 22:15:34 nijtmans Exp $ */ #include "tclInt.h" @@ -614,7 +614,7 @@ Tcl_NextHashEntry( *---------------------------------------------------------------------- */ -const char * +char * Tcl_HashStats( Tcl_HashTable *tablePtr) /* Table for which to produce stats. */ { @@ -665,11 +665,7 @@ Tcl_HashStats( * Print out the histogram and a few other pieces of information. */ - if (typePtr->flags & TCL_HASH_KEY_SYSTEM_HASH) { - result = (char *) TclpSysAlloc((unsigned) (NUM_COUNTERS*60) + 300, 0); - } else { - result = (char *) ckalloc((unsigned) (NUM_COUNTERS*60) + 300); - } + result = (char *) ckalloc((unsigned) (NUM_COUNTERS*60) + 300); sprintf(result, "%d entries in table, %d buckets\n", tablePtr->numEntries, tablePtr->numBuckets); p = result + strlen(result); diff --git a/generic/tclVar.c b/generic/tclVar.c index dc35f69..34d3741 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.171 2008/10/26 18:34:04 dkf Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.172 2008/11/17 22:15:34 nijtmans Exp $ */ #include "tclInt.h" @@ -3214,7 +3214,7 @@ Tcl_ArrayObjCmd( } case ARRAY_STATISTICS: { - const char *stats; + char *stats; if (notArray) { goto error; |