Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 8310d9f3dda233cf97a935958fa22445f93c4af0
Ticket: 2308236fffffffffffffffffffffffffffffffff
signature of Tcl_HashStats() wrong
User & Date: nijtmans on 2008-11-19 05:02:37
Changes

  1. icomment:
    Just for the record (2): This is how Tcl_HashStats() must be used in Tcl 8.5:
    
    char *s = (char *)Tcl_HashStats(t);
    ...... do something with it
    if (t->typePtr->flags & TCL_HASH_KEY_SYSTEM_HASH) {
        TclpSysFree((char *) tablePtr->buckets);
    } else {
        ckfree((char *) tablePtr->buckets);
    }
    
    The documentation didn't mention this, and apart from that the
    function TclpSysFree is not in the public API. So in Tcl 8.6 I modified
    this simply to:
    char *s = Tcl_HashStats(t);
    ...... do something with it
    ckfree((char *) tablePtr->buckets);
    
    I don't think that anyone would use Tcl_HashStats with
    hash tables with the TCL_HASH_KEY_SYSTEM_HASH flag
    set, so in practice it doesn't make a difference.
    
    At least, in Tcl 8.6 the function works now as documented.
    In Tcl 8.5 the signature is changed such that a type cast
    is not needed any more, but the further behavior is unchanged.
    
    
  2. login: "nijtmans"
  3. mimetype: "text/plain"
  4. username: "nijtmans"