HomeDevCentral

Use Tcl_CreateObjCommand and respect the types

Description

Use Tcl_CreateObjCommand and respect the types

We use Tcl_CreateObjCommand instead of Tcl_CreateCommand,
to retrieve arguments as TCL objects.

Furthermore, this change addresses compiler warnings, with a
better respect of types than the original code base.

Warnings fixed by this change:

rabbitmq-tcl.c:367:27: warning: cast to 'ClientData' (aka 'void *') from smaller integer type 'int'
      [-Wint-to-void-pointer-cast]
                          (ClientData)i, (Tcl_CmdDeleteProc *)NULL);
                          ^
rabbitmq-tcl.c:366:56: warning: incompatible pointer types passing 'int (ClientData, Tcl_Interp *, int, char **)'
      to parameter of type 'Tcl_CmdProc *' (aka 'int (*)(ClientData, Tcl_Interp *, int, const char **)')
      [-Wincompatible-pointer-types]
        Tcl_CreateCommand(tclInterpreter, commandName, mq_command,
                                                       ^~~~~~~~~~
/usr/include/tcl8.6/tclDecls.h:299:39: note: passing argument to parameter 'proc' here
                                const char *cmdName, Tcl_CmdProc *proc,
                                                                  ^
2 warnings generated.

Details

Provenance
derecksonAuthored on Dec 11 2015, 21:24
Parents
rRABBITMQTCLc6aefadf1620: Improve code comments
Branches
Unknown
Tags
Unknown