Menu

#4635 Tcl_(Find|Create)HashEntry stub entries can never be called

closed-fixed
9
2010-12-31
2010-05-27
No

From tcl.h we can see that Tcl_(Find|Create)HashEntry
is a macro, but it is in the stub table as well. The macro
overrides the definition in tclDecls.h:
=========================================
#undef Tcl_FindHashEntry
#define Tcl_FindHashEntry(tablePtr, key) ...
#undef Tcl_CreateHashEntry
#define Tcl_CreateHashEntry(tablePtr, key, newPtr) ...
=========================================
So, the stub table entries are useless. The only effects
it has is:
- Need tricks like #undef, to make tclHash.c and
tclInitStubs.c compile.
- Tcl_(Find|Create)HashEntry could be static in tclHash.c,
but only for the stub table they are made EXTERN

Solution: remove those two functions from the stub
table, and we can remove all remaining trickery.

Discussion

  • Jan Nijtmans

    Jan Nijtmans - 2010-05-27

    Another benifit: Making Tcl_(Find|Create)HashEntry
    static means that the dynamic loader has two less
    symbols which need to be resolved.

     
  • Donal K. Fellows

    • priority: 5 --> 4
    • assigned_to: nijtmans --> msofer
     
  • Donal K. Fellows

    Just leave it alone, Jan. You're not the area maintainer.

     
  • Jan Nijtmans

    Jan Nijtmans - 2010-05-28

    OK, Miguel?

     
  • Jan Nijtmans

    Jan Nijtmans - 2010-08-16
    • assigned_to: msofer --> dgp
     
  • Don Porter

    Don Porter - 2010-08-16
    • priority: 4 --> 9
     
  • Jan Nijtmans

    Jan Nijtmans - 2010-08-16

    Why priority 9? If it's only because you want
    this to be on the top of your list, OK!

    Besides that, it's only about the removal
    of dead code, so I don't see the need
    for prio 9.

     
  • Don Porter

    Don Porter - 2010-08-16

    The stub table entries were added:

    2000-07-21 Eric Melski <ericm@ajubasolutions.com>

    * generic/tclStubInit.c:
    * generic/tclObj.c:
    * generic/tclInt.h:
    * generic/tclHash.c:
    * generic/tclDecls.h:
    * generic/tcl.h:
    * generic/tcl.decls:
    * doc/Hash.3: Reapplied patch from Paul Duffin to extend hash tables
    to allow custom key types, such as Tcl_Obj *'s, and others.

     
  • Don Porter

    Don Porter - 2010-08-16

    To reclaim that patch,

    cvs -D 2000-07-21 -D 2000-07-22

    in tcl/generic

     
  • Don Porter

    Don Porter - 2010-08-16

    Aim of the patch was to move toward a
    revised hash table implementation. The change
    was a binary incompat, though, so it was disabled
    with #ifdef TCL_PRESERVE_BINARY_COMPATIBILITY.

    Sometime in Tcl 8.5 development, the new maintainers
    concluded that preserving binary compat was one of
    the things Tcl 8.* development was commited to, so
    dragging around code never to be enabled was no
    longer worth doing.

    So now we still have stub table entries that support
    only a configuration we removed in the last minor
    release. Seems like they can go away.

    Probably best we make the change on in 8.6 development
    and delay or forgo any changes to tcl.decls in 8.5.*

     
  • Don Porter

    Don Porter - 2010-08-16
    • assigned_to: dgp --> nijtmans
     
  • Jan Nijtmans

    Jan Nijtmans - 2010-08-19

    There is another option: We could keep the stub
    table entries, but make the signature match the
    doc again. That would be OK to me too.

     
  • Jan Nijtmans

    Jan Nijtmans - 2010-08-22

    fix signatures

     
  • Jan Nijtmans

    Jan Nijtmans - 2010-08-22

    Here is a better patch, which does the same as the
    previous one, but restores the two functions having
    the same signature and behavior as the macros.
    Still, the stub entries are useless, but at least there
    is an option now to remove the macros and still
    having everything work as before.

     
  • Jan Nijtmans

    Jan Nijtmans - 2010-12-31

    Backported to 8.5: Now the Tcl_(Find|Create)HashEntry functions
    do exactly the same as the Tcl_(Find|Create)HashEntry macro's, so
    at least the confusion addressed in this issue is gone.

     
  • Jan Nijtmans

    Jan Nijtmans - 2010-12-31
    • status: open --> closed-fixed