Tcl Source Code

Changes On Branch memory-API
Login
Bounty program for improvements to Tcl and certain Tcl packages.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch memory-API Excluding Merge-Ins

This is equivalent to a diff from 4cb9548991 to c643e8fe38

2018-10-08
19:00
TIP #494 implementation: More use of size_t in Tcl 9 check-in: f3d49044c4 user: jan.nijtmans tags: trunk
18:50
Merge 8.7 check-in: 490cd4ad13 user: jan.nijtmans tags: trunk
2018-10-06
19:20
Use more TCL_AUTO_LENGTH, when appropriate Closed-Leaf check-in: c643e8fe38 user: jan.nijtmans tags: memory-API
18:33
merge trunk check-in: 52bb60626e user: jan.nijtmans tags: memory-API
17:22
Merge 8.7 check-in: 4cb9548991 user: jan.nijtmans tags: trunk
17:12
protect Tcl_WinUtfToTChar/Tcl_WinTCharToUtf against NULL input values: return empty string in that c... check-in: 159c6f011e user: jan.nijtmans tags: core-8-branch
2018-10-05
21:22
Merge 8.7 check-in: 89a34ee2d1 user: jan.nijtmans tags: trunk

Changes to compat/opendir.c.

    24     24       register int fd;
    25     25       char *myname;
    26     26   
    27     27       myname = ((*name == '\0') ? "." : name);
    28     28       if ((fd = open(myname, 0, 0)) == -1) {
    29     29   	return NULL;
    30     30       }
    31         -    dirp = (DIR *) ckalloc(sizeof(DIR));
           31  +    dirp = (DIR *) Tcl_Alloc(sizeof(DIR));
    32     32       if (dirp == NULL) {
    33     33   	/* unreachable? */
    34     34   	close(fd);
    35     35   	return NULL;
    36     36       }
    37     37       dirp->dd_fd = fd;
    38     38       dirp->dd_loc = 0;
................................................................................
   102    102   void
   103    103   closedir(
   104    104       register DIR *dirp)
   105    105   {
   106    106       close(dirp->dd_fd);
   107    107       dirp->dd_fd = -1;
   108    108       dirp->dd_loc = 0;
   109         -    ckfree(dirp);
          109  +    Tcl_Free(dirp);
   110    110   }

Changes to compat/waitpid.c.

    96     96   	result = waitPtr->pid;
    97     97   	*statusPtr = *((int *) &waitPtr->status);
    98     98   	if (prevPtr == NULL) {
    99     99   	    deadList = waitPtr->nextPtr;
   100    100   	} else {
   101    101   	    prevPtr->nextPtr = waitPtr->nextPtr;
   102    102   	}
   103         -	ckfree(waitPtr);
          103  +	Tcl_Free(waitPtr);
   104    104   	return result;
   105    105       }
   106    106   
   107    107       /*
   108    108        * Wait for any process to stop or exit. If it's an acceptable one then
   109    109        * return it to the caller; otherwise store information about it in the
   110    110        * list of exited processes and try again. On systems that have only wait
................................................................................
   152    152       saveInfo:
   153    153   	for (waitPtr = deadList; waitPtr != NULL; waitPtr = waitPtr->nextPtr) {
   154    154   	    if (waitPtr->pid == result) {
   155    155   		waitPtr->status = status;
   156    156   		goto waitAgain;
   157    157   	    }
   158    158   	}
   159         -	waitPtr = (WaitInfo *) ckalloc(sizeof(WaitInfo));
          159  +	waitPtr = (WaitInfo *) Tcl_Alloc(sizeof(WaitInfo));
   160    160   	waitPtr->pid = result;
   161    161   	waitPtr->status = status;
   162    162   	waitPtr->nextPtr = deadList;
   163    163   	deadList = waitPtr;
   164    164   
   165    165       waitAgain:
   166    166   	continue;
   167    167       }
   168    168   }

Changes to doc/AddErrInfo.3.

    54     54   this points to the first byte of an array of \fIlength\fR bytes
    55     55   containing a string to append to the \fB\-errorinfo\fR return option.
    56     56   This byte array may contain embedded null bytes
    57     57   unless \fIlength\fR is negative.
    58     58   .AP Tcl_Obj *objPtr in
    59     59   A message to be appended to the \fB\-errorinfo\fR return option
    60     60   in the form of a Tcl_Obj value.
    61         -.AP int length in
           61  +.AP size_t length in
    62     62   The number of bytes to copy from \fImessage\fR when
    63     63   appending to the \fB\-errorinfo\fR return option.
    64         -If negative, all bytes up to the first null byte are used.
           64  +If (size_t)-1, all bytes up to the first null byte are used.
    65     65   .AP Tcl_Obj *errorObjPtr in
    66     66   The \fB\-errorcode\fR return option will be set to this value.
    67     67   .AP char *element in
    68     68   String to record as one element of the \fB\-errorcode\fR return option.
    69     69   Last \fIelement\fR argument must be NULL.
    70     70   .AP va_list argList in
    71     71   An argument list which must have been initialized using

Changes to doc/Alloc.3.

     4      4   '\" See the file "license.terms" for information on usage and redistribution
     5      5   '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     6      6   '\"
     7      7   .TH Tcl_Alloc 3 7.5 Tcl "Tcl Library Procedures"
     8      8   .so man.macros
     9      9   .BS
    10     10   .SH NAME
    11         -Tcl_Alloc, Tcl_Free, Tcl_Realloc, Tcl_AttemptAlloc, Tcl_AttemptRealloc, ckalloc, ckfree, ckrealloc, attemptckalloc, attemptckrealloc \- allocate or free heap memory
           11  +Tcl_Alloc, Tcl_Free, Tcl_Realloc, Tcl_AttemptAlloc, Tcl_AttemptRealloc \- allocate or free heap memory
    12     12   .SH SYNOPSIS
    13     13   .nf
    14     14   \fB#include <tcl.h>\fR
    15     15   .sp
    16     16   char *
    17     17   \fBTcl_Alloc\fR(\fIsize\fR)
    18     18   .sp
    19     19   void
    20     20   \fBTcl_Free\fR(\fIptr\fR)
    21     21   .sp
    22         -char *
           22  +void *
    23     23   \fBTcl_Realloc\fR(\fIptr, size\fR)
    24     24   .sp
    25         -char *
           25  +void *
    26     26   \fBTcl_AttemptAlloc\fR(\fIsize\fR)
    27     27   .sp
    28         -char *
           28  +void *
    29     29   \fBTcl_AttemptRealloc\fR(\fIptr, size\fR)
    30         -.sp
    31         -char *
    32         -\fBckalloc\fR(\fIsize\fR)
    33         -.sp
    34         -void
    35         -\fBckfree\fR(\fIptr\fR)
    36         -.sp
    37         -char *
    38         -\fBckrealloc\fR(\fIptr, size\fR)
    39         -.sp
    40         -char *
    41         -\fBattemptckalloc\fR(\fIsize\fR)
    42         -.sp
    43         -char *
    44         -\fBattemptckrealloc\fR(\fIptr, size\fR)
    45     30   .SH ARGUMENTS
    46     31   .AS char *size
    47     32   .AP "unsigned int" size in
    48     33   Size in bytes of the memory block to allocate.
    49     34   .AP char *ptr in
    50     35   Pointer to memory block to free or realloc.
    51     36   .BE
................................................................................
    75     60   function to \fBTcl_Alloc\fR and \fBTcl_Realloc\fR, except that
    76     61   \fBTcl_AttemptAlloc\fR and \fBTcl_AttemptRealloc\fR will not cause the Tcl
    77     62   interpreter to \fBpanic\fR if the memory allocation fails.  If the
    78     63   allocation fails, these functions will return NULL.  Note that on some
    79     64   platforms, but not all, attempting to allocate a zero-sized block of
    80     65   memory will also cause these functions to return NULL.
    81     66   .PP
    82         -The procedures \fBckalloc\fR, \fBckfree\fR, \fBckrealloc\fR,
    83         -\fBattemptckalloc\fR, and \fBattemptckrealloc\fR are implemented
    84         -as macros.  Normally, they are synonyms for the corresponding
    85         -procedures documented on this page.  When Tcl and all modules
    86         -calling Tcl are compiled with \fBTCL_MEM_DEBUG\fR defined, however,
    87         -these macros are redefined to be special debugging versions
    88         -of these procedures.  To support Tcl's memory debugging within a
    89         -module, use the macros rather than direct calls to \fBTcl_Alloc\fR, etc.
           67  +When a module or Tcl itself is compiled with \fBTCL_MEM_DEBUG\fR defined,
           68  +the procedures \fBTcl_Alloc\fR, \fBTcl_Free\fR, \fBTcl_Realloc\fR,
           69  +\fBTcl_AttemptAlloc\fR, and \fBTcl_AttempRealloc\fR are implemented
           70  +as macros, redefined to be special debugging versions of these procedures.
    90     71   
    91     72   .SH KEYWORDS
    92     73   alloc, allocation, free, malloc, memory, realloc, TCL_MEM_DEBUG

Changes to doc/AssocData.3.

     9      9   .BS
    10     10   .SH NAME
    11     11   Tcl_GetAssocData, Tcl_SetAssocData, Tcl_DeleteAssocData \- manage associations of string keys and user specified data with Tcl interpreters
    12     12   .SH SYNOPSIS
    13     13   .nf
    14     14   \fB#include <tcl.h>\fR
    15     15   .sp
    16         -ClientData
           16  +void *
    17     17   \fBTcl_GetAssocData\fR(\fIinterp, key, delProcPtr\fR)
    18     18   .sp
    19     19   \fBTcl_SetAssocData\fR(\fIinterp, key, delProc, clientData\fR)
    20     20   .sp
    21     21   \fBTcl_DeleteAssocData\fR(\fIinterp, key\fR)
    22     22   .SH ARGUMENTS
    23     23   .AS Tcl_InterpDeleteProc **delProcPtr
................................................................................
    27     27   Key for association with which to store data or from which to delete or
    28     28   retrieve data.  Typically the module prefix for a package.
    29     29   .AP Tcl_InterpDeleteProc *delProc in
    30     30   Procedure to call when \fIinterp\fR is deleted.
    31     31   .AP Tcl_InterpDeleteProc **delProcPtr in
    32     32   Pointer to location in which to store address of current deletion procedure
    33     33   for association.  Ignored if NULL.
    34         -.AP ClientData clientData in
           34  +.AP void *clientData in
    35     35   Arbitrary one-word value associated with the given key in this
    36     36   interpreter.  This data is owned by the caller.
    37     37   .BE
    38     38   
    39     39   .SH DESCRIPTION
    40     40   .PP
    41     41   These procedures allow extensions to associate their own data with
................................................................................
    60     60   If the \fIdeleteProc\fR argument is non-NULL it specifies the address of a
    61     61   procedure to invoke if the interpreter is deleted before the association
    62     62   is deleted.  \fIDeleteProc\fR should have arguments and result that match
    63     63   the type \fBTcl_InterpDeleteProc\fR:
    64     64   .PP
    65     65   .CS
    66     66   typedef void \fBTcl_InterpDeleteProc\fR(
    67         -        ClientData \fIclientData\fR,
           67  +        void *\fIclientData\fR,
    68     68           Tcl_Interp *\fIinterp\fR);
    69     69   .CE
    70     70   .PP
    71     71   When \fIdeleteProc\fR is invoked the \fIclientData\fR and \fIinterp\fR
    72     72   arguments will be the same as the corresponding arguments passed to
    73     73   \fBTcl_SetAssocData\fR.
    74     74   The deletion procedure will \fInot\fR be invoked if the association

Changes to doc/Async.3.

    26     26   .sp
    27     27   int
    28     28   \fBTcl_AsyncReady\fR()
    29     29   .SH ARGUMENTS
    30     30   .AS Tcl_AsyncHandler clientData
    31     31   .AP Tcl_AsyncProc *proc in
    32     32   Procedure to invoke to handle an asynchronous event.
    33         -.AP ClientData clientData in
           33  +.AP void *clientData in
    34     34   One-word value to pass to \fIproc\fR.
    35     35   .AP Tcl_AsyncHandler async in
    36     36   Token for asynchronous event handler.
    37     37   .AP Tcl_Interp *interp in
    38     38   Tcl interpreter in which command was being evaluated when handler was
    39     39   invoked, or NULL if handler was invoked when there was no interpreter
    40     40   active.
................................................................................
    80     80   the world is in a safe state, and \fIproc\fR can then carry out
    81     81   the actions associated with the asynchronous event.
    82     82   \fIProc\fR should have arguments and result that match the
    83     83   type \fBTcl_AsyncProc\fR:
    84     84   .PP
    85     85   .CS
    86     86   typedef int \fBTcl_AsyncProc\fR(
    87         -        ClientData \fIclientData\fR,
           87  +        void *\fIclientData\fR,
    88     88           Tcl_Interp *\fIinterp\fR,
    89     89           int \fIcode\fR);
    90     90   .CE
    91     91   .PP
    92     92   The \fIclientData\fR will be the same as the \fIclientData\fR
    93     93   argument passed to \fBTcl_AsyncCreate\fR when the handler was
    94     94   created.

Changes to doc/ByteArrObj.3.

    25     25   unsigned char *
    26     26   \fBTcl_SetByteArrayLength\fR(\fIobjPtr, length\fR)
    27     27   .SH ARGUMENTS
    28     28   .AS "const unsigned char" *lengthPtr in/out
    29     29   .AP "const unsigned char" *bytes in
    30     30   The array of bytes used to initialize or set a byte-array value. May be NULL
    31     31   even if \fIlength\fR is non-zero.
    32         -.AP int length in
    33         -The length of the array of bytes.  It must be >= 0.
           32  +.AP size_t length in
           33  +The length of the array of bytes.
    34     34   .AP Tcl_Obj *objPtr in/out
    35     35   For \fBTcl_SetByteArrayObj\fR, this points to the value to be converted to
    36     36   byte-array type.  For \fBTcl_GetByteArrayFromObj\fR and
    37     37   \fBTcl_SetByteArrayLength\fR, this points to the value from which to get
    38     38   the byte-array value; if \fIobjPtr\fR does not already point to a byte-array
    39     39   value, it will be converted to one.
    40     40   .AP int *lengthPtr out

Changes to doc/CallDel.3.

    19     19   \fBTcl_DontCallWhenDeleted\fR(\fIinterp\fR, \fIproc\fR, \fIclientData\fR)
    20     20   .SH ARGUMENTS
    21     21   .AS Tcl_InterpDeleteProc clientData
    22     22   .AP Tcl_Interp *interp in
    23     23   Interpreter with which to associated callback.
    24     24   .AP Tcl_InterpDeleteProc *proc in
    25     25   Procedure to call when \fIinterp\fR is deleted.
    26         -.AP ClientData clientData in
           26  +.AP void *clientData in
    27     27   Arbitrary one-word value to pass to \fIproc\fR.
    28     28   .BE
    29     29   .SH DESCRIPTION
    30     30   .PP
    31     31   \fBTcl_CallWhenDeleted\fR arranges for \fIproc\fR to be called by
    32     32   \fBTcl_DeleteInterp\fR if/when \fIinterp\fR is deleted at some future
    33     33   time.  \fIProc\fR will be invoked just before the interpreter
................................................................................
    34     34   is deleted, but the interpreter will still be valid at the
    35     35   time of the call.
    36     36   \fIProc\fR should have arguments and result that match the
    37     37   type \fBTcl_InterpDeleteProc\fR:
    38     38   .PP
    39     39   .CS
    40     40   typedef void \fBTcl_InterpDeleteProc\fR(
    41         -        ClientData \fIclientData\fR,
           41  +        void *\fIclientData\fR,
    42     42           Tcl_Interp *\fIinterp\fR);
    43     43   .CE
    44     44   .PP
    45     45   The \fIclientData\fR and \fIinterp\fR parameters are
    46     46   copies of the \fIclientData\fR and \fIinterp\fR arguments given
    47     47   to \fBTcl_CallWhenDeleted\fR.
    48     48   Typically, \fIclientData\fR points to an application-specific

Changes to doc/Cancel.3.

    26     26   not NULL, this object will have its reference count decremented before
    27     27   \fBTcl_CancelEval\fR returns.
    28     28   .AP int flags in
    29     29   ORed combination of flag bits that specify additional options.
    30     30   For \fBTcl_CancelEval\fR, only \fBTCL_CANCEL_UNWIND\fR is currently
    31     31   supported.  For \fBTcl_Canceled\fR, only \fBTCL_LEAVE_ERR_MSG\fR and
    32     32   \fBTCL_CANCEL_UNWIND\fR are currently supported.
    33         -.AP ClientData clientData in
           33  +.AP void *clientData in
    34     34   Currently reserved for future use.
    35     35   It should be set to NULL.
    36     36   .BE
    37     37   .SH DESCRIPTION
    38     38   .PP
    39     39   \fBTcl_CancelEval\fR cancels or unwinds the script in progress soon after
    40     40   the next invocation of asynchronous handlers, causing \fBTCL_ERROR\fR to be

Changes to doc/ChnlStack.3.

    28     28   .sp
    29     29   .SH ARGUMENTS
    30     30   .AS Tcl_ChannelType clientData
    31     31   .AP Tcl_Interp *interp in
    32     32   Interpreter for error reporting.
    33     33   .AP "const Tcl_ChannelType" *typePtr in
    34     34   The new channel I/O procedures to use for \fIchannel\fR.
    35         -.AP ClientData clientData in
           35  +.AP void *clientData in
    36     36   Arbitrary one-word value to pass to channel I/O procedures.
    37     37   .AP int mask in
    38     38   Conditions under which \fIchannel\fR will be used: OR-ed combination of
    39     39   \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR and \fBTCL_EXCEPTION\fR.
    40     40   This can be a subset of the operations currently allowed on \fIchannel\fR.
    41     41   .AP Tcl_Channel channel in
    42     42   An existing Tcl channel such as returned by \fBTcl_CreateChannel\fR.

Changes to doc/Class.3.

    37     37   .sp
    38     38   Tcl_Object
    39     39   \fBTcl_CopyObjectInstance\fR(\fIinterp, object, name, nsName\fR)
    40     40   .sp
    41     41   int
    42     42   \fBTcl_ObjectDeleted\fR(\fIobject\fR)
    43     43   .sp
    44         -ClientData
           44  +void *
    45     45   \fBTcl_ObjectGetMetadata\fR(\fIobject, metaTypePtr\fR)
    46     46   .sp
    47     47   \fBTcl_ObjectSetMetadata\fR(\fIobject, metaTypePtr, metadata\fR)
    48     48   .sp
    49         -ClientData
           49  +void *
    50     50   \fBTcl_ClassGetMetadata\fR(\fIclass, metaTypePtr\fR)
    51     51   .sp
    52     52   \fBTcl_ClassSetMetadata\fR(\fIclass, metaTypePtr, metadata\fR)
    53     53   .sp
    54     54   Tcl_ObjectMapMethodNameProc
    55     55   \fBTcl_ObjectGetMethodNameMapper\fR(\fIobject\fR)
    56     56   .sp
    57     57   \fBTcl_ObjectSetMethodNameMapper\fR(\fIobject\fR, \fImethodNameMapper\fR)
    58     58   .SH ARGUMENTS
    59         -.AS ClientData metadata in/out
           59  +.AS void *metadata in/out
    60     60   .AP Tcl_Interp *interp in/out
    61     61   Interpreter providing the context for looking up or creating an object, and
    62     62   into whose result error messages will be written on failure.
    63     63   .AP Tcl_Obj *objPtr in
    64     64   The name of the object to look up.
    65     65   .AP Tcl_Object object in
    66     66   Reference to the object to operate upon.
................................................................................
    79     79   The arguments to the command to create the instance of the class.
    80     80   .AP int skip in
    81     81   The number of arguments at the start of the argument array, \fIobjv\fR, that
    82     82   are not arguments to any constructors.
    83     83   .AP Tcl_ObjectMetadataType *metaTypePtr in
    84     84   The type of \fImetadata\fR being set with \fBTcl_ClassSetMetadata\fR or
    85     85   retrieved with \fBTcl_ClassGetMetadata\fR.
    86         -.AP ClientData metadata in
           86  +.AP void *metadata in
    87     87   An item of metadata to attach to the class, or NULL to remove the metadata
    88     88   associated with a particular \fImetaTypePtr\fR.
    89     89   .AP "Tcl_ObjectMapMethodNameProc" "methodNameMapper" in
    90     90   A pointer to a function to call to adjust the mapping of objects and method
    91     91   names to implementations, or NULL when no such mapping is required.
    92     92   .BE
    93     93   .SH DESCRIPTION
................................................................................
   167    167   .SS "TCL_OBJECTMETADATADELETEPROC FUNCTION SIGNATURE"
   168    168   .PP
   169    169   Functions matching this signature are used to delete metadata associated with
   170    170   a class or object.
   171    171   .PP
   172    172   .CS
   173    173   typedef void \fBTcl_ObjectMetadataDeleteProc\fR(
   174         -        ClientData \fImetadata\fR);
          174  +        void *\fImetadata\fR);
   175    175   .CE
   176    176   .PP
   177    177   The \fImetadata\fR argument gives the address of the metadata to be
   178    178   deleted.
   179    179   .SS "TCL_CLONEPROC FUNCTION SIGNATURE"
   180    180   .PP
   181    181   Functions matching this signature are used to create copies of metadata
   182    182   associated with a class or object.
   183    183   .PP
   184    184   .CS
   185    185   typedef int \fBTcl_CloneProc\fR(
   186    186           Tcl_Interp *\fIinterp\fR,
   187         -        ClientData \fIsrcMetadata\fR,
   188         -        ClientData *\fIdstMetadataPtr\fR);
          187  +        void *\fIsrcMetadata\fR,
          188  +        void **\fIdstMetadataPtr\fR);
   189    189   .CE
   190    190   .PP
   191    191   The \fIinterp\fR argument gives a place to write an error message when the
   192    192   attempt to clone the object is to fail, in which case the clone procedure must
   193    193   also return TCL_ERROR; it should return TCL_OK otherwise.
   194    194   The \fIsrcMetadata\fR argument gives the address of the metadata to be cloned,
   195    195   and the cloned metadata should be written into the variable pointed to by

Changes to doc/CrtChannel.3.

    13     13   .SH SYNOPSIS
    14     14   .nf
    15     15   \fB#include <tcl.h>\fR
    16     16   .sp
    17     17   Tcl_Channel
    18     18   \fBTcl_CreateChannel\fR(\fItypePtr, channelName, instanceData, mask\fR)
    19     19   .sp
    20         -ClientData
           20  +void *
    21     21   \fBTcl_GetChannelInstanceData\fR(\fIchannel\fR)
    22     22   .sp
    23     23   const Tcl_ChannelType *
    24     24   \fBTcl_GetChannelType\fR(\fIchannel\fR)
    25     25   .sp
    26     26   const char *
    27     27   \fBTcl_GetChannelName\fR(\fIchannel\fR)
................................................................................
   124    124   can be called to perform I/O and other functions on the channel.
   125    125   .AP "const char" *channelName in
   126    126   The name of this channel, such as \fBfile3\fR; must not be in use
   127    127   by any other channel. Can be NULL, in which case the channel is
   128    128   created without a name. If the created channel is assigned to one
   129    129   of the standard channels (\fBstdin\fR, \fBstdout\fR or \fBstderr\fR),
   130    130   the assigned channel name will be the name of the standard channel.
   131         -.AP ClientData instanceData in
          131  +.AP void *instanceData in
   132    132   Arbitrary one-word value to be associated with this channel.  This
   133    133   value is passed to procedures in \fItypePtr\fR when they are invoked.
   134    134   .AP int mask in
   135    135   OR-ed combination of \fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR to indicate
   136    136   whether a channel is readable and writable.
   137    137   .AP Tcl_Channel channel in
   138    138   The channel to operate on.
   139    139   .AP int direction in
   140    140   \fBTCL_READABLE\fR means the input handle is wanted; \fBTCL_WRITABLE\fR
   141    141   means the output handle is wanted.
   142         -.AP ClientData *handlePtr out
          142  +.AP void **handlePtr out
   143    143   Points to the location where the desired OS-specific handle should be
   144    144   stored.
   145    145   .AP int size in
   146    146   The size, in bytes, of buffers to allocate in this channel.
   147    147   .AP int mask in
   148    148   An OR-ed combination of \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR
   149    149   and \fBTCL_EXCEPTION\fR that indicates events that have occurred on
................................................................................
   395    395   .PP
   396    396   The \fIblockModeProc\fR field contains the address of a function called by
   397    397   the generic layer to set blocking and nonblocking mode on the device.
   398    398   \fIBlockModeProc\fR should match the following prototype:
   399    399   .PP
   400    400   .CS
   401    401   typedef int \fBTcl_DriverBlockModeProc\fR(
   402         -        ClientData \fIinstanceData\fR,
          402  +        void *\fIinstanceData\fR,
   403    403           int \fImode\fR);
   404    404   .CE
   405    405   .PP
   406    406   The \fIinstanceData\fR is the same as the value passed to
   407    407   \fBTcl_CreateChannel\fR when this channel was created.  The \fImode\fR
   408    408   argument is either \fBTCL_MODE_BLOCKING\fR or \fBTCL_MODE_NONBLOCKING\fR to
   409    409   set the device into blocking or nonblocking mode. The function should
................................................................................
   430    430   .PP
   431    431   The \fIcloseProc\fR field contains the address of a function called by the
   432    432   generic layer to clean up driver-related information when the channel is
   433    433   closed. \fICloseProc\fR must match the following prototype:
   434    434   .PP
   435    435   .CS
   436    436   typedef int \fBTcl_DriverCloseProc\fR(
   437         -        ClientData \fIinstanceData\fR,
          437  +        void *\fIinstanceData\fR,
   438    438           Tcl_Interp *\fIinterp\fR);
   439    439   .CE
   440    440   .PP
   441    441   The \fIinstanceData\fR argument is the same as the value provided to
   442    442   \fBTcl_CreateChannel\fR when the channel was created. The function should
   443    443   release any storage maintained by the channel driver for this channel, and
   444    444   close the input and output devices encapsulated by this channel. All queued
................................................................................
   452    452   Alternatively, channels that support closing the read and write sides
   453    453   independently may set \fIcloseProc\fR to \fBTCL_CLOSE2PROC\fR and set
   454    454   \fIclose2Proc\fR to the address of a function that matches the
   455    455   following prototype:
   456    456   .PP
   457    457   .CS
   458    458   typedef int \fBTcl_DriverClose2Proc\fR(
   459         -        ClientData \fIinstanceData\fR,
          459  +        void *\fIinstanceData\fR,
   460    460           Tcl_Interp *\fIinterp\fR,
   461    461           int \fIflags\fR);
   462    462   .CE
   463    463   .PP
   464    464   The \fIclose2Proc\fR will be called with \fIflags\fR set to an OR'ed
   465    465   combination of \fBTCL_CLOSE_READ\fR or \fBTCL_CLOSE_WRITE\fR to
   466    466   indicate that the driver should close the read and/or write side of
................................................................................
   483    483   .PP
   484    484   The \fIinputProc\fR field contains the address of a function called by the
   485    485   generic layer to read data from the file or device and store it in an
   486    486   internal buffer. \fIInputProc\fR must match the following prototype:
   487    487   .PP
   488    488   .CS
   489    489   typedef int \fBTcl_DriverInputProc\fR(
   490         -        ClientData \fIinstanceData\fR,
          490  +        void *\fIinstanceData\fR,
   491    491           char *\fIbuf\fR,
   492    492           int \fIbufSize\fR,
   493    493           int *\fIerrorCodePtr\fR);
   494    494   .CE
   495    495   .PP
   496    496   \fIInstanceData\fR is the same as the value passed to
   497    497   \fBTcl_CreateChannel\fR when the channel was created.  The \fIbuf\fR
................................................................................
   527    527   .PP
   528    528   The \fIoutputProc\fR field contains the address of a function called by the
   529    529   generic layer to transfer data from an internal buffer to the output device.
   530    530   \fIOutputProc\fR must match the following prototype:
   531    531   .PP
   532    532   .CS
   533    533   typedef int \fBTcl_DriverOutputProc\fR(
   534         -        ClientData \fIinstanceData\fR,
          534  +        void *\fIinstanceData\fR,
   535    535           const char *\fIbuf\fR,
   536    536           int \fItoWrite\fR,
   537    537           int *\fIerrorCodePtr\fR);
   538    538   .CE
   539    539   .PP
   540    540   \fIInstanceData\fR is the same as the value passed to
   541    541   \fBTcl_CreateChannel\fR when the channel was created. The \fIbuf\fR
................................................................................
   566    566   The \fIseekProc\fR field contains the address of a function called by the
   567    567   generic layer to move the access point at which subsequent input or output
   568    568   operations will be applied. \fISeekProc\fR must match the following
   569    569   prototype:
   570    570   .PP
   571    571   .CS
   572    572   typedef int \fBTcl_DriverSeekProc\fR(
   573         -        ClientData \fIinstanceData\fR,
          573  +        void *\fIinstanceData\fR,
   574    574           long \fIoffset\fR,
   575    575           int \fIseekMode\fR,
   576    576           int *\fIerrorCodePtr\fR);
   577    577   .CE
   578    578   .PP
   579    579   The \fIinstanceData\fR argument is the same as the value given to
   580    580   \fBTcl_CreateChannel\fR when this channel was created.  \fIOffset\fR and
................................................................................
   596    596   within files larger than 2GB.  The \fIwideSeekProc\fR will be called
   597    597   in preference to the \fIseekProc\fR, but both must be defined if the
   598    598   \fIwideSeekProc\fR is defined.  \fIWideSeekProc\fR must match the
   599    599   following prototype:
   600    600   .PP
   601    601   .CS
   602    602   typedef Tcl_WideInt \fBTcl_DriverWideSeekProc\fR(
   603         -        ClientData \fIinstanceData\fR,
          603  +        void *\fIinstanceData\fR,
   604    604           Tcl_WideInt \fIoffset\fR,
   605    605           int \fIseekMode\fR,
   606    606           int *\fIerrorCodePtr\fR);
   607    607   .CE
   608    608   .PP
   609    609   The arguments and return values mean the same thing as with
   610    610   \fIseekProc\fR above, except that the type of offsets and the return
................................................................................
   618    618   .PP
   619    619   The \fIsetOptionProc\fR field contains the address of a function called by
   620    620   the generic layer to set a channel type specific option on a channel.
   621    621   \fIsetOptionProc\fR must match the following prototype:
   622    622   .PP
   623    623   .CS
   624    624   typedef int \fBTcl_DriverSetOptionProc\fR(
   625         -        ClientData \fIinstanceData\fR,
          625  +        void *\fIinstanceData\fR,
   626    626           Tcl_Interp *\fIinterp\fR,
   627    627           const char *\fIoptionName\fR,
   628    628           const char *\fInewValue\fR);
   629    629   .CE
   630    630   .PP
   631    631   \fIoptionName\fR is the name of an option to set, and \fInewValue\fR is
   632    632   the new value for that option, as a string. The \fIinstanceData\fR is the
................................................................................
   659    659   .PP
   660    660   The \fIgetOptionProc\fR field contains the address of a function called by
   661    661   the generic layer to get the value of a channel type specific option on a
   662    662   channel. \fIgetOptionProc\fR must match the following prototype:
   663    663   .PP
   664    664   .CS
   665    665   typedef int \fBTcl_DriverGetOptionProc\fR(
   666         -        ClientData \fIinstanceData\fR,
          666  +        void *\fIinstanceData\fR,
   667    667           Tcl_Interp *\fIinterp\fR,
   668    668           const char *\fIoptionName\fR,
   669    669           Tcl_DString *\fIoptionValue\fR);
   670    670   .CE
   671    671   .PP
   672    672   \fIOptionName\fR is the name of an option supported by this type of
   673    673   channel. If the option name is not NULL, the function stores its current
................................................................................
   697    697   The \fIwatchProc\fR field contains the address of a function called
   698    698   by the generic layer to initialize the event notification mechanism to
   699    699   notice events of interest on this channel.
   700    700   \fIWatchProc\fR should match the following prototype:
   701    701   .PP
   702    702   .CS
   703    703   typedef void \fBTcl_DriverWatchProc\fR(
   704         -        ClientData \fIinstanceData\fR,
          704  +        void *\fIinstanceData\fR,
   705    705           int \fImask\fR);
   706    706   .CE
   707    707   .PP
   708    708   The \fIinstanceData\fR is the same as the value passed to
   709    709   \fBTcl_CreateChannel\fR when this channel was created. The \fImask\fR
   710    710   argument is an OR-ed combination of \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR
   711    711   and \fBTCL_EXCEPTION\fR; it indicates events the caller is interested in
................................................................................
   728    728   .PP
   729    729   The \fIgetHandleProc\fR field contains the address of a function called by
   730    730   the generic layer to retrieve a device-specific handle from the channel.
   731    731   \fIGetHandleProc\fR should match the following prototype:
   732    732   .PP
   733    733   .CS
   734    734   typedef int \fBTcl_DriverGetHandleProc\fR(
   735         -        ClientData \fIinstanceData\fR,
          735  +        void *\fIinstanceData\fR,
   736    736           int \fIdirection\fR,
   737         -        ClientData *\fIhandlePtr\fR);
          737  +        void **\fIhandlePtr\fR);
   738    738   .CE
   739    739   .PP
   740    740   \fIInstanceData\fR is the same as the value passed to
   741    741   \fBTcl_CreateChannel\fR when this channel was created. The \fIdirection\fR
   742    742   argument is either \fBTCL_READABLE\fR to retrieve the handle used
   743    743   for input, or \fBTCL_WRITABLE\fR to retrieve the handle used for
   744    744   output.
................................................................................
   757    757   .PP
   758    758   The \fIflushProc\fR field is currently reserved for future use.
   759    759   It should be set to NULL.
   760    760   \fIFlushProc\fR should match the following prototype:
   761    761   .PP
   762    762   .CS
   763    763   typedef int \fBTcl_DriverFlushProc\fR(
   764         -        ClientData \fIinstanceData\fR);
          764  +        void *\fIinstanceData\fR);
   765    765   .CE
   766    766   .PP
   767    767   This value can be retrieved with \fBTcl_ChannelFlushProc\fR, which returns
   768    768   a pointer to the function.
   769    769   .SS HANDLERPROC
   770    770   .PP
   771    771   The \fIhandlerProc\fR field contains the address of a function called by
................................................................................
   772    772   the generic layer to notify the channel that an event occurred.  It should
   773    773   be defined for stacked channel drivers that wish to be notified of events
   774    774   that occur on the underlying (stacked) channel.
   775    775   \fIHandlerProc\fR should match the following prototype:
   776    776   .PP
   777    777   .CS
   778    778   typedef int \fBTcl_DriverHandlerProc\fR(
   779         -        ClientData \fIinstanceData\fR,
          779  +        void *\fIinstanceData\fR,
   780    780           int \fIinterestMask\fR);
   781    781   .CE
   782    782   .PP
   783    783   \fIInstanceData\fR is the same as the value passed to \fBTcl_CreateChannel\fR
   784    784   when this channel was created.  The \fIinterestMask\fR is an OR-ed
   785    785   combination of \fBTCL_READABLE\fR or \fBTCL_WRITABLE\fR; it indicates what
   786    786   type of event occurred on this channel.
................................................................................
   801    801   The action \fITCL_CHANNEL_THREAD_INSERT\fR is used to notify the
   802    802   driver that it should update or initialize any thread-specific data it
   803    803   might be maintaining using the calling thread as the associate. See
   804    804   \fBTcl_CutChannel\fR and \fBTcl_SpliceChannel\fR for more detail.
   805    805   .PP
   806    806   .CS
   807    807   typedef void \fBTcl_DriverThreadActionProc\fR(
   808         -        ClientData \fIinstanceData\fR,
          808  +        void *\fIinstanceData\fR,
   809    809           int \fIaction\fR);
   810    810   .CE
   811    811   .PP
   812    812   \fIInstanceData\fR is the same as the value passed to
   813    813   \fBTcl_CreateChannel\fR when this channel was created.
   814    814   .PP
   815    815   These values can be retrieved with \fBTcl_ChannelThreadActionProc\fR,
................................................................................
   818    818   .PP
   819    819   The \fItruncateProc\fR field contains the address of the function
   820    820   called by the generic layer when a channel is truncated to some
   821    821   length. It can be NULL.
   822    822   .PP
   823    823   .CS
   824    824   typedef int \fBTcl_DriverTruncateProc\fR(
   825         -        ClientData \fIinstanceData\fR,
          825  +        void *\fIinstanceData\fR,
   826    826           Tcl_WideInt \fIlength\fR);
   827    827   .CE
   828    828   .PP
   829    829   \fIInstanceData\fR is the same as the value passed to
   830    830   \fBTcl_CreateChannel\fR when this channel was created, and
   831    831   \fIlength\fR is the new length of the underlying file, which should
   832    832   not be negative. The result should be 0 on success or an errno code

Changes to doc/CrtChnlHdlr.3.

    28     28   .AP int mask in
    29     29   Conditions under which \fIproc\fR should be called: OR-ed combination of
    30     30   \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR and \fBTCL_EXCEPTION\fR. Specify
    31     31   a zero value to temporarily disable an existing handler.
    32     32   .AP Tcl_FileProc *proc in
    33     33   Procedure to invoke whenever the channel indicated by \fIchannel\fR meets
    34     34   the conditions specified by \fImask\fR.
    35         -.AP ClientData clientData in
           35  +.AP void *clientData in
    36     36   Arbitrary one-word value to pass to \fIproc\fR.
    37     37   .BE
    38     38   .SH DESCRIPTION
    39     39   .PP
    40     40   \fBTcl_CreateChannelHandler\fR arranges for \fIproc\fR to be called in the
    41     41   future whenever input or output becomes possible on the channel identified
    42     42   by \fIchannel\fR, or whenever an exceptional condition exists for
................................................................................
    44     44   invoked are specified by the \fImask\fR argument.
    45     45   See the manual entry for \fBfileevent\fR for a precise description of
    46     46   what it means for a channel to be readable or writable.
    47     47   \fIProc\fR must conform to the following prototype:
    48     48   .PP
    49     49   .CS
    50     50   typedef void \fBTcl_ChannelProc\fR(
    51         -        ClientData \fIclientData\fR,
           51  +        void *\fIclientData\fR,
    52     52           int \fImask\fR);
    53     53   .CE
    54     54   .PP
    55     55   The \fIclientData\fR argument is the same as the value passed to
    56     56   \fBTcl_CreateChannelHandler\fR when the handler was created. Typically,
    57     57   \fIclientData\fR points to a data structure containing application-specific
    58     58   information about the channel. \fIMask\fR is an integer mask indicating

Changes to doc/CrtCloseHdlr.3.

    22     22   .sp
    23     23   .SH ARGUMENTS
    24     24   .AS Tcl_CloseProc clientData
    25     25   .AP Tcl_Channel channel in
    26     26   The channel for which to create or delete a close callback.
    27     27   .AP Tcl_CloseProc *proc in
    28     28   The procedure to call as the callback.
    29         -.AP ClientData clientData in
           29  +.AP void *clientData in
    30     30   Arbitrary one-word value to pass to \fIproc\fR.
    31     31   .BE
    32     32   .SH DESCRIPTION
    33     33   .PP
    34     34   \fBTcl_CreateCloseHandler\fR arranges for \fIproc\fR to be called when
    35     35   \fIchannel\fR is closed with \fBTcl_Close\fR or
    36     36   \fBTcl_UnregisterChannel\fR, or using the Tcl \fBclose\fR command.
    37     37   \fIProc\fR should match the following prototype:
    38     38   .PP
    39     39   .CS
    40     40   typedef void \fBTcl_CloseProc\fR(
    41         -        ClientData \fIclientData\fR);
           41  +        void *\fIclientData\fR);
    42     42   .CE
    43     43   .PP
    44     44   The \fIclientData\fR is the same as the value provided in the call to
    45     45   \fBTcl_CreateCloseHandler\fR.
    46     46   .PP
    47     47   \fBTcl_DeleteCloseHandler\fR removes a close callback for \fIchannel\fR.
    48     48   The \fIproc\fR and \fIclientData\fR identify which close callback to

Changes to doc/CrtCommand.3.

    21     21   .AP Tcl_Interp *interp in
    22     22   Interpreter in which to create new command.
    23     23   .AP "const char" *cmdName in
    24     24   Name of command.
    25     25   .AP Tcl_CmdProc *proc in
    26     26   Implementation of new command:  \fIproc\fR will be called whenever
    27     27   \fIcmdName\fR is invoked as a command.
    28         -.AP ClientData clientData in
           28  +.AP voie *clientData in
    29     29   Arbitrary one-word value to pass to \fIproc\fR and \fIdeleteProc\fR.
    30     30   .AP Tcl_CmdDeleteProc *deleteProc in
    31     31   Procedure to call before \fIcmdName\fR is deleted from the interpreter;
    32     32   allows for command-specific cleanup.  If NULL, then no procedure is
    33     33   called before the command is deleted.
    34     34   .BE
    35     35   .SH DESCRIPTION
................................................................................
    71     71   the process of being deleted, then it does not create a new command
    72     72   and it returns NULL.
    73     73   \fIProc\fR should have arguments and result that match the type
    74     74   \fBTcl_CmdProc\fR:
    75     75   .PP
    76     76   .CS
    77     77   typedef int \fBTcl_CmdProc\fR(
    78         -        ClientData \fIclientData\fR,
           78  +        void *\fIclientData\fR,
    79     79           Tcl_Interp *\fIinterp\fR,
    80     80           int \fIargc\fR,
    81     81           const char *\fIargv\fR[]);
    82     82   .CE
    83     83   .PP
    84     84   When \fIproc\fR is invoked the \fIclientData\fR and \fIinterp\fR
    85     85   parameters will be copies of the \fIclientData\fR and \fIinterp\fR
................................................................................
   127    127   \fIDeleteProc\fR is invoked before the command is deleted, and gives the
   128    128   application an opportunity to release any structures associated
   129    129   with the command.  \fIDeleteProc\fR should have arguments and
   130    130   result that match the type \fBTcl_CmdDeleteProc\fR:
   131    131   .PP
   132    132   .CS
   133    133   typedef void \fBTcl_CmdDeleteProc\fR(
   134         -        ClientData \fIclientData\fR);
          134  +        void *\fIclientData\fR);
   135    135   .CE
   136    136   .PP
   137    137   The \fIclientData\fR argument will be the same as the \fIclientData\fR
   138    138   argument passed to \fBTcl_CreateCommand\fR.
   139    139   .SH "SEE ALSO"
   140    140   Tcl_CreateObjCommand, Tcl_DeleteCommand, Tcl_GetCommandInfo,
   141    141   Tcl_SetCommandInfo, Tcl_GetCommandName, Tcl_SetObjResult
   142    142   .SH KEYWORDS
   143    143   bind, command, create, delete, interpreter, namespace

Changes to doc/CrtFileHdlr.3.

    25     25   Conditions under which \fIproc\fR should be called:
    26     26   OR-ed combination of \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR,
    27     27   and \fBTCL_EXCEPTION\fR.  May be set to 0 to temporarily disable
    28     28   a handler.
    29     29   .AP Tcl_FileProc *proc in
    30     30   Procedure to invoke whenever the file or device indicated
    31     31   by \fIfile\fR meets the conditions specified by \fImask\fR.
    32         -.AP ClientData clientData in
           32  +.AP void *clientData in
    33     33   Arbitrary one-word value to pass to \fIproc\fR.
    34     34   .BE
    35     35   .SH DESCRIPTION
    36     36   .PP
    37     37   \fBTcl_CreateFileHandler\fR arranges for \fIproc\fR to be
    38     38   invoked in the future whenever I/O becomes possible on a file
    39     39   or an exceptional condition exists for the file.  The file
................................................................................
    47     47   as \fBvwait\fR.
    48     48   .PP
    49     49   \fIProc\fR should have arguments and result that match the
    50     50   type \fBTcl_FileProc\fR:
    51     51   .PP
    52     52   .CS
    53     53   typedef void \fBTcl_FileProc\fR(
    54         -        ClientData \fIclientData\fR,
           54  +        void *\fIclientData\fR,
    55     55           int \fImask\fR);
    56     56   .CE
    57     57   .PP
    58     58   The \fIclientData\fR parameter to \fIproc\fR is a copy
    59     59   of the \fIclientData\fR
    60     60   argument given to \fBTcl_CreateFileHandler\fR when the callback
    61     61   was created.  Typically, \fIclientData\fR points to a data

Changes to doc/CrtObjCmd.3.

    55     55   .AP Tcl_Interp *interp in
    56     56   Interpreter in which to create a new command or that contains a command.
    57     57   .AP char *cmdName in
    58     58   Name of command.
    59     59   .AP Tcl_ObjCmdProc *proc in
    60     60   Implementation of the new command: \fIproc\fR will be called whenever
    61     61   \fIcmdName\fR is invoked as a command.
    62         -.AP ClientData clientData in
           62  +.AP void *clientData in
    63     63   Arbitrary one-word value to pass to \fIproc\fR and \fIdeleteProc\fR.
    64     64   .AP Tcl_CmdDeleteProc *deleteProc in
    65     65   Procedure to call before \fIcmdName\fR is deleted from the interpreter;
    66     66   allows for command-specific cleanup. If NULL, then no procedure is
    67     67   called before the command is deleted.
    68     68   .AP Tcl_Command token in
    69     69   Token for command, returned by previous call to \fBTcl_CreateObjCommand\fR.
................................................................................
    98     98   the process of being deleted, then it does not create a new command
    99     99   and it returns NULL.
   100    100   \fIproc\fR should have arguments and result that match the type
   101    101   \fBTcl_ObjCmdProc\fR:
   102    102   .PP
   103    103   .CS
   104    104   typedef int \fBTcl_ObjCmdProc\fR(
   105         -        ClientData \fIclientData\fR,
          105  +        void *\fIclientData\fR,
   106    106           Tcl_Interp *\fIinterp\fR,
   107    107           int \fIobjc\fR,
   108    108           Tcl_Obj *const \fIobjv\fR[]);
   109    109   .CE
   110    110   .PP
   111    111   When \fIproc\fR is invoked, the \fIclientData\fR and \fIinterp\fR parameters
   112    112   will be copies of the \fIclientData\fR and \fIinterp\fR arguments given to
................................................................................
   171    171   \fIDeleteProc\fR is invoked before the command is deleted, and gives the
   172    172   application an opportunity to release any structures associated
   173    173   with the command.  \fIDeleteProc\fR should have arguments and
   174    174   result that match the type \fBTcl_CmdDeleteProc\fR:
   175    175   .PP
   176    176   .CS
   177    177   typedef void \fBTcl_CmdDeleteProc\fR(
   178         -        ClientData \fIclientData\fR);
          178  +        void *\fIclientData\fR);
   179    179   .CE
   180    180   .PP
   181    181   The \fIclientData\fR argument will be the same as the \fIclientData\fR
   182    182   argument passed to \fBTcl_CreateObjCommand\fR.
   183    183   .PP
   184    184   \fBTcl_DeleteCommand\fR deletes a command from a command interpreter.
   185    185   Once the call completes, attempts to invoke \fIcmdName\fR in
................................................................................
   213    213   pointed to by \fIinfoPtr\fR and returns 1.
   214    214   A \fBTcl_CmdInfo\fR structure has the following fields:
   215    215   .PP
   216    216   .CS
   217    217   typedef struct Tcl_CmdInfo {
   218    218       int \fIisNativeObjectProc\fR;
   219    219       Tcl_ObjCmdProc *\fIobjProc\fR;
   220         -    ClientData \fIobjClientData\fR;
          220  +    void *\fIobjClientData\fR;
   221    221       Tcl_CmdProc *\fIproc\fR;
   222         -    ClientData \fIclientData\fR;
          222  +    void *\fIclientData\fR;
   223    223       Tcl_CmdDeleteProc *\fIdeleteProc\fR;
   224         -    ClientData \fIdeleteData\fR;
          224  +    void *\fIdeleteData\fR;
   225    225       Tcl_Namespace *\fInamespacePtr\fR;
   226    226   } \fBTcl_CmdInfo\fR;
   227    227   .CE
   228    228   .PP
   229    229   The \fIisNativeObjectProc\fR field has the value 1
   230    230   if \fBTcl_CreateObjCommand\fR was called to register the command;
   231    231   it is 0 if only \fBTcl_CreateCommand\fR was called.
................................................................................
   243    243   that implements the command.
   244    244   If \fBTcl_CreateCommand\fR was called for this command,
   245    245   this is the procedure passed to it;
   246    246   otherwise, this is a compatibility procedure
   247    247   registered by \fBTcl_CreateObjCommand\fR
   248    248   that simply calls the command's
   249    249   value-based procedure after converting its string arguments to Tcl values.
   250         -The field \fIdeleteData\fR is the ClientData value
          250  +The field \fIdeleteData\fR is the clientData value
   251    251   to pass to \fIdeleteProc\fR;  it is normally the same as
   252    252   \fIclientData\fR but may be set independently using the
   253    253   \fBTcl_SetCommandInfo\fR procedure.
   254    254   The field \fInamespacePtr\fR holds a pointer to the
   255    255   Tcl_Namespace that contains the command.
   256    256   .PP
   257    257   \fBTcl_GetCommandInfoFromToken\fR is identical to
   258    258   \fBTcl_GetCommandInfo\fR except that it uses a command token returned
   259    259   from \fBTcl_CreateObjCommand\fR in place of the command name.  If the
   260    260   \fItoken\fR parameter is NULL, it returns 0; otherwise, it returns 1
   261    261   and fills in the structure designated by \fIinfoPtr\fR.
   262    262   .PP
   263    263   \fBTcl_SetCommandInfo\fR is used to modify the procedures and
   264         -ClientData values associated with a command.
          264  +clientData values associated with a command.
   265    265   Its \fIcmdName\fR argument is the name of a command in \fIinterp\fR.
   266    266   \fIcmdName\fR may include \fB::\fR namespace qualifiers
   267    267   to identify a command in a particular namespace.
   268    268   If this command does not exist then \fBTcl_SetCommandInfo\fR returns 0.
   269    269   Otherwise, it copies the information from \fI*infoPtr\fR to
   270    270   Tcl's internal structure for the command and returns 1.
   271    271   .PP
................................................................................
   273    273   \fBTcl_SetCommandInfo\fR except that it takes a command token as
   274    274   returned by \fBTcl_CreateObjCommand\fR instead of the command name.
   275    275   If the \fItoken\fR parameter is NULL, it returns 0.  Otherwise, it
   276    276   copies the information from \fI*infoPtr\fR to Tcl's internal structure
   277    277   for the command and returns 1.
   278    278   .PP
   279    279   Note that \fBTcl_SetCommandInfo\fR and
   280         -\fBTcl_SetCommandInfoFromToken\fR both allow the ClientData for a
          280  +\fBTcl_SetCommandInfoFromToken\fR both allow the clientData for a
   281    281   command's deletion procedure to be given a different value than the
   282         -ClientData for its command procedure.
          282  +clientData for its command procedure.
   283    283   .PP
   284    284   Note that neither \fBTcl_SetCommandInfo\fR nor
   285    285   \fBTcl_SetCommandInfoFromToken\fR will change a command's namespace.
   286    286   Use \fBTcl_Eval\fR to call the \fBrename\fR command to do that.
   287    287   .PP
   288    288   \fBTcl_GetCommandName\fR provides a mechanism for tracking commands
   289    289   that have been renamed.

Changes to doc/CrtTimerHdlr.3.

    20     20   \fBTcl_DeleteTimerHandler\fR(\fItoken\fR)
    21     21   .SH ARGUMENTS
    22     22   .AS Tcl_TimerToken milliseconds
    23     23   .AP int milliseconds  in
    24     24   How many milliseconds to wait before invoking \fIproc\fR.
    25     25   .AP Tcl_TimerProc *proc in
    26     26   Procedure to invoke after \fImilliseconds\fR have elapsed.
    27         -.AP ClientData clientData in
           27  +.AP void *clientData in
    28     28   Arbitrary one-word value to pass to \fIproc\fR.
    29     29   .AP Tcl_TimerToken token in
    30     30   Token for previously created timer handler (the return value
    31     31   from some previous call to \fBTcl_CreateTimerHandler\fR).
    32     32   .BE
    33     33   .SH DESCRIPTION
    34     34   .PP
................................................................................
    47     47   \fIproc\fR, then the call to \fIproc\fR will be delayed.
    48     48   .PP
    49     49   \fIProc\fR should have arguments and return value that match
    50     50   the type \fBTcl_TimerProc\fR:
    51     51   .PP
    52     52   .CS
    53     53   typedef void \fBTcl_TimerProc\fR(
    54         -        ClientData \fIclientData\fR);
           54  +        void *\fIclientData\fR);
    55     55   .CE
    56     56   .PP
    57     57   The \fIclientData\fR parameter to \fIproc\fR is a
    58     58   copy of the \fIclientData\fR argument given to
    59     59   \fBTcl_CreateTimerHandler\fR when the callback
    60     60   was created.  Typically, \fIclientData\fR points to a data
    61     61   structure containing application-specific information about

Changes to doc/CrtTrace.3.

    37     37   Flags governing the trace execution.  See below for details.
    38     38   .AP Tcl_CmdObjTraceProc *objProc in
    39     39   Procedure to call for each command that is executed.  See below for
    40     40   details of the calling sequence.
    41     41   .AP Tcl_CmdTraceProc *proc in
    42     42   Procedure to call for each command that is executed.  See below for
    43     43   details on the calling sequence.
    44         -.AP ClientData clientData in
           44  +.AP void *clientData in
    45     45   Arbitrary one-word value to pass to \fIobjProc\fR or \fIproc\fR.
    46     46   .AP Tcl_CmdObjTraceDeleteProc *deleteProc in
    47     47   Procedure to call when the trace is deleted.  See below for details of
    48     48   the calling sequence.  A NULL pointer is permissible and results in no
    49     49   callback when the trace is deleted.
    50     50   .AP Tcl_Trace trace in
    51     51   Token for trace to be removed (return value from previous call
................................................................................
    62     62   interpreter.
    63     63   .PP
    64     64   \fIobjProc\fR should have arguments and result that match the type,
    65     65   \fBTcl_CmdObjTraceProc\fR:
    66     66   .PP
    67     67   .CS
    68     68   typedef int \fBTcl_CmdObjTraceProc\fR(
    69         -        \fBClientData\fR \fIclientData\fR,
           69  +        \fBvoid *\fR \fIclientData\fR,
    70     70           \fBTcl_Interp\fR* \fIinterp\fR,
    71     71           int \fIlevel\fR,
    72     72           const char *\fIcommand\fR,
    73     73           \fBTcl_Command\fR \fIcommandToken\fR,
    74     74           int \fIobjc\fR,
    75     75           \fBTcl_Obj\fR *const \fIobjv\fR[]);
    76     76   .CE
    77     77   .PP
    78     78   The \fIclientData\fR and \fIinterp\fR parameters are copies of the
    79     79   corresponding arguments given to \fBTcl_CreateTrace\fR.
    80         -\fIClientData\fR typically points to an application-specific data
           80  +\fIclientData\fR typically points to an application-specific data
    81     81   structure that describes what to do when \fIobjProc\fR is invoked.  The
    82     82   \fIlevel\fR parameter gives the nesting level of the command (1 for
    83     83   top-level commands passed to \fBTcl_Eval\fR by the application, 2 for
    84     84   the next-level commands passed to \fBTcl_Eval\fR as part of parsing or
    85     85   interpreting level-1 commands, and so on). The \fIcommand\fR parameter
    86     86   points to a string containing the text of the command, before any
    87     87   argument substitution.  The \fIcommandToken\fR parameter is a Tcl
................................................................................
   140    140   When \fBTcl_DeleteTrace\fR is called, the interpreter invokes the
   141    141   \fIdeleteProc\fR that was passed as a parameter to
   142    142   \fBTcl_CreateObjTrace\fR.  The \fIdeleteProc\fR must match the type,
   143    143   \fBTcl_CmdObjTraceDeleteProc\fR:
   144    144   .PP
   145    145   .CS
   146    146   typedef void \fBTcl_CmdObjTraceDeleteProc\fR(
   147         -        \fBClientData\fR \fIclientData\fR);
          147  +        \fBvoid *\fR \fIclientData\fR);
   148    148   .CE
   149    149   .PP
   150    150   The \fIclientData\fR parameter will be the same as the
   151    151   \fIclientData\fR parameter that was originally passed to
   152    152   \fBTcl_CreateObjTrace\fR.
   153    153   .PP
   154    154   \fBTcl_CreateTrace\fR is an alternative interface for command tracing,
................................................................................
   156    156   compatibility with code that was developed for older versions of the
   157    157   Tcl interpreter.  It is similar to \fBTcl_CreateObjTrace\fR, except
   158    158   that its \fIproc\fR parameter should have arguments and result that
   159    159   match the type \fBTcl_CmdTraceProc\fR:
   160    160   .PP
   161    161   .CS
   162    162   typedef void \fBTcl_CmdTraceProc\fR(
   163         -        ClientData \fIclientData\fR,
          163  +        void *\fIclientData\fR,
   164    164           Tcl_Interp *\fIinterp\fR,
   165    165           int \fIlevel\fR,
   166    166           char *\fIcommand\fR,
   167    167           Tcl_CmdProc *\fIcmdProc\fR,
   168         -        ClientData \fIcmdClientData\fR,
          168  +        void *\fIcmdClientData\fR,
   169    169           int \fIargc\fR,
   170    170           const char *\fIargv\fR[]);
   171    171   .CE
   172    172   .PP
   173    173   The parameters to the \fIproc\fR callback are similar to those of the
   174    174   \fIobjProc\fR callback above. The \fIcommandToken\fR is
   175    175   replaced with \fIcmdProc\fR, a pointer to the (string-based) command

Changes to doc/DString.3.

    22     22   char *
    23     23   \fBTcl_DStringAppendElement\fR(\fIdsPtr, element\fR)
    24     24   .sp
    25     25   \fBTcl_DStringStartSublist\fR(\fIdsPtr\fR)
    26     26   .sp
    27     27   \fBTcl_DStringEndSublist\fR(\fIdsPtr\fR)
    28     28   .sp
    29         -int
           29  +size_t
    30     30   \fBTcl_DStringLength\fR(\fIdsPtr\fR)
    31     31   .sp
    32     32   char *
    33     33   \fBTcl_DStringValue\fR(\fIdsPtr\fR)
    34     34   .sp
    35     35   \fBTcl_DStringSetLength\fR(\fIdsPtr, newLength\fR)
    36     36   .sp
................................................................................
    43     43   .AS Tcl_DString newLength in/out
    44     44   .AP Tcl_DString *dsPtr in/out
    45     45   Pointer to structure that is used to manage a dynamic string.
    46     46   .AP "const char" *bytes in
    47     47   Pointer to characters to append to dynamic string.
    48     48   .AP "const char" *element in
    49     49   Pointer to characters to append as list element to dynamic string.
    50         -.AP int length in
    51         -Number of bytes from \fIbytes\fR to add to dynamic string.  If -1,
           50  +.AP size_t length in
           51  +Number of bytes from \fIbytes\fR to add to dynamic string.  If (size_t)-1,
    52     52   add all characters up to null terminating character.
    53         -.AP int newLength in
           53  +.AP size_t newLength in
    54     54   New length for dynamic string, not including null terminating
    55     55   character.
    56     56   .AP Tcl_Interp *interp in/out
    57     57   Interpreter whose result is to be set from or moved to the
    58     58   dynamic string.
    59     59   .BE
    60     60   

Changes to doc/DoWhenIdle.3.

    17     17   \fBTcl_DoWhenIdle\fR(\fIproc, clientData\fR)
    18     18   .sp
    19     19   \fBTcl_CancelIdleCall\fR(\fIproc, clientData\fR)
    20     20   .SH ARGUMENTS
    21     21   .AS Tcl_IdleProc clientData
    22     22   .AP Tcl_IdleProc *proc in
    23     23   Procedure to invoke.
    24         -.AP ClientData clientData in
           24  +.AP coid *clientData in
    25     25   Arbitrary one-word value to pass to \fIproc\fR.
    26     26   .BE
    27     27   .SH DESCRIPTION
    28     28   .PP
    29     29   \fBTcl_DoWhenIdle\fR arranges for \fIproc\fR to be invoked
    30     30   when the application becomes idle.  The application is
    31     31   considered to be idle when \fBTcl_DoOneEvent\fR has been
................................................................................
    39     39   use \fBTcl_DoOneEvent\fR to dispatch events.
    40     40   .PP
    41     41   \fIProc\fR should have arguments and result that match the
    42     42   type \fBTcl_IdleProc\fR:
    43     43   .PP
    44     44   .CS
    45     45   typedef void \fBTcl_IdleProc\fR(
    46         -        ClientData \fIclientData\fR);
           46  +        void *\fIclientData\fR);
    47     47   .CE
    48     48   .PP
    49     49   The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR
    50     50   argument given to \fBTcl_DoWhenIdle\fR.  Typically, \fIclientData\fR
    51     51   points to a data structure containing application-specific information about
    52     52   what \fIproc\fR should do.
    53     53   .PP

Changes to doc/DumpActiveMemory.3.

    39     39   They are only functional when Tcl has been compiled with
    40     40   \fBTCL_MEM_DEBUG\fR defined at compile-time.  When \fBTCL_MEM_DEBUG\fR
    41     41   is not defined, these functions are all no-ops.
    42     42   .PP
    43     43   \fBTcl_DumpActiveMemory\fR will output a list of all currently
    44     44   allocated memory to the specified file.  The information output for
    45     45   each allocated block of memory is:  starting and ending addresses
    46         -(excluding guard zone), size, source file where \fBckalloc\fR was
           46  +(excluding guard zone), size, source file where \fBTcl_Alloc\fR was
    47     47   called to allocate the block and line number in that file.  It is
    48     48   especially useful to call \fBTcl_DumpActiveMemory\fR after the Tcl
    49     49   interpreter has been deleted.
    50     50   .PP
    51     51   \fBTcl_InitMemory\fR adds the Tcl \fBmemory\fR command to the
    52     52   interpreter given by \fIinterp\fR.  \fBTcl_InitMemory\fR is called
    53     53   by \fBTcl_Main\fR.
    54     54   .PP
    55     55   \fBTcl_ValidateAllMemory\fR forces a validation of the guard zones of
    56     56   all currently allocated blocks of memory.  Normally validation of a
    57     57   block occurs when its freed, unless full validation is enabled, in
    58         -which case validation of all blocks occurs when \fBckalloc\fR and
    59         -\fBckfree\fR are called.  This function forces the validation to occur
           58  +which case validation of all blocks occurs when \fBTcl_Alloc\fR and
           59  +\fBTcl_Free\fR are called.  This function forces the validation to occur
    60     60   at any point.
    61     61   
    62     62   .SH "SEE ALSO"
    63     63   TCL_MEM_DEBUG, memory
    64     64   
    65     65   .SH KEYWORDS
    66     66   memory, debug
    67     67   
    68     68   

Changes to doc/Encoding.3.

    79     79   .AP "const char" *src in
    80     80   For the \fBTcl_ExternalToUtf\fR functions, an array of bytes in the
    81     81   specified encoding that are to be converted to UTF-8.  For the
    82     82   \fBTcl_UtfToExternal\fR and \fBTcl_WinUtfToTChar\fR functions, an array of
    83     83   UTF-8 characters to be converted to the specified encoding.
    84     84   .AP "const TCHAR" *tsrc in
    85     85   An array of Windows TCHAR characters to convert to UTF-8.
    86         -.AP int srcLen in
           86  +.AP size_t srcLen in
    87     87   Length of \fIsrc\fR or \fItsrc\fR in bytes.  If the length is negative, the
    88     88   encoding-specific length of the string is used.
    89     89   .AP Tcl_DString *dstPtr out
    90     90   Pointer to an uninitialized or free \fBTcl_DString\fR in which the converted
    91     91   result will be stored.
    92     92   .AP int flags in
    93     93   Various flag bits OR-ed together.
................................................................................
   304    304   .PP
   305    305   .CS
   306    306   typedef struct Tcl_EncodingType {
   307    307       const char *\fIencodingName\fR;
   308    308       Tcl_EncodingConvertProc *\fItoUtfProc\fR;
   309    309       Tcl_EncodingConvertProc *\fIfromUtfProc\fR;
   310    310       Tcl_EncodingFreeProc *\fIfreeProc\fR;
   311         -    ClientData \fIclientData\fR;
          311  +    void *\fIclientData\fR;
   312    312       int \fInullSize\fR;
   313    313   } \fBTcl_EncodingType\fR;
   314    314   .CE
   315    315   .PP
   316    316   The \fIencodingName\fR provides a string name for the encoding, by
   317    317   which it can be referred in other procedures such as
   318    318   \fBTcl_GetEncoding\fR.  The \fItoUtfProc\fR refers to a callback
................................................................................
   335    335   CNS11643) are not accepted.
   336    336   .PP
   337    337   The callback procedures \fItoUtfProc\fR and \fIfromUtfProc\fR should match the
   338    338   type \fBTcl_EncodingConvertProc\fR:
   339    339   .PP
   340    340   .CS
   341    341   typedef int \fBTcl_EncodingConvertProc\fR(
   342         -        ClientData \fIclientData\fR,
          342  +        void *\fIclientData\fR,
   343    343           const char *\fIsrc\fR,
   344    344           int \fIsrcLen\fR,
   345    345           int \fIflags\fR,
   346    346           Tcl_EncodingState *\fIstatePtr\fR,
   347    347           char *\fIdst\fR,
   348    348           int \fIdstLen\fR,
   349    349           int *\fIsrcReadPtr\fR,
................................................................................
   367    367   procedure will be a non-NULL location.
   368    368   .PP
   369    369   The callback procedure \fIfreeProc\fR, if non-NULL, should match the type
   370    370   \fBTcl_EncodingFreeProc\fR:
   371    371   .PP
   372    372   .CS
   373    373   typedef void \fBTcl_EncodingFreeProc\fR(
   374         -        ClientData \fIclientData\fR);
          374  +        void *\fIclientData\fR);
   375    375   .CE
   376    376   .PP
   377    377   This \fIfreeProc\fR function is called when the encoding is deleted.  The
   378    378   \fIclientData\fR parameter is the same as the \fIclientData\fR field
   379    379   specified to \fBTcl_CreateEncoding\fR when the encoding was created.
   380    380   .PP
   381    381   \fBTcl_GetEncodingSearchPath\fR and \fBTcl_SetEncodingSearchPath\fR

Changes to doc/Exit.3.

    38     38   Exact meaning may
    39     39   be platform-specific.  0 usually means a normal exit, any nonzero value
    40     40   usually means that an error occurred.
    41     41   .AP Tcl_ExitProc *proc in
    42     42   Procedure to invoke before exiting application, or (for
    43     43   \fBTcl_SetExitProc\fR) NULL to uninstall the current application exit
    44     44   procedure.
    45         -.AP ClientData clientData in
           45  +.AP void *clientData in
    46     46   Arbitrary one-word value to pass to \fIproc\fR.
    47     47   .BE
    48     48   
    49     49   .SH DESCRIPTION
    50     50   .PP
    51     51   The procedures described here provide a graceful mechanism to end the
    52     52   execution of a \fBTcl\fR application. Exit handlers are invoked to cleanup the
................................................................................
    60     60   Note that if other code invokes \fBexit\fR system procedure directly, or
    61     61   otherwise causes the application to terminate without calling
    62     62   \fBTcl_Exit\fR, the exit handlers will not be run.
    63     63   \fBTcl_Exit\fR internally invokes the \fBexit\fR system call, thus it never
    64     64   returns control to its caller.
    65     65   If an application exit handler has been installed (see
    66     66   \fBTcl_SetExitProc\fR), that handler is invoked with an argument
    67         -consisting of the exit status (cast to ClientData); the application
           67  +consisting of the exit status (cast to void *); the application
    68     68   exit handler should not return control to Tcl.
    69     69   .PP
    70     70   \fBTcl_Finalize\fR is similar to \fBTcl_Exit\fR except that it does not
    71     71   exit from the current process.
    72     72   It is useful for cleaning up when a process is finished using \fBTcl\fR but
    73     73   wishes to continue executing, and when \fBTcl\fR is used in a dynamically
    74     74   loaded extension that is about to be unloaded.
................................................................................
    89     89   by \fBTcl_FinalizeThread\fR and \fBTcl_ExitThread\fR.
    90     90   This provides a hook for cleanup operations such as flushing buffers
    91     91   and freeing global memory.
    92     92   \fIProc\fR should match the type \fBTcl_ExitProc\fR:
    93     93   .PP
    94     94   .CS
    95     95   typedef void \fBTcl_ExitProc\fR(
    96         -        ClientData \fIclientData\fR);
           96  +        void *\fIclientData\fR);
    97     97   .CE
    98     98   .PP
    99     99   The \fIclientData\fR parameter to \fIproc\fR is a
   100    100   copy of the \fIclientData\fR argument given to
   101    101   \fBTcl_CreateExitHandler\fR or \fBTcl_CreateThreadExitHandler\fR when
   102    102   the callback
   103    103   was created.  Typically, \fIclientData\fR points to a data
................................................................................
   129    129   \fBTcl_SetExitProc\fR installs an application exit handler, returning
   130    130   the previously-installed application exit handler or NULL if no
   131    131   application handler was installed.  If an application exit handler is
   132    132   installed, that exit handler takes over complete responsibility for
   133    133   finalization of Tcl's subsystems via \fBTcl_Finalize\fR at an
   134    134   appropriate time.  The argument passed to \fIproc\fR when it is
   135    135   invoked will be the exit status code (as passed to \fBTcl_Exit\fR)
   136         -cast to a ClientData value.
          136  +cast to a void *value.
   137    137   .SH "SEE ALSO"
   138    138   exit(n)
   139    139   .SH KEYWORDS
   140    140   abort, callback, cleanup, dynamic loading, end application, exit, unloading, thread

Changes to doc/FileSystem.3.

    16     16   .sp
    17     17   int
    18     18   \fBTcl_FSRegister\fR(\fIclientData, fsPtr\fR)
    19     19   .sp
    20     20   int
    21     21   \fBTcl_FSUnregister\fR(\fIfsPtr\fR)
    22     22   .sp
    23         -ClientData
           23  +void *
    24     24   \fBTcl_FSData\fR(\fIfsPtr\fR)
    25     25   .sp
    26     26   void
    27     27   \fBTcl_FSMountsChanged\fR(\fIfsPtr\fR)
    28     28   .sp
    29     29   const Tcl_Filesystem *
    30     30   \fBTcl_FSGetFileSystemForPath\fR(\fIpathPtr\fR)
................................................................................
   121    121   .sp
   122    122   Tcl_Obj *
   123    123   \fBTcl_FSJoinToPath\fR(\fIbasePtr, objc, objv\fR)
   124    124   .sp
   125    125   int
   126    126   \fBTcl_FSConvertToPathType\fR(\fIinterp, pathPtr\fR)
   127    127   .sp
   128         -ClientData
          128  +void *
   129    129   \fBTcl_FSGetInternalRep\fR(\fIpathPtr, fsPtr\fR)
   130    130   .sp
   131    131   Tcl_Obj *
   132    132   \fBTcl_FSGetTranslatedPath\fR(\fIinterp, pathPtr\fR)
   133    133   .sp
   134    134   const char *
   135    135   \fBTcl_FSGetTranslatedStringPath\fR(\fIinterp, pathPtr\fR)
................................................................................
   208    208   Only files or directories matching this pattern will be returned.
   209    209   .AP Tcl_GlobTypeData *types in
   210    210   Only files or directories matching the type descriptions contained in
   211    211   this structure will be returned. This parameter may be NULL.
   212    212   .AP Tcl_Interp *interp in
   213    213   Interpreter to use either for results, evaluation, or reporting error
   214    214   messages.
   215         -.AP ClientData clientData in
          215  +.AP void *clientData in
   216    216   The native description of the path value to create.
   217    217   .AP Tcl_Obj *firstPtr in
   218    218   The first of two path values to compare. The value may be converted
   219    219   to \fBpath\fR type.
   220    220   .AP Tcl_Obj *secondPtr in
   221    221   The second of two path values to compare. The value may be converted
   222    222   to \fBpath\fR type.
................................................................................
   245    245   Name of a procedure to look up in the file's symbol table
   246    246   .AP "const char" *sym2 in
   247    247   Name of a procedure to look up in the file's symbol table
   248    248   .AP Tcl_PackageInitProc **proc1Ptr out
   249    249   Filled with the init function for this code.
   250    250   .AP Tcl_PackageInitProc **proc2Ptr out
   251    251   Filled with the safe-init function for this code.
   252         -.AP ClientData *clientDataPtr out
          252  +.AP void **clientDataPtr out
   253    253   Filled with the clientData value to pass to this code's unload
   254    254   function when it is called.
   255    255   .AP Tcl_LoadHandle *loadHandlePtr out
   256    256   Filled with an abstract token representing the loaded file.
   257    257   .AP Tcl_FSUnloadFileProc **unloadProcPtr out
   258    258   Filled with the function to use to unload this piece of code.
   259    259   .AP Tcl_LoadHandle loadHandle in
................................................................................
   720    720   freed. This function is of little practical use, and
   721    721   \fBTcl_FSGetNormalizedPath\fR or \fBTcl_FSGetNativePath\fR are usually
   722    722   better functions to use for most purposes.
   723    723   .PP
   724    724   \fBTcl_FSGetTranslatedStringPath\fR does the same as
   725    725   \fBTcl_FSGetTranslatedPath\fR, but returns a character string or NULL.
   726    726   The string returned is dynamically allocated and owned by the caller,
   727         -which must store it or call \fBckfree\fR to ensure it is freed. Again,
          727  +which must store it or call \fBTcl_Free\fR to ensure it is freed. Again,
   728    728   \fBTcl_FSGetNormalizedPath\fR or \fBTcl_FSGetNativePath\fR are usually
   729    729   better functions to use for most purposes.
   730    730   .PP
   731    731   \fBTcl_FSNewNativePath\fR performs something like the reverse of the
   732    732   usual obj->path->nativerep conversions. If some code retrieves a path
   733    733   in native form (from, e.g.\ \fBreadlink\fR or a native dialog), and that path
   734    734   is to be used at the Tcl level, then calling this function is an
................................................................................
   787    787   absolute.
   788    788   .PP
   789    789   It returns one of \fBTCL_PATH_ABSOLUTE\fR, \fBTCL_PATH_RELATIVE\fR, or
   790    790   \fBTCL_PATH_VOLUME_RELATIVE\fR
   791    791   .SS "PORTABLE STAT RESULT API"
   792    792   .PP
   793    793   \fBTcl_AllocStatBuf\fR allocates a \fITcl_StatBuf\fR on the system heap (which
   794         -may be deallocated by being passed to \fBckfree\fR). This allows extensions to
          794  +may be deallocated by being passed to \fBTcl_Free\fR). This allows extensions to
   795    795   invoke \fBTcl_FSStat\fR and \fBTcl_FSLstat\fR without being dependent on the
   796    796   size of the buffer. That in turn depends on the flags used to build Tcl.
   797    797   .PP
   798    798   .VS 8.6
   799    799   The portable fields of a \fITcl_StatBuf\fR may be read using the following
   800    800   functions, each of which returns the value of the corresponding field listed
   801    801   in the table below. Note that on some platforms there may be other fields in
................................................................................
   837    837   not check if the same filesystem is registered multiple times (and in
   838    838   general that is not a good thing to do). \fBTCL_OK\fR will be returned.
   839    839   .PP
   840    840   \fBTcl_FSUnregister\fR removes the given filesystem structure from
   841    841   the list of known filesystems, if it is known, and returns \fBTCL_OK\fR. If
   842    842   the filesystem is not currently registered, \fBTCL_ERROR\fR is returned.
   843    843   .PP
   844         -\fBTcl_FSData\fR will return the ClientData associated with the given
          844  +\fBTcl_FSData\fR will return the clientData associated with the given
   845    845   filesystem, if that filesystem is registered. Otherwise it will
   846    846   return NULL.
   847    847   .PP
   848    848   \fBTcl_FSMountsChanged\fR is used to inform the Tcl's core that
   849    849   the set of mount points for the given (already registered) filesystem
   850    850   have changed, and that cached file representations may therefore no
   851    851   longer be correct.
................................................................................
  1014   1014   cache the fact that this path belongs to this filesystem. Such caches
  1015   1015   are invalidated when filesystem structures are added or removed from
  1016   1016   Tcl's internal list of known filesystems.
  1017   1017   .PP
  1018   1018   .CS
  1019   1019   typedef int \fBTcl_FSPathInFilesystemProc\fR(
  1020   1020           Tcl_Obj *\fIpathPtr\fR,
  1021         -        ClientData *\fIclientDataPtr\fR);
         1021  +        void **\fIclientDataPtr\fR);
  1022   1022   .CE
  1023   1023   .SS DUPINTERNALREPPROC
  1024   1024   .PP
  1025   1025   This function makes a copy of a path's internal representation, and is
  1026   1026   called when Tcl needs to duplicate a path value. If NULL, Tcl will
  1027   1027   simply not copy the internal representation, which may then need to be
  1028   1028   regenerated later.
  1029   1029   .PP
  1030   1030   .CS
  1031         -typedef ClientData \fBTcl_FSDupInternalRepProc\fR(
  1032         -        ClientData \fIclientData\fR);
         1031  +typedef void *\fBTcl_FSDupInternalRepProc\fR(
         1032  +        void *\fIclientData\fR);
  1033   1033   .CE
  1034   1034   .SS FREEINTERNALREPPROC
  1035   1035   Free the internal representation. This must be implemented if internal
  1036   1036   representations need freeing (i.e.\ if some memory is allocated when an
  1037   1037   internal representation is generated), but may otherwise be NULL.
  1038   1038   .PP
  1039   1039   .CS
  1040   1040   typedef void \fBTcl_FSFreeInternalRepProc\fR(
  1041         -        ClientData \fIclientData\fR);
         1041  +        void *\fIclientData\fR);
  1042   1042   .CE
  1043   1043   .SS INTERNALTONORMALIZEDPROC
  1044   1044   .PP
  1045   1045   Function to convert internal representation to a normalized path. Only
  1046   1046   required if the filesystem creates pure path values with no string/path
  1047   1047   representation. The return value is a Tcl value whose string
  1048   1048   representation is the normalized path.
  1049   1049   .PP
  1050   1050   .CS
  1051   1051   typedef Tcl_Obj *\fBTcl_FSInternalToNormalizedProc\fR(
  1052         -        ClientData \fIclientData\fR);
         1052  +        void *\fIclientData\fR);
  1053   1053   .CE
  1054   1054   .SS CREATEINTERNALREPPROC
  1055   1055   .PP
  1056   1056   Function to take a path value, and calculate an internal
  1057   1057   representation for it, and store that native representation in the
  1058   1058   value. May be NULL if paths have no internal representation, or if
  1059   1059   the \fITcl_FSPathInFilesystemProc\fR for this filesystem always
  1060   1060   immediately creates an internal representation for paths it accepts.
  1061   1061   .PP
  1062   1062   .CS
  1063         -typedef ClientData \fBTcl_FSCreateInternalRepProc\fR(
         1063  +typedef void *\fBTcl_FSCreateInternalRepProc\fR(
  1064   1064           Tcl_Obj *\fIpathPtr\fR);
  1065   1065   .CE
  1066   1066   .SS NORMALIZEPATHPROC
  1067   1067   .PP
  1068   1068   Function to normalize a path. Should be implemented for all
  1069   1069   filesystems which can have multiple string representations for the same
  1070   1070   path value. In Tcl, every

Changes to doc/GetOpnFl.3.

    24     24   String identifying channel, such as \fBstdin\fR or \fBfile4\fR.
    25     25   .AP int write in
    26     26   Non-zero means the file will be used for writing, zero means it will
    27     27   be used for reading.
    28     28   .AP int checkUsage in
    29     29   If non-zero, then an error will be generated if the file was not opened
    30     30   for the access indicated by \fIwrite\fR.
    31         -.AP ClientData *filePtr out
           31  +.AP void **filePtr out
    32     32   Points to word in which to store pointer to FILE structure for
    33     33   the file given by \fIchanID\fR.
    34     34   .BE
    35     35   
    36     36   .SH DESCRIPTION
    37     37   .PP
    38     38   \fBTcl_GetOpenFile\fR takes as argument a file identifier of the form

Changes to doc/GetTime.3.

    23     23   .AP Tcl_Time *timePtr out
    24     24   Points to memory in which to store the date and time information.
    25     25   .AP Tcl_GetTimeProc getProc in
    26     26   Pointer to handler function replacing \fBTcl_GetTime\fR's access to the OS.
    27     27   .AP Tcl_ScaleTimeProc scaleProc in
    28     28   Pointer to handler function for the conversion of time delays in the
    29     29   virtual domain to real-time.
    30         -.AP ClientData clientData in
           30  +.AP void *clientData in
    31     31   Value passed through to the two handler functions.
    32     32   .AP Tcl_GetTimeProc *getProcPtr out
    33     33   Pointer to place the currently registered get handler function into.
    34     34   .AP Tcl_ScaleTimeProc *scaleProcPtr out
    35     35   Pointer to place the currently registered scale handler function into.
    36         -.AP ClientData *clientDataPtr out
           36  +.AP void **clientDataPtr out
    37     37   Pointer to place the currently registered pass-through value into.
    38     38   .BE
    39     39   .SH DESCRIPTION
    40     40   .PP
    41     41   The \fBTcl_GetTime\fR function retrieves the current time as a
    42     42   \fITcl_Time\fR structure in memory the caller provides.  This
    43     43   structure has the following definition:
................................................................................
    79     79   any argument which is NULL is ignored and not set.
    80     80   .PP
    81     81   The signatures of the handler functions are as follows:
    82     82   .PP
    83     83   .CS
    84     84   typedef void \fBTcl_GetTimeProc\fR(
    85     85           Tcl_Time *\fItimebuf\fR,
    86         -        ClientData \fIclientData\fR);
           86  +        void *\fIclientData\fR);
    87     87   typedef void \fBTcl_ScaleTimeProc\fR(
    88     88           Tcl_Time *\fItimebuf\fR,
    89         -        ClientData \fIclientData\fR);
           89  +        void *\fIclientData\fR);
    90     90   .CE
    91     91   .PP
    92     92   The \fItimebuf\fR fields contain the time to manipulate, and the
    93     93   \fIclientData\fR fields contain a pointer supplied at the time the handler
    94     94   functions were registered.
    95     95   .PP
    96     96   Any handler pair specified has to return data which is consistent between

Changes to doc/Hash.3.

    26     26   \fBTcl_CreateHashEntry\fR(\fItablePtr, key, newPtr\fR)
    27     27   .sp
    28     28   \fBTcl_DeleteHashEntry\fR(\fIentryPtr\fR)
    29     29   .sp
    30     30   Tcl_HashEntry *
    31     31   \fBTcl_FindHashEntry\fR(\fItablePtr, key\fR)
    32     32   .sp
    33         -ClientData
           33  +void *
    34     34   \fBTcl_GetHashValue\fR(\fIentryPtr\fR)
    35     35   .sp
    36     36   \fBTcl_SetHashValue\fR(\fIentryPtr, value\fR)
    37     37   .sp
    38     38   void *
    39     39   \fBTcl_GetHashKey\fR(\fItablePtr, entryPtr\fR)
    40     40   .sp
................................................................................
    62     62   Key to use for probe into table.  Exact form depends on
    63     63   \fIkeyType\fR used to create table.
    64     64   .AP int *newPtr out
    65     65   The word at \fI*newPtr\fR is set to 1 if a new entry was created
    66     66   and 0 if there was already an entry for \fIkey\fR.
    67     67   .AP Tcl_HashEntry *entryPtr in
    68     68   Pointer to hash table entry.
    69         -.AP ClientData value in
    70         -New value to assign to hash table entry.  Need not have type
    71         -ClientData, but must fit in same space as ClientData.
           69  +.AP void *value in
           70  +New value to assign to hash table entry.
    72     71   .AP Tcl_HashSearch *searchPtr in
    73     72   Pointer to record to use to keep track of progress in enumerating
    74     73   all the entries in a hash table.
    75     74   .BE
    76     75   .SH DESCRIPTION
    77     76   .PP
    78     77   A hash table consists of zero or more entries, each consisting of a
................................................................................
   182    181   .PP
   183    182   \fBTcl_FindHashEntry\fR is similar to \fBTcl_CreateHashEntry\fR
   184    183   except that it does not create a new entry if the key doesn't exist;
   185    184   instead, it returns NULL as result.
   186    185   .PP
   187    186   \fBTcl_GetHashValue\fR and \fBTcl_SetHashValue\fR are used to
   188    187   read and write an entry's value, respectively.
   189         -Values are stored and retrieved as type
   190         -.QW ClientData ,
   191         -which is
   192         -large enough to hold a pointer value.  On almost all machines this is
   193         -large enough to hold an integer value too.
   194    188   .PP
   195    189   \fBTcl_GetHashKey\fR returns the key for a given hash table entry,
   196    190   either as a pointer to a string, a one-word
   197    191   .PQ "char *"
   198    192   key, or
   199    193   as a pointer to the first word of an array of integers, depending
   200    194   on the \fIkeyType\fR used to create a hash table.
................................................................................
   225    219   \fBTcl_FirstHashEntry\fR or \fBTcl_NextHashEntry\fR.
   226    220   .PP
   227    221   \fBTcl_HashStats\fR returns a dynamically-allocated string with
   228    222   overall information about a hash table, such as the number of
   229    223   entries it contains, the number of buckets in its hash array,
   230    224   and the utilization of the buckets.
   231    225   It is the caller's responsibility to free the result string
   232         -by passing it to \fBckfree\fR.
          226  +by passing it to \fBTcl_Free\fR.
   233    227   .PP
   234    228   The header file \fBtcl.h\fR defines the actual data structures
   235    229   used to implement hash tables.
   236    230   This is necessary so that clients can allocate Tcl_HashTable
   237    231   structures and so that macros can be used to read and write
   238    232   the values of entries.
   239    233   However, users of the hashing routines should never refer directly

Changes to doc/Limit.3.

    79     79   Function to call when a particular limit is exceeded.  If the
    80     80   \fIhandlerProc\fR removes or raises the limit during its processing,
    81     81   the limited interpreter will be permitted to continue to process after
    82     82   the handler returns.  Many handlers may be attached to the same
    83     83   interpreter limit; their order of execution is not defined, and they
    84     84   must be identified by \fIhandlerProc\fR and \fIclientData\fR when they
    85     85   are deleted.
    86         -.AP ClientData clientData in
           86  +.AP void *clientData in
    87     87   Arbitrary pointer-sized word used to pass some context to the
    88     88   \fIhandlerProc\fR function.
    89     89   .AP Tcl_LimitHandlerDeleteProc *deleteProc in
    90     90   Function to call whenever a handler is deleted.  May be NULL if the
    91     91   \fIclientData\fR requires no deletion.
    92     92   .BE
    93     93   .SH DESCRIPTION
................................................................................
   158    158   To add a handler callback to be invoked when a limit is exceeded, call
   159    159   \fBTcl_LimitAddHandler\fR.  The \fIhandlerProc\fR argument describes
   160    160   the function that will actually be called; it should have the
   161    161   following prototype:
   162    162   .PP
   163    163   .CS
   164    164   typedef void \fBTcl_LimitHandlerProc\fR(
   165         -        ClientData \fIclientData\fR,
          165  +        void *\fIclientData\fR,
   166    166           Tcl_Interp *\fIinterp\fR);
   167    167   .CE
   168    168   .PP
   169    169   The \fIclientData\fR argument to the handler will be whatever is
   170    170   passed to the \fIclientData\fR argument to \fBTcl_LimitAddHandler\fR,
   171    171   and the \fIinterp\fR is the interpreter that had its limit exceeded.
   172    172   .PP
................................................................................
   175    175   \fBTCL_STATIC\fR or NULL if no deletion action is necessary, or
   176    176   \fBTCL_DYNAMIC\fR if all that is necessary is to free the structure with
   177    177   \fBTcl_Free\fR.  Otherwise, it should refer to a function with the
   178    178   following prototype:
   179    179   .PP
   180    180   .CS
   181    181   typedef void \fBTcl_LimitHandlerDeleteProc\fR(
   182         -        ClientData \fIclientData\fR);
          182  +        void *\fIclientData\fR);
   183    183   .CE
   184    184   .PP
   185    185   A limit handler may be deleted using \fBTcl_LimitRemoveHandler\fR; the
   186    186   handler removed will be the first one found (out of the handlers added
   187    187   with \fBTcl_LimitAddHandler\fR) with exactly matching \fItype\fR,
   188    188   \fIhandlerProc\fR and \fIclientData\fR arguments.  This function
   189    189   always invokes the \fIdeleteProc\fR on the \fIclientData\fR (unless
   190    190   the \fIdeleteProc\fR was NULL or \fBTCL_STATIC\fR).
   191    191   .SH KEYWORDS
   192    192   interpreter, resource, limit, commands, time, callback

Changes to doc/LinkVar.3.

   186    186   form acceptable to \fBTcl_GetBooleanFromObj\fR;  attempts to write
   187    187   non-boolean values into \fIvarName\fR will be rejected with
   188    188   Tcl errors.
   189    189   .TP
   190    190   \fBTCL_LINK_STRING\fR
   191    191   The C variable is of type \fBchar *\fR.
   192    192   If its value is not NULL then it must be a pointer to a string
   193         -allocated with \fBTcl_Alloc\fR or \fBckalloc\fR.
          193  +allocated with \fBTcl_Alloc\fR.
   194    194   Whenever the Tcl variable is modified the current C string will be
   195    195   freed and new memory will be allocated to hold a copy of the variable's
   196    196   new value.
   197    197   If the C variable contains a NULL pointer then the Tcl variable
   198    198   will read as
   199    199   .QW NULL .
   200    200   .PP

Changes to doc/Method.3.

    57     57   .sp
    58     58   Tcl_Object
    59     59   \fBTcl_ObjectContextObject\fR(\fIcontext\fR)
    60     60   .sp
    61     61   int
    62     62   \fBTcl_ObjectContextSkippedArgs\fR(\fIcontext\fR)
    63     63   .SH ARGUMENTS
    64         -.AS ClientData clientData in
           64  +.AS void *clientData in
    65     65   .AP Tcl_Interp *interp in/out
    66     66   The interpreter holding the object or class to create or update a method in.
    67     67   .AP Tcl_Object object in
    68     68   The object to create the method in.
    69     69   .AP Tcl_Class class in
    70     70   The class to create the method in.
    71     71   .AP Tcl_Obj *nameObj in
................................................................................
    79     79   compatibility) for a non-exported method,
    80     80   .VS TIP500
    81     81   and \fBTCL_OO_METHOD_PRIVATE\fR for a private method.
    82     82   .VE TIP500
    83     83   .AP Tcl_MethodType *methodTypePtr in
    84     84   A description of the type of the method to create, or the type of method to
    85     85   compare against.
    86         -.AP ClientData clientData in
           86  +.AP void *clientData in
    87     87   A piece of data that is passed to the implementation of the method without
    88     88   interpretation.
    89         -.AP ClientData *clientDataPtr out
           89  +.AP void **clientDataPtr out
    90     90   A pointer to a variable in which to write the \fIclientData\fR value supplied
    91     91   when the method was created. If NULL, the \fIclientData\fR value will not be
    92     92   retrieved.
    93     93   .AP Tcl_Method method in
    94     94   A reference to a method to query.
    95     95   .AP Tcl_ObjectContext context in
    96     96   A reference to a method-call context. Note that client code \fImust not\fR
................................................................................
   209    209   that the \fIclientData\fR can just be copied directly.
   210    210   .SS "TCL_METHODCALLPROC FUNCTION SIGNATURE"
   211    211   .PP
   212    212   Functions matching this signature are called when the method is invoked.
   213    213   .PP
   214    214   .CS
   215    215   typedef int \fBTcl_MethodCallProc\fR(
   216         -        ClientData \fIclientData\fR,
          216  +        void *\fIclientData\fR,
   217    217           Tcl_Interp *\fIinterp\fR,
   218    218           Tcl_ObjectContext \fIobjectContext\fR,
   219    219           int \fIobjc\fR,
   220    220           Tcl_Obj *const *\fIobjv\fR);
   221    221   .CE
   222    222   .PP
   223    223   The \fIclientData\fR argument to a Tcl_MethodCallProc is the value that was
................................................................................
   230    230   .SS "TCL_METHODDELETEPROC FUNCTION SIGNATURE"
   231    231   .PP
   232    232   Functions matching this signature are used when a method is deleted, whether
   233    233   through a new method being created or because the object or class is deleted.
   234    234   .PP
   235    235   .CS
   236    236   typedef void \fBTcl_MethodDeleteProc\fR(
   237         -        ClientData \fIclientData\fR);
          237  +        void *\fIclientData\fR);
   238    238   .CE
   239    239   .PP
   240    240   The \fIclientData\fR argument to a Tcl_MethodDeleteProc will be the same as
   241    241   the value passed to the \fIclientData\fR argument to \fBTcl_NewMethod\fR or
   242    242   \fBTcl_NewInstanceMethod\fR when the method was created.
   243    243   .SS "TCL_CLONEPROC FUNCTION SIGNATURE"
   244    244   .PP
   245    245   Functions matching this signature are used to copy a method when the object or
   246    246   class is copied using \fBTcl_CopyObjectInstance\fR (or \fBoo::copy\fR).
   247    247   .PP
   248    248   .CS
   249    249   typedef int \fBTcl_CloneProc\fR(
   250    250           Tcl_Interp *\fIinterp\fR,
   251         -        ClientData \fIoldClientData\fR,
   252         -        ClientData *\fInewClientDataPtr\fR);
          251  +        void *\fIoldClientData\fR,
          252  +        void **\fInewClientDataPtr\fR);
   253    253   .CE
   254    254   .PP
   255    255   The \fIinterp\fR argument gives a place to write an error message when the
   256    256   attempt to clone the object is to fail, in which case the clone procedure must
   257    257   also return TCL_ERROR; it should return TCL_OK otherwise.
   258    258   The \fIoldClientData\fR field to a Tcl_CloneProc gives the value from the
   259    259   method being copied from, and the \fInewClientDataPtr\fR field will point to

Changes to doc/NRE.3.

    45     45   .AP Tcl_ObjCmdProc *proc in
    46     46   Called in order to evaluate a command.  Is often just a small wrapper that uses
    47     47   \fBTcl_NRCallObjProc\fR to call \fInreProc\fR using a new trampoline.  Behaves
    48     48   in the same way as the \fIproc\fR argument to \fBTcl_CreateObjCommand\fR(3)
    49     49   (\fIq.v.\fR).
    50     50   .AP Tcl_ObjCmdProc *nreProc in
    51     51   Called instead of \fIproc\fR when a trampoline is already in use.
    52         -.AP ClientData clientData in
           52  +.AP void *clientData in
    53     53   Arbitrary one-word value passed to \fIproc\fR, \fInreProc\fR, \fIdeleteProc\fR
    54     54   and \fIobjProc\fR.
    55     55   .AP Tcl_CmdDeleteProc *deleteProc in/out
    56     56   Called before \fIcmdName\fR is deleted from the interpreter, allowing for
    57     57   command-specific cleanup. May be NULL.
    58     58   .AP int objc in
    59     59   Number of items in \fIobjv\fR.
................................................................................
    68     68   Token to use instead of one derived from the first word of \fIobjv\fR in order
    69     69   to evaluate a command.
    70     70   .AP Tcl_Obj *resultPtr out
    71     71   Pointer to an unshared Tcl_Obj where the result of the evaluation is stored if
    72     72   the return code is TCL_OK.
    73     73   .AP Tcl_NRPostProc *postProcPtr in
    74     74   A function to push.
    75         -.AP ClientData data0 in
    76         -.AP ClientData data1 in
    77         -.AP ClientData data2 in
    78         -.AP ClientData data3 in
           75  +.AP void *data0 in
           76  +.AP void *data1 in
           77  +.AP void *data2 in
           78  +.AP void *data3 in
    79     79   \fIdata0\fR through \fIdata3\fR are four one-word values that will be passed
    80     80   to the function designated by \fIpostProcPtr\fR when it is invoked.
    81     81   .BE
    82     82   .SH DESCRIPTION
    83     83   .PP
    84     84   These functions provide an interface to the function stack that an interpreter
    85     85   iterates through to evaluate commands.  The routine behind a command is
................................................................................
   126    126   .PP
   127    127   \fBTcl_NRAddCallback\fR pushes \fIpostProcPtr\fR.  The signature for
   128    128   \fBTcl_NRPostProc\fR is:
   129    129   .PP
   130    130   .CS
   131    131   typedef int
   132    132   \fBTcl_NRPostProc\fR(
   133         -        \fBClientData\fR \fIdata\fR[],
          133  +        \fBvoid *\fR \fIdata\fR[],
   134    134           \fBTcl_Interp\fR *\fIinterp\fR,
   135    135           int \fIresult\fR);
   136    136   .CE
   137    137   .PP
   138    138   \fIdata\fR is a pointer to an array containing \fIdata0\fR through \fIdata3\fR.
   139    139   \fIresult\fR is the value returned by the previous function implementing part
   140    140   the routine.
................................................................................
   142    142   .PP
   143    143   The following command uses \fBTcl_EvalObjEx\fR, which consumes space on the C
   144    144   stack, to evalute a script:
   145    145   .PP
   146    146   .CS
   147    147   int
   148    148   \fITheCmdOldObjProc\fR(
   149         -    ClientData clientData,
          149  +    void *clientData,
   150    150       Tcl_Interp *interp,
   151    151       int objc,
   152    152       Tcl_Obj *const objv[])
   153    153   {
   154    154       int result;
   155    155       Tcl_Obj *objPtr;
   156    156   
................................................................................
   173    173   trampoline instead of consuming space on the C stack.  A new version of
   174    174   \fITheCmdOldObjProc\fR is just a a wrapper that uses \fBTcl_NRCallObjProc\fR to
   175    175   call \fITheCmdNRObjProc\fR:
   176    176   .PP
   177    177   .CS
   178    178   int
   179    179   \fITheCmdOldObjProc\fR(
   180         -    ClientData clientData,
          180  +    void *clientData,
   181    181       Tcl_Interp *interp,
   182    182       int objc,
   183    183       Tcl_Obj *const objv[])
   184    184   {
   185    185       return \fBTcl_NRCallObjProc\fR(interp, \fITheCmdNRObjProc\fR,
   186    186               clientData, objc, objv);
   187    187   }
   188    188   .CE
   189    189   .PP
   190    190   .CS
   191    191   int
   192    192   \fITheCmdNRObjProc\fR
   193         -    ClientData clientData,
          193  +    void *clientData,
   194    194       Tcl_Interp *interp,
   195    195       int objc,
   196    196       Tcl_Obj *const objv[])
   197    197   {
   198    198       Tcl_Obj *objPtr;
   199    199   
   200    200       \fI... preparation ...\fR
................................................................................
   207    207       return \fBTcl_NREvalObj\fR(interp, objPtr, 0);
   208    208   }
   209    209   .CE
   210    210   .PP
   211    211   .CS
   212    212   int
   213    213   \fITheCmdNRPostProc\fR(
   214         -    ClientData data[],
          214  +    void *data[],
   215    215       Tcl_Interp *interp,
   216    216       int result)
   217    217   {
   218    218       /* \fIdata[0] .. data[3]\fR are the four words of data
   219    219        * passed to \fBTcl_NRAddCallback\fR */
   220    220   
   221    221       \fI... postprocessing ...\fR

Changes to doc/Namespace.3.

    53     53   .SH ARGUMENTS
    54     54   .AS Tcl_NamespaceDeleteProc allowOverwrite in/out
    55     55   .AP Tcl_Interp *interp in/out
    56     56   The interpreter in which the namespace exists and where name lookups
    57     57   are performed. Also where error result messages are written.
    58     58   .AP "const char" *name in
    59     59   The name of the namespace or command to be created or accessed.
    60         -.AP ClientData clientData in
           60  +.AP void *clientData in
    61     61   A context pointer by the creator of the namespace.  Not interpreted by
    62     62   Tcl at all.
    63     63   .AP Tcl_NamespaceDeleteProc *deleteProc in
    64     64   A pointer to function to call when the namespace is deleted, or NULL
    65     65   if no such callback is to be performed.
    66     66   .AP Tcl_Namespace *nsPtr in
    67     67   The namespace to be manipulated, or NULL (for other than
................................................................................
   113    113   the global namespace.)
   114    114   .PP
   115    115   \fBTcl_CreateNamespace\fR creates a new namespace.  The
   116    116   \fIdeleteProc\fR will have the following type signature:
   117    117   .PP
   118    118   .CS
   119    119   typedef void \fBTcl_NamespaceDeleteProc\fR(
   120         -        ClientData \fIclientData\fR);
          120  +        void *\fIclientData\fR);
   121    121   .CE
   122    122   .PP
   123    123   \fBTcl_DeleteNamespace\fR deletes a namespace, calling the
   124    124   \fIdeleteProc\fR defined for the namespace (if any).
   125    125   .PP
   126    126   \fBTcl_AppendExportList\fR retrieves the export patterns for a
   127    127   namespace given namespace and appends them (as list items) to

Changes to doc/Notifier.3.

    34     34   .sp
    35     35   Tcl_ThreadId
    36     36   \fBTcl_GetCurrentThread\fR()
    37     37   .sp
    38     38   void
    39     39   \fBTcl_DeleteEvents\fR(\fIdeleteProc, clientData\fR)
    40     40   .sp
    41         -ClientData
           41  +void *
    42     42   \fBTcl_InitNotifier\fR()
    43     43   .sp
    44     44   void
    45     45   \fBTcl_FinalizeNotifier\fR(\fIclientData\fR)
    46     46   .sp
    47     47   int
    48     48   \fBTcl_WaitForEvent\fR(\fItimePtr\fR)
................................................................................
    74     74   .AS Tcl_EventDeleteProc *notifierProcPtr
    75     75   .AP Tcl_EventSetupProc *setupProc in
    76     76   Procedure to invoke to prepare for event wait in \fBTcl_DoOneEvent\fR.
    77     77   .AP Tcl_EventCheckProc *checkProc in
    78     78   Procedure for \fBTcl_DoOneEvent\fR to invoke after waiting for
    79     79   events.  Checks to see if any events have occurred and, if so,
    80     80   queues them.
    81         -.AP ClientData clientData in
           81  +.AP void *clientData in
    82     82   Arbitrary one-word value to pass to \fIsetupProc\fR, \fIcheckProc\fR, or
    83     83   \fIdeleteProc\fR.
    84     84   .AP "const Tcl_Time" *timePtr in
    85     85   Indicates the maximum amount of time to wait for an event.  This
    86     86   is specified as an interval (how long to wait), not an absolute
    87     87   time (when to wakeup).  If the pointer passed to \fBTcl_WaitForEvent\fR
    88     88   is NULL, it means there is no maximum wait time:  wait forever if
    89     89   necessary.
    90     90   .AP Tcl_Event *evPtr in
    91     91   An event to add to the event queue.  The storage for the event must
    92         -have been allocated by the caller using \fBTcl_Alloc\fR or \fBckalloc\fR.
           92  +have been allocated by the caller using \fBTcl_Alloc\fR.
    93     93   .AP Tcl_QueuePosition position in
    94     94   Where to add the new event in the queue:  \fBTCL_QUEUE_TAIL\fR,
    95     95   \fBTCL_QUEUE_HEAD\fR, or \fBTCL_QUEUE_MARK\fR.
    96     96   .AP Tcl_ThreadId threadId in
    97     97   A unique identifier for a thread.
    98     98   .AP Tcl_EventDeleteProc *deleteProc in
    99     99   Procedure to invoke for each queued event in \fBTcl_DeleteEvents\fR.
................................................................................
   226    226   The procedure \fBTcl_CreateEventSource\fR creates a new event source.
   227    227   Its arguments specify the setup procedure and check procedure for
   228    228   the event source.
   229    229   \fISetupProc\fR should match the following prototype:
   230    230   .PP
   231    231   .CS
   232    232   typedef void \fBTcl_EventSetupProc\fR(
   233         -        ClientData \fIclientData\fR,
          233  +        void *\fIclientData\fR,
   234    234           int \fIflags\fR);
   235    235   .CE
   236    236   .PP
   237    237   The \fIclientData\fR argument will be the same as the \fIclientData\fR
   238    238   argument to \fBTcl_CreateEventSource\fR;  it is typically used to
   239    239   point to private information managed by the event source.
   240    240   The \fIflags\fR argument will be the same as the \fIflags\fR
................................................................................
   304    304   The second procedure provided by each event source is its check
   305    305   procedure, indicated by the \fIcheckProc\fR argument to
   306    306   \fBTcl_CreateEventSource\fR.  \fICheckProc\fR must match the
   307    307   following prototype:
   308    308   .PP
   309    309   .CS
   310    310   typedef void \fBTcl_EventCheckProc\fR(
   311         -        ClientData \fIclientData\fR,
          311  +        void *\fIclientData\fR,
   312    312           int \fIflags\fR);
   313    313   .CE
   314    314   .PP
   315    315   The arguments to this procedure are the same as those for \fIsetupProc\fR.
   316    316   \fBCheckProc\fR is invoked by \fBTcl_DoOneEvent\fR after it has waited
   317    317   for events.  Presumably at least one event source is now prepared to
   318    318   queue an event.  \fBTcl_DoOneEvent\fR calls each of the event sources
................................................................................
   395    395   Another example of deferring events happens in Tk if
   396    396   \fBTk_RestrictEvents\fR has been invoked to defer certain kinds
   397    397   of window events.
   398    398   .PP
   399    399   When \fIproc\fR returns 1, \fBTcl_ServiceEvent\fR will remove the
   400    400   event from the event queue and free its storage.
   401    401   Note that the storage for an event must be allocated by
   402         -the event source (using \fBTcl_Alloc\fR or the Tcl macro \fBckalloc\fR)
          402  +the event source (using \fBTcl_Alloc\fR)
   403    403   before calling \fBTcl_QueueEvent\fR, but it
   404    404   will be freed by \fBTcl_ServiceEvent\fR, not by the event source.
   405    405   .PP
   406    406   Threaded applications work in a
   407    407   similar manner, except that there is a separate event queue for
   408    408   each thread containing a Tcl interpreter.
   409    409   Calling \fBTcl_QueueEvent\fR in a multithreaded application adds
................................................................................
   424    424   for each event in the queue, deleting those for with the procedure
   425    425   returns 1.  Events for which the procedure returns 0 are left in the
   426    426   queue.  \fIProc\fR should match the following prototype:
   427    427   .PP
   428    428   .CS
   429    429   typedef int \fBTcl_EventDeleteProc\fR(
   430    430           Tcl_Event *\fIevPtr\fR,
   431         -        ClientData \fIclientData\fR);
          431  +        void *\fIclientData\fR);
   432    432   .CE
   433    433   .PP
   434    434   The \fIclientData\fR argument will be the same as the \fIclientData\fR
   435    435   argument to \fBTcl_DeleteEvents\fR; it is typically used to point to
   436    436   private information managed by the event source.  The \fIevPtr\fR will
   437    437   point to the next event in the queue.
   438    438   .PP

Changes to doc/Object.3.

   107    107   .SH "THE TCL_OBJ STRUCTURE"
   108    108   .PP
   109    109   Each Tcl value is represented by a \fBTcl_Obj\fR structure
   110    110   which is defined as follows.
   111    111   .PP
   112    112   .CS
   113    113   typedef struct Tcl_Obj {
   114         -    int \fIrefCount\fR;
          114  +    size_t \fIrefCount\fR;
   115    115       char *\fIbytes\fR;
   116         -    int \fIlength\fR;
          116  +    size_t \fIlength\fR;
   117    117       const Tcl_ObjType *\fItypePtr\fR;
   118    118       union {
   119    119           long \fIlongValue\fR;
   120    120           double \fIdoubleValue\fR;
   121    121           void *\fIotherValuePtr\fR;
   122    122           Tcl_WideInt \fIwideValue\fR;
   123    123           struct {

Changes to doc/ObjectType.3.

   182    182   We require the string representation's byte array
   183    183   to have a null after the last byte, at offset \fIlength\fR,
   184    184   and to have no null bytes before that; this allows string representations
   185    185   to be treated as conventional null character-terminated C strings.
   186    186   These restrictions are easily met by using Tcl's internal UTF encoding
   187    187   for the string representation, same as one would do for other
   188    188   Tcl routines accepting string values as arguments.
   189         -Storage for the byte array must be allocated in the heap by \fBTcl_Alloc\fR
   190         -or \fBckalloc\fR.  Note that \fIupdateStringProc\fRs must allocate
          189  +Storage for the byte array must be allocated in the heap by \fBTcl_Alloc\fR.
          190  +Note that \fIupdateStringProc\fRs must allocate
   191    191   enough storage for the string's bytes and the terminating null byte.
   192    192   .PP
   193    193   The \fIupdateStringProc\fR for Tcl's built-in double type, for example,
   194    194   calls Tcl_PrintDouble to write to a buffer of size TCL_DOUBLE_SPACE,
   195    195   then allocates and copies the string representation to just enough
   196    196   space to hold it.  A pointer to the allocated space is stored in
   197    197   the \fIbytes\fR member.

Changes to doc/OpenFileChnl.3.

    49     49   .sp
    50     50   int
    51     51   \fBTcl_ReadChars\fR(\fIchannel, readObjPtr, charsToRead, appendFlag\fR)
    52     52   .sp
    53     53   int
    54     54   \fBTcl_Read\fR(\fIchannel, readBuf, bytesToRead\fR)
    55     55   .sp
    56         -int
           56  +size_t
    57     57   \fBTcl_GetsObj\fR(\fIchannel, lineObjPtr\fR)
    58     58   .sp
    59         -int
           59  +size_t
    60     60   \fBTcl_Gets\fR(\fIchannel, lineRead\fR)
    61     61   .sp
    62         -int
           62  +size_t
    63     63   \fBTcl_Ungets\fR(\fIchannel, input, inputLen, addAtEnd\fR)
    64     64   .sp
    65         -int
           65  +size_t
    66     66   \fBTcl_WriteObj\fR(\fIchannel, writeObjPtr\fR)
    67     67   .sp
    68         -int
           68  +size_t
    69     69   \fBTcl_WriteChars\fR(\fIchannel, charBuf, bytesToWrite\fR)
    70     70   .sp
    71         -int
           71  +size_t
    72     72   \fBTcl_Write\fR(\fIchannel, byteBuf, bytesToWrite\fR)
    73     73   .sp
    74         -int
           74  +size_t
    75     75   \fBTcl_ReadRaw\fR(\fIchannel, readBuf, bytesToRead\fR)
    76     76   .sp
    77         -int
           77  +size_t
    78     78   \fBTcl_WriteRaw\fR(\fIchannel, byteBuf, bytesToWrite\fR)
    79     79   .sp
    80     80   int
    81     81   \fBTcl_Eof\fR(\fIchannel\fR)
    82     82   .sp
    83     83   int
    84     84   \fBTcl_Flush\fR(\fIchannel\fR)
................................................................................
   130    130   \fBTCL_ENFORCE_MODE\fR. If \fBTCL_STDIN\fR is set, stdin for the first child
   131    131   in the pipe is the pipe channel, otherwise it is the same as the standard
   132    132   input of the invoking process; likewise for \fBTCL_STDOUT\fR and
   133    133   \fBTCL_STDERR\fR. If \fBTCL_ENFORCE_MODE\fR is not set, then the pipe can
   134    134   redirect stdio handles to override the stdio handles for which
   135    135   \fBTCL_STDIN\fR, \fBTCL_STDOUT\fR and \fBTCL_STDERR\fR have been set.  If it
   136    136   is set, then such redirections cause an error.
   137         -.AP ClientData handle in
          137  +.AP void *handle in
   138    138   Operating system specific handle for I/O to a file. For Unix this is a
   139    139   file descriptor, for Windows it is a HANDLE.
   140    140   .AP int readOrWrite in
   141    141   OR-ed combination of \fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR to indicate
   142    142   what operations are valid on \fIhandle\fR.
   143    143   .AP "const char" *channelName in
   144    144   The name of the channel.
................................................................................
   150    150   The pattern to match on, passed to Tcl_StringMatch, or NULL.
   151    151   .AP Tcl_Channel channel in
   152    152   A Tcl channel for input or output.  Must have been the return value
   153    153   from a procedure such as \fBTcl_OpenFileChannel\fR.
   154    154   .AP Tcl_Obj *readObjPtr in/out
   155    155   A pointer to a Tcl value in which to store the characters read from the
   156    156   channel.
   157         -.AP int charsToRead in
          157  +.AP size_t charsToRead in
   158    158   The number of characters to read from the channel.  If the channel's encoding
   159    159   is \fBbinary\fR, this is equivalent to the number of bytes to read from the
   160    160   channel.
   161    161   .AP int appendFlag in
   162    162   If non-zero, data read from the channel will be appended to the value.
   163    163   Otherwise, the data will replace the existing contents of the value.
   164    164   .AP char *readBuf out
   165    165   A buffer in which to store the bytes read from the channel.
   166         -.AP int bytesToRead in
          166  +.AP size_t bytesToRead in
   167    167   The number of bytes to read from the channel.  The buffer \fIreadBuf\fR must
   168    168   be large enough to hold this many bytes.
   169    169   .AP Tcl_Obj *lineObjPtr in/out
   170    170   A pointer to a Tcl value in which to store the line read from the
   171    171   channel.  The line read will be appended to the current value of the
   172    172   value.
   173    173   .AP Tcl_DString *lineRead in/out
   174    174   A pointer to a Tcl dynamic string in which to store the line read from the
   175    175   channel.  Must have been initialized by the caller.  The line read will be
   176    176   appended to any data already in the dynamic string.
   177    177   .AP "const char" *input in
   178    178   The input to add to a channel buffer.
   179         -.AP int inputLen in
          179  +.AP size_t inputLen in
   180    180   Length of the input
   181    181   .AP int addAtEnd in
   182    182   Flag indicating whether the input should be added to the end or
   183    183   beginning of the channel buffer.
   184    184   .AP Tcl_Obj *writeObjPtr in
   185    185   A pointer to a Tcl value whose contents will be output to the channel.
   186    186   .AP "const char" *charBuf in
   187    187   A buffer containing the characters to output to the channel.
   188    188   .AP "const char" *byteBuf in
   189    189   A buffer containing the bytes to output to the channel.
   190         -.AP int bytesToWrite in
          190  +.AP size_t bytesToWrite in
   191    191   The number of bytes to consume from \fIcharBuf\fR or \fIbyteBuf\fR and
   192    192   output to the channel.
   193    193   .AP Tcl_WideInt offset in
   194    194   How far to move the access point in the channel at which the next input or
   195    195   output operation will be applied, measured in bytes from the position
   196    196   given by \fIseekMode\fR.  May be either positive or negative.
   197    197   .AP int seekMode in

Changes to doc/OpenTcp.3.

    46     46   for the local end of the connection.  If NULL, a default interface is
    47     47   chosen.
    48     48   .AP int async in
    49     49   If nonzero, the client socket is connected asynchronously to the server.
    50     50   .AP "unsigned int" flags in
    51     51   ORed combination of \fBTCL_TCPSERVER\fR flags that specify additional
    52     52   informations about the socket being created.
    53         -.AP ClientData sock in
           53  +.AP void *sock in
    54     54   Platform-specific handle for client TCP socket.
    55     55   .AP Tcl_TcpAcceptProc *proc in
    56     56   Pointer to a procedure to invoke each time a new connection is
    57     57   accepted via the socket.
    58         -.AP ClientData clientData in
           58  +.AP void *clientData in
    59     59   Arbitrary one-word value to pass to \fIproc\fR.
    60     60   .BE
    61     61   .SH DESCRIPTION
    62     62   .PP
    63     63   These functions are convenience procedures for creating
    64     64   channels that communicate over TCP sockets.
    65     65   The operations on a channel
................................................................................
   123    123   allow connections from any network interface.
   124    124   Each time a client connects to this socket, Tcl creates a channel
   125    125   for the new connection and invokes \fIproc\fR with information about
   126    126   the channel. \fIProc\fR must match the following prototype:
   127    127   .PP
   128    128   .CS
   129    129   typedef void \fBTcl_TcpAcceptProc\fR(
   130         -        ClientData \fIclientData\fR,
          130  +        void *\fIclientData\fR,
   131    131           Tcl_Channel \fIchannel\fR,
   132    132           char *\fIhostName\fR,
   133    133           int \fIport\fR);
   134    134   .CE
   135    135   .PP
   136    136   The \fIclientData\fR argument will be the same as the \fIclientData\fR
   137    137   argument to \fBTcl_OpenTcpServer\fR, \fIchannel\fR will be the handle

Changes to doc/ParseArgs.3.

    27     27   stored in \fIremObjv\fR.
    28     28   .AP "Tcl_Obj *const" *objv in
    29     29   The array of arguments to be parsed.
    30     30   .AP Tcl_Obj ***remObjv out
    31     31   Pointer to a variable that will hold the array of unprocessed arguments.
    32     32   Should be NULL if no return of unprocessed arguments is required. If
    33     33   \fIobjcPtr\fR is updated to a non-zero value, the array returned through this
    34         -must be deallocated using \fBckfree\fR.
           34  +must be deallocated using \fBTcl_Free\fR.
    35     35   .BE
    36     36   .SH DESCRIPTION
    37     37   .PP
    38     38   The \fBTcl_ParseArgsObjv\fR function provides a system for parsing argument
    39     39   lists of the form
    40     40   .QW "\fB\-someName \fIsomeValue\fR ..." .
    41     41   Such argument lists are commonly found both in the arguments to a program and
................................................................................
    80     80   .CS
    81     81   typedef struct {
    82     82       int \fItype\fR;
    83     83       const char *\fIkeyStr\fR;
    84     84       void *\fIsrcPtr\fR;
    85     85       void *\fIdstPtr\fR;
    86     86       const char *\fIhelpStr\fR;
    87         -    ClientData \fIclientData\fR;
           87  +    void *\fIclientData\fR;
    88     88   } \fBTcl_ArgvInfo\fR;
    89     89   .CE
    90     90   .PP
    91     91   The \fIkeyStr\fR field contains the name of the option; by convention, this
    92     92   will normally begin with a
    93     93   .QW \fB\-\fR
    94     94   character. The \fItype\fR, \fIsrcPtr\fR, \fIdstPtr\fR and \fIclientData\fR
................................................................................
   123    123   This argument optionally takes a following value argument; it is up to the
   124    124   handler callback function passed in \fIsrcPtr\fR to decide. That function will
   125    125   have the following signature:
   126    126   .RS
   127    127   .PP
   128    128   .CS
   129    129   typedef int (\fBTcl_ArgvFuncProc\fR)(
   130         -        ClientData \fIclientData\fR,
          130  +        void *\fIclientData\fR,
   131    131           Tcl_Obj *\fIobjPtr\fR,
   132    132           void *\fIdstPtr\fR);
   133    133   .CE
   134    134   .PP
   135    135   The result is a boolean value indicating whether to consume the following
   136    136   argument. The \fIclientData\fR is the value from the table entry, the
   137    137   \fIobjPtr\fR is the value that represents the following argument or NULL if
................................................................................
   145    145   function passed in \fIsrcPtr\fR returns how many (or a negative number to
   146    146   signal an error, in which case it should also set the interpreter result). The
   147    147   function will have the following signature:
   148    148   .RS
   149    149   .PP
   150    150   .CS
   151    151   typedef int (\fBTcl_ArgvGenFuncProc\fR)(
   152         -        ClientData \fIclientData\fR,
          152  +        void *\fIclientData\fR,
   153    153           Tcl_Interp *\fIinterp\fR,
   154    154           int \fIobjc\fR,
   155    155           Tcl_Obj *const *\fIobjv\fR,
   156    156           void *\fIdstPtr\fR);
   157    157   .CE
   158    158   .PP
   159    159   The \fIclientData\fR is the value from the table entry, the \fIinterp\fR is

Changes to doc/ParseCmd.3.

   204    204       int \fInumTokens\fR;
   205    205       ...
   206    206   } \fBTcl_Parse\fR;
   207    207   
   208    208   typedef struct Tcl_Token {
   209    209       int \fItype\fR;
   210    210       const char *\fIstart\fR;
   211         -    int \fIsize\fR;
   212         -    int \fInumComponents\fR;
          211  +    size_t \fIsize\fR;
          212  +    size_t \fInumComponents\fR;
   213    213   } \fBTcl_Token\fR;
   214    214   .CE
   215    215   .PP
   216    216   The first five fields of a Tcl_Parse structure
   217    217   are filled in only by \fBTcl_ParseCommand\fR.
   218    218   These fields are not used by the other parsing procedures.
   219    219   .PP

Changes to doc/Preserve.3.

    17     17   \fBTcl_Preserve\fR(\fIclientData\fR)
    18     18   .sp
    19     19   \fBTcl_Release\fR(\fIclientData\fR)
    20     20   .sp
    21     21   \fBTcl_EventuallyFree\fR(\fIclientData, freeProc\fR)
    22     22   .SH ARGUMENTS
    23     23   .AS Tcl_FreeProc clientData
    24         -.AP ClientData clientData in
           24  +.AP void *clientData in
    25     25   Token describing structure to be freed or reallocated.  Usually a pointer
    26     26   to memory for structure.
    27     27   .AP Tcl_FreeProc *freeProc in
    28     28   Procedure to invoke to free \fIclientData\fR.
    29     29   .BE
    30     30   .SH DESCRIPTION
    31     31   .PP
................................................................................
    87     87   same as the \fIclientData\fR argument to \fBTcl_EventuallyFree\fR.
    88     88   The type of \fIblockPtr\fR (\fBchar *\fR) is different than the type of the
    89     89   \fIclientData\fR argument to \fBTcl_EventuallyFree\fR for historical
    90     90   reasons, but the value is the same.
    91     91   .PP
    92     92   When the \fIclientData\fR argument to \fBTcl_EventuallyFree\fR
    93     93   refers to storage allocated and returned by a prior call to
    94         -\fBTcl_Alloc\fR, \fBckalloc\fR, or another function of the Tcl library,
           94  +\fBTcl_Alloc\fR or another function of the Tcl library,
    95     95   then the \fIfreeProc\fR argument should be given the special value of
    96     96   \fBTCL_DYNAMIC\fR.
    97     97   .PP
    98     98   This mechanism can be used to solve the problem described above
    99     99   by placing \fBTcl_Preserve\fR and \fBTcl_Release\fR calls around
   100    100   actions that may cause undesired storage re-allocation.  The
   101    101   mechanism is intended only for short-term use (i.e. while procedures

Changes to doc/SplitList.3.

    16     16   .sp
    17     17   int
    18     18   \fBTcl_SplitList\fR(\fIinterp, list, argcPtr, argvPtr\fR)
    19     19   .sp
    20     20   char *
    21     21   \fBTcl_Merge\fR(\fIargc, argv\fR)
    22     22   .sp
    23         -int
           23  +size_t
    24     24   \fBTcl_ScanElement\fR(\fIsrc, flagsPtr\fR)
    25     25   .sp
    26         -int
           26  +size_t
    27     27   \fBTcl_ScanCountedElement\fR(\fIsrc, length, flagsPtr\fR)
    28     28   .sp
    29         -int
           29  +size_t
    30     30   \fBTcl_ConvertElement\fR(\fIsrc, dst, flags\fR)
    31     31   .sp
    32         -int
           32  +size_t
    33     33   \fBTcl_ConvertCountedElement\fR(\fIsrc, length, dst, flags\fR)
    34     34   .SH ARGUMENTS
    35     35   .AS "const char *const" ***argvPtr out
    36     36   .AP Tcl_Interp *interp out
    37     37   Interpreter to use for error reporting.  If NULL, then no error message
    38     38   is left.
    39     39   .AP char *list in
................................................................................
    51     51   Array of strings to merge together into a single list.
    52     52   Each string will become a separate element of the list.
    53     53   .AP "const char" *src in
    54     54   String that is to become an element of a list.
    55     55   .AP int *flagsPtr in
    56     56   Pointer to word to fill in with information about \fIsrc\fR.
    57     57   The value of *\fIflagsPtr\fR must be passed to \fBTcl_ConvertElement\fR.
    58         -.AP int length in
           58  +.AP size_t length in
    59     59   Number of bytes in string \fIsrc\fR.
    60     60   .AP char *dst in
    61     61   Place to copy converted list element.  Must contain enough characters
    62     62   to hold converted string.
    63     63   .AP int flags in
    64     64   Information about \fIsrc\fR. Must be value returned by previous
    65     65   call to \fBTcl_ScanElement\fR, possibly OR-ed

Changes to doc/StringObj.3.

    83     83   \fBTcl_ConcatObj\fR(\fIobjc, objv\fR)
    84     84   .SH ARGUMENTS
    85     85   .AS "const Tcl_UniChar" *appendObjPtr in/out
    86     86   .AP "const char" *bytes in
    87     87   Points to the first byte of an array of UTF-8-encoded bytes
    88     88   used to set or append to a string value.
    89     89   This byte array may contain embedded null characters
    90         -unless \fInumChars\fR is negative.  (Applications needing null bytes
           90  +unless \fInumChars\fR is (size_t)-1.  (Applications needing null bytes
    91     91   should represent them as the two-byte sequence \fI\e700\e600\fR, use
    92     92   \fBTcl_ExternalToUtf\fR to convert, or \fBTcl_NewByteArrayObj\fR if
    93     93   the string is a collection of uninterpreted bytes.)
    94         -.AP int length in
           94  +.AP size_t length in
    95     95   The number of bytes to copy from \fIbytes\fR when
    96     96   initializing, setting, or appending to a string value.
    97         -If negative, all bytes up to the first null are used.
           97  +If (size_t)-1, all bytes up to the first null are used.
    98     98   .AP "const Tcl_UniChar" *unicode in
    99     99   Points to the first byte of an array of Unicode characters
   100    100   used to set or append to a string value.
   101    101   This byte array may contain embedded null characters
   102    102   unless \fInumChars\fR is negative.
   103         -.AP int numChars in
          103  +.AP size_t numChars in
   104    104   The number of Unicode characters to copy from \fIunicode\fR when
   105    105   initializing, setting, or appending to a string value.
   106         -If negative, all characters up to the first null character are used.
   107         -.AP int index in
          106  +If (size_t)-1, all characters up to the first null character are used.
          107  +.AP size_t index in
   108    108   The index of the Unicode character to return.
   109         -.AP int first in
          109  +.AP size_t first in
   110    110   The index of the first Unicode character in the Unicode range to be
   111    111   returned as a new value.
   112         -.AP int last in
          112  +.AP size_t last in
   113    113   The index of the last Unicode character in the Unicode range to be
   114    114   returned as a new value.
   115    115   .AP Tcl_Obj *objPtr in/out
   116    116   Points to a value to manipulate.
   117    117   .AP Tcl_Obj *appendObjPtr in
   118    118   The value to append to \fIobjPtr\fR in \fBTcl_AppendObjToObj\fR.
   119    119   .AP int *lengthPtr out
................................................................................
   120    120   If non-NULL, the location where \fBTcl_GetStringFromObj\fR will store
   121    121   the length of a value's string representation.
   122    122   .AP "const char" *string in
   123    123   Null-terminated string value to append to \fIobjPtr\fR.
   124    124   .AP va_list argList in
   125    125   An argument list which must have been initialized using
   126    126   \fBva_start\fR, and cleared using \fBva_end\fR.
   127         -.AP int limit in
          127  +.AP size_t limit in
   128    128   Maximum number of bytes to be appended.
   129    129   .AP "const char" *ellipsis in
   130    130   Suffix to append when the limit leads to string truncation.
   131    131   If NULL is passed then the suffix
   132    132   .QW "..."
   133    133   is used.
   134    134   .AP "const char" *format in
   135    135   Format control string including % conversion specifiers.
   136    136   .AP int objc in
   137    137   The number of elements to format or concatenate.
   138    138   .AP Tcl_Obj *objv[] in
   139    139   The array of values to format or concatenate.
   140         -.AP int newLength in
          140  +.AP size_t newLength in
   141    141   New length for the string value of \fIobjPtr\fR, not including the
   142    142   final null character.
   143    143   .BE
   144    144   .SH DESCRIPTION
   145    145   .PP
   146    146   The procedures described in this manual entry allow Tcl values to
   147    147   be manipulated as string values.  They use the internal representation

Changes to doc/TCL_MEM_DEBUG.3.

    30     30   .PP
    31     31   Once memory debugging support has been compiled into Tcl, the C
    32     32   functions \fBTcl_ValidateAllMemory\fR, and \fBTcl_DumpActiveMemory\fR,
    33     33   and the Tcl \fBmemory\fR command can be used to validate and examine
    34     34   memory usage.
    35     35   .SH "GUARD ZONES"
    36     36   .PP
    37         -When memory debugging is enabled, whenever a call to \fBckalloc\fR is
           37  +When memory debugging is enabled, whenever a call to \fBTcl_Alloc\fR is
    38     38   made, slightly more memory than requested is allocated so the memory
    39     39   debugging code can keep track of the allocated memory, and eight-byte
    40     40   .QW "guard zones"
    41     41   are placed in front of and behind the space that will be
    42     42   returned to the caller.  (The sizes of the guard zones are defined by the
    43     43   C #define \fBLOW_GUARD_SIZE\fR and #define \fBHIGH_GUARD_SIZE\fR
    44     44   in the file \fIgeneric/tclCkalloc.c\fR \(em it can
    45     45   be extended if you suspect large overwrite problems, at some cost in
    46     46   performance.)  A known pattern is written into the guard zones and, on
    47         -a call to \fBckfree\fR, the guard zones of the space being freed are
           47  +a call to \fBTcl_Free\fR, the guard zones of the space being freed are
    48     48   checked to see if either zone has been modified in any way.  If one
    49     49   has been, the guard bytes and their new contents are identified, and a
    50     50   .QW "low guard failed"
    51     51   or
    52     52   .QW "high guard failed"
    53     53   message is issued.  The
    54     54   .QW "guard failed"
    55     55   message includes the address of the memory packet and
    56         -the file name and line number of the code that called \fBckfree\fR.
           56  +the file name and line number of the code that called \fBTcl_Free\fR.
    57     57   This allows you to detect the common sorts of one-off problems, where
    58     58   not enough space was allocated to contain the data written, for
    59     59   example.
    60     60   .SH "DEBUGGING DIFFICULT MEMORY CORRUPTION PROBLEMS"
    61     61   .PP
    62     62   Normally, Tcl compiled with memory debugging enabled will make it easy
    63     63   to isolate a corruption problem.  Turning on memory validation with
    64     64   the memory command can help isolate difficult problems.  If you
    65     65   suspect (or know) that corruption is occurring before the Tcl
    66     66   interpreter comes up far enough for you to issue commands, you can set
    67     67   \fBMEM_VALIDATE\fR define, recompile tclCkalloc.c and rebuild Tcl.
    68     68   This will enable memory validation from the first call to
    69         -\fBckalloc\fR, again, at a large performance impact.
           69  +\fBTcl_Alloc\fR, again, at a large performance impact.
    70     70   .PP
    71     71   If you are desperate and validating memory on every call to
    72         -\fBckalloc\fR and \fBckfree\fR is not enough, you can explicitly call
           72  +\fBTcl_Alloc\fR and \fBTcl_Free\fR is not enough, you can explicitly call
    73     73   \fBTcl_ValidateAllMemory\fR directly at any point.  It takes a \fIchar
    74     74   *\fR and an \fIint\fR which are normally the filename and line number
    75     75   of the caller, but they can actually be anything you want.  Remember
    76     76   to remove the calls after you find the problem.
    77     77   .SH "SEE ALSO"
    78         -ckalloc, memory, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory
           78  +Tcl_Alloc, memory, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory
    79     79   .SH KEYWORDS
    80     80   memory, debug

Changes to doc/TclZlib.3.

    84     84   section \fBGZIP OPTIONS DICTIONARY\fR for details about the contents of this
    85     85   dictionary.
    86     86   .AP "unsigned int" initValue in
    87     87   The initial value for the checksum algorithm.
    88     88   .AP "unsigned char" *bytes in
    89     89   An array of bytes to run the checksum algorithm over, or NULL to get the
    90     90   recommended initial value for the checksum algorithm.
    91         -.AP int length in
           91  +.AP size_t length in
    92     92   The number of bytes in the array.
    93     93   .AP int mode in
    94     94   What mode to operate the stream in. Should be either
    95     95   \fBTCL_ZLIB_STREAM_DEFLATE\fR for a compressing stream or
    96     96   \fBTCL_ZLIB_STREAM_INFLATE\fR for a decompressing stream.
    97     97   .AP Tcl_ZlibStream *zshandlePtr out
    98     98   A pointer to a variable in which to write the abstract token for the stream
................................................................................
   103    103   Whether and how to flush the stream after writing the data to it. Must be one
   104    104   of: \fBTCL_ZLIB_NO_FLUSH\fR if no flushing is to be done, \fBTCL_ZLIB_FLUSH\fR
   105    105   if the currently compressed data must be made available for access using
   106    106   \fBTcl_ZlibStreamGet\fR, \fBTCL_ZLIB_FULLFLUSH\fR if the stream must be put
   107    107   into a state where the decompressor can recover from on corruption, or
   108    108   \fBTCL_ZLIB_FINALIZE\fR to ensure that the stream is finished and that any
   109    109   trailer demanded by the format is written.
   110         -.AP int count in
   111         -The maximum number of bytes to get from the stream, or -1 to get all remaining
          110  +.AP size_t count in
          111  +The maximum number of bytes to get from the stream, or (size_t)-1 to get all remaining
   112    112   bytes from the stream's buffers.
   113    113   .AP Tcl_Obj *compDict in
   114    114   A byte array value that is the compression dictionary to use with the stream.
   115    115   Note that this is \fInot a Tcl dictionary\fR, and it is recommended that this
   116    116   only ever be used with streams that were created with their \fIformat\fR set
   117    117   to \fBTCL_ZLIB_FORMAT_ZLIB\fR because the other formats have no mechanism to
   118    118   indicate whether a compression dictionary was present other than to fail on

Changes to doc/Thread.3.

    63     63   The referred storage will contain the id of the newly created thread as
    64     64   returned by the operating system.
    65     65   .AP Tcl_ThreadId id in
    66     66   Id of the thread waited upon.
    67     67   .AP Tcl_ThreadCreateProc *proc in
    68     68   This procedure will act as the \fBmain()\fR of the newly created
    69     69   thread. The specified \fIclientData\fR will be its sole argument.
    70         -.AP ClientData clientData in
           70  +.AP void *clientData in
    71     71   Arbitrary information. Passed as sole argument to the \fIproc\fR.
    72     72   .AP int stackSize in
    73     73   The size of the stack given to the new thread.
    74     74   .AP int flags in
    75     75   Bitmask containing flags allowing the caller to modify behavior of
    76     76   the new thread.
    77     77   .AP int *result out
................................................................................
   204    204   .PP
   205    205   It should then be defined like this example, which just counts up to a given
   206    206   value and then finishes.
   207    207   .PP
   208    208   .CS
   209    209   static \fBTcl_ThreadCreateType\fR
   210    210   MyThreadImplFunc(
   211         -    ClientData clientData)
          211  +    void *clientData)
   212    212   {
   213    213       int i, limit = (int) clientData;
   214    214       for (i=0 ; i<limit ; i++) {
   215    215           /* doing nothing at all here */
   216    216       }
   217    217       \fBTCL_THREAD_CREATE_RETURN\fR;
   218    218   }
................................................................................
   219    219   .CE
   220    220   .PP
   221    221   To create the above thread, make it execute, and wait for it to finish, we
   222    222   would do this:
   223    223   .PP
   224    224   .CS
   225    225   int limit = 1000000000;
   226         -ClientData limitData = (void*)((intptr_t) limit);
          226  +void *limitData = (void*)((intptr_t) limit);
   227    227   Tcl_ThreadId id;    \fI/* holds identity of thread created */\fR
   228    228   int result;
   229    229   
   230    230   if (\fBTcl_CreateThread\fR(&id, MyThreadImplFunc, limitData,
   231    231           \fBTCL_THREAD_STACK_DEFAULT\fR,
   232    232           \fBTCL_THREAD_JOINABLE\fR) != TCL_OK) {
   233    233       \fI/* Thread did not create correctly */\fR

Changes to doc/TraceCmd.3.

     9      9   .BS
    10     10   .SH NAME
    11     11   Tcl_CommandTraceInfo, Tcl_TraceCommand, Tcl_UntraceCommand \- monitor renames and deletes of a command
    12     12   .SH SYNOPSIS
    13     13   .nf
    14     14   \fB#include <tcl.h>\fR
    15     15   .sp
    16         -ClientData
           16  +void *
    17     17   \fBTcl_CommandTraceInfo(\fIinterp, cmdName, flags, proc, prevClientData\fB)\fR
    18     18   .sp
    19     19   int
    20     20   \fBTcl_TraceCommand(\fIinterp, cmdName, flags, proc, clientData\fB)\fR
    21     21   .sp
    22     22   void
    23     23   \fBTcl_UntraceCommand(\fIinterp, cmdName, flags, proc, clientData\fB)\fR
................................................................................
    28     28   .AP "const char" *cmdName in
    29     29   Name of command.
    30     30   .AP int flags in
    31     31   OR'ed collection of the values \fBTCL_TRACE_RENAME\fR and
    32     32   \fBTCL_TRACE_DELETE\fR.
    33     33   .AP Tcl_CommandTraceProc *proc in
    34     34   Procedure to call when specified operations occur to \fIcmdName\fR.
    35         -.AP ClientData clientData in
           35  +.AP void *clientData in
    36     36   Arbitrary argument to pass to \fIproc\fR.
    37         -.AP ClientData prevClientData in
           37  +.AP void *prevClientData in
    38     38   If non-NULL, gives last value returned by \fBTcl_CommandTraceInfo\fR,
    39     39   so this call will return information about next trace.  If NULL, this
    40     40   call will return information about first trace.
    41     41   .BE
    42     42   .SH DESCRIPTION
    43     43   .PP
    44     44   \fBTcl_TraceCommand\fR allows a C procedure to monitor operations
................................................................................
    61     61   .PP
    62     62   Whenever one of the specified operations occurs to the command,
    63     63   \fIproc\fR will be invoked.  It should have arguments and result that
    64     64   match the type \fBTcl_CommandTraceProc\fR:
    65     65   .PP
    66     66   .CS
    67     67   typedef void \fBTcl_CommandTraceProc\fR(
    68         -        ClientData \fIclientData\fR,
           68  +        void *\fIclientData\fR,
    69     69           Tcl_Interp *\fIinterp\fR,
    70     70           const char *\fIoldName\fR,
    71     71           const char *\fInewName\fR,
    72     72           int \fIflags\fR);
    73     73   .CE
    74     74   .PP
    75     75   The \fIclientData\fR and \fIinterp\fR parameters will have the same
    76     76   values as those passed to \fBTcl_TraceCommand\fR when the trace was
    77         -created.  \fIClientData\fR typically points to an application-specific
           77  +created.  \fIclientData\fR typically points to an application-specific
    78     78   data structure that describes what to do when \fIproc\fR is invoked.
    79     79   \fIOldName\fR gives the name of the command being renamed, and
    80     80   \fInewName\fR gives the name that the command is being renamed to (or
    81     81   NULL when the command is being deleted.)
    82     82   \fIFlags\fR is an OR'ed combination of bits potentially providing
    83     83   several pieces of information.  One of the bits \fBTCL_TRACE_RENAME\fR and
    84     84   \fBTCL_TRACE_DELETE\fR will be set in \fIflags\fR to indicate which

Changes to doc/TraceVar.3.

    20     20   int
    21     21   \fBTcl_TraceVar2(\fIinterp, name1, name2, flags, proc, clientData\fB)\fR
    22     22   .sp
    23     23   \fBTcl_UntraceVar(\fIinterp, varName, flags, proc, clientData\fB)\fR
    24     24   .sp
    25     25   \fBTcl_UntraceVar2(\fIinterp, name1, name2, flags, proc, clientData\fB)\fR
    26     26   .sp
    27         -ClientData
           27  +void *
    28     28   \fBTcl_VarTraceInfo(\fIinterp, varName, flags, proc, prevClientData\fB)\fR
    29     29   .sp
    30         -ClientData
           30  +void *
    31     31   \fBTcl_VarTraceInfo2(\fIinterp, name1, name2, flags, proc, prevClientData\fB)\fR
    32     32   .SH ARGUMENTS
    33         -.AS Tcl_VarTraceProc prevClientData
           33  +.AS void *prevClientData
    34     34   .AP Tcl_Interp *interp in
    35     35   Interpreter containing variable.
    36     36   .AP "const char" *varName in
    37     37   Name of variable.  May refer to a scalar variable, to
    38     38   an array variable with no index, or to an array variable
    39     39   with a parenthesized index.
    40     40   .AP int flags in
................................................................................
    42     42   \fBTCL_TRACE_WRITES\fR, \fBTCL_TRACE_UNSETS\fR, \fBTCL_TRACE_ARRAY\fR,
    43     43   \fBTCL_GLOBAL_ONLY\fR, \fBTCL_NAMESPACE_ONLY\fR,
    44     44   \fBTCL_TRACE_RESULT_DYNAMIC\fR and \fBTCL_TRACE_RESULT_OBJECT\fR.
    45     45   Not all flags are used by all
    46     46   procedures.  See below for more information.
    47     47   .AP Tcl_VarTraceProc *proc in
    48     48   Procedure to invoke whenever one of the traced operations occurs.
    49         -.AP ClientData clientData in
           49  +.AP void *clientData in
    50     50   Arbitrary one-word value to pass to \fIproc\fR.
    51     51   .AP "const char" *name1 in
    52     52   Name of scalar or array variable (without array index).
    53     53   .AP "const char" *name2 in
    54     54   For a trace on an element of an array, gives the index of the
    55     55   element.  For traces on scalar variables or on whole arrays,
    56     56   is NULL.
    57         -.AP ClientData prevClientData in
           57  +.AP void *prevClientData in
    58     58   If non-NULL, gives last value returned by \fBTcl_VarTraceInfo\fR or
    59     59   \fBTcl_VarTraceInfo2\fR, so this call will return information about
    60     60   next trace.  If NULL, this call will return information about first
    61     61   trace.
    62     62   .BE
    63     63   .SH DESCRIPTION
    64     64   .PP
................................................................................
   103    103   This gives the trace procedure a chance to update the array before
   104    104   array names or array get is called.  Note that this is called
   105    105   before an array set, but that will trigger write traces.
   106    106   .TP
   107    107   \fBTCL_TRACE_RESULT_DYNAMIC\fR
   108    108   The result of invoking the \fIproc\fR is a dynamically allocated
   109    109   string that will be released by the Tcl library via a call to
   110         -\fBckfree\fR.  Must not be specified at the same time as
          110  +\fBTcl_Free\fR.  Must not be specified at the same time as
   111    111   \fBTCL_TRACE_RESULT_OBJECT\fR.
   112    112   .TP
   113    113   \fBTCL_TRACE_RESULT_OBJECT\fR
   114    114   The result of invoking the \fIproc\fR is a Tcl_Obj* (cast to a char*)
   115    115   with a reference count of at least one.  The ownership of that
   116    116   reference will be transferred to the Tcl core for release (when the
   117    117   core has finished with it) via a call to \fBTcl_DecrRefCount\fR.  Must
................................................................................
   120    120   Whenever one of the specified operations occurs on the variable,
   121    121   \fIproc\fR will be invoked.
   122    122   It should have arguments and result that match the type
   123    123   \fBTcl_VarTraceProc\fR:
   124    124   .PP
   125    125   .CS
   126    126   typedef char *\fBTcl_VarTraceProc\fR(
   127         -        ClientData \fIclientData\fR,
          127  +        void *\fIclientData\fR,
   128    128           Tcl_Interp *\fIinterp\fR,
   129    129           char *\fIname1\fR,
   130    130           char *\fIname2\fR,
   131    131           int \fIflags\fR);
   132    132   .CE
   133    133   .PP
   134    134   The \fIclientData\fR and \fIinterp\fR parameters will
   135    135   have the same values as those passed to \fBTcl_TraceVar\fR when the
   136    136   trace was created.
   137         -\fIClientData\fR typically points to an application-specific
          137  +\fIclientData\fR typically points to an application-specific
   138    138   data structure that describes what to do when \fIproc\fR
   139    139   is invoked.
   140    140   \fIName1\fR and \fIname2\fR give the name of the traced variable
   141    141   in the normal two-part form (see the description of \fBTcl_TraceVar2\fR
   142    142   below for details).
   143    143   \fIFlags\fR is an OR-ed combination of bits providing several
   144    144   pieces of information.
................................................................................
   308    308   successful completion.
   309    309   If \fIproc\fR returns a non-NULL value it signifies that an
   310    310   error occurred.
   311    311   The return value must be a pointer to a static character string
   312    312   containing an error message,
   313    313   unless (\fIexactly\fR one of) the \fBTCL_TRACE_RESULT_DYNAMIC\fR and
   314    314   \fBTCL_TRACE_RESULT_OBJECT\fR flags is set, which specify that the result is
   315         -either a dynamic string (to be released with \fBckfree\fR) or a
          315  +either a dynamic string (to be released with \fBTcl_Free\fR) or a
   316    316   Tcl_Obj* (cast to char* and to be released with
   317    317   \fBTcl_DecrRefCount\fR) containing the error message.
   318    318   If a trace procedure returns an error, no further traces are
   319    319   invoked for the access and the traced access aborts with the
   320    320   given message.
   321    321   Trace procedures can use this facility to make variables
   322    322   read-only, for example (but note that the value of the variable

Changes to doc/Utf.3.

    27     27   Tcl_UniChar *
    28     28   \fBTcl_UtfToUniCharDString\fR(\fIsrc, length, dsPtr\fR)
    29     29   .sp
    30     30   int
    31     31   \fBTcl_UniCharLen\fR(\fIuniStr\fR)
    32     32   .sp
    33     33   int
    34         -\fBTcl_UniCharNcmp\fR(\fIucs, uct, numChars\fR)
           34  +\fBTcl_UniCharNcmp\fR(\fIucs, uct, uniLength\fR)
    35     35   .sp
    36     36   int
    37         -\fBTcl_UniCharNcasecmp\fR(\fIucs, uct, numChars\fR)
           37  +\fBTcl_UniCharNcasecmp\fR(\fIucs, uct, uniLength\fR)
    38     38   .sp
    39     39   int
    40     40   \fBTcl_UniCharCaseMatch\fR(\fIuniStr, uniPattern, nocase\fR)
    41     41   .sp
    42     42   int
    43         -\fBTcl_UtfNcmp\fR(\fIcs, ct, numChars\fR)
           43  +\fBTcl_UtfNcmp\fR(\fIcs, ct, length\fR)
    44     44   .sp
    45     45   int
    46         -\fBTcl_UtfNcasecmp\fR(\fIcs, ct, numChars\fR)
           46  +\fBTcl_UtfNcasecmp\fR(\fIcs, ct, length\fR)
    47     47   .sp
    48     48   int
    49     49   \fBTcl_UtfCharComplete\fR(\fIsrc, length\fR)
    50     50   .sp
    51     51   int
    52     52   \fBTcl_NumUtfChars\fR(\fIsrc, length\fR)
    53     53   .sp
................................................................................
    65     65   .sp
    66     66   int
    67     67   \fBTcl_UniCharAtIndex\fR(\fIsrc, index\fR)
    68     68   .sp
    69     69   const char *
    70     70   \fBTcl_UtfAtIndex\fR(\fIsrc, index\fR)
    71     71   .sp
    72         -int
           72  +size_t
    73     73   \fBTcl_UtfBackslash\fR(\fIsrc, readPtr, dst\fR)
    74     74   .SH ARGUMENTS
    75     75   .AS "const Tcl_UniChar" *uniPattern in/out
    76     76   .AP char *buf out
    77     77   Buffer in which the UTF-8 representation of the Tcl_UniChar is stored.  At most
    78     78   \fBTCL_UTF_MAX\fR bytes are stored in the buffer.
    79     79   .AP int ch in
................................................................................
    90     90   A null-terminated Unicode string.
    91     91   .AP "const Tcl_UniChar" *ucs in
    92     92   A null-terminated Unicode string.
    93     93   .AP "const Tcl_UniChar" *uct in
    94     94   A null-terminated Unicode string.
    95     95   .AP "const Tcl_UniChar" *uniPattern in
    96     96   A null-terminated Unicode string.
    97         -.AP int length in
           97  +.AP size_t length in
    98     98   The length of the UTF-8 string in bytes (not UTF-8 characters).  If
    99         -negative, all bytes up to the first null byte are used.
   100         -.AP int uniLength in
   101         -The length of the Unicode string in characters.  Must be greater than or
   102         -equal to 0.
           99  +(size_t)-1, all bytes up to the first null byte are used.
          100  +.AP size_t uniLength in
          101  +The length of the Unicode string in characters.
   103    102   .AP "Tcl_DString" *dsPtr in/out
   104    103   A pointer to a previously initialized \fBTcl_DString\fR.
   105         -.AP "unsigned long" numChars in
   106         -The number of characters to compare.
   107    104   .AP "const char" *start in
   108    105   Pointer to the beginning of a UTF-8 string.
   109         -.AP int index in
          106  +.AP size_t index in
   110    107   The index of a character (not byte) in the UTF-8 string.
   111    108   .AP int *readPtr out
   112    109   If non-NULL, filled with the number of bytes in the backslash sequence,
   113    110   including the backslash character.
   114    111   .AP char *dst out
   115    112   Buffer in which the bytes represented by the backslash sequence are stored.
   116    113   At most \fBTCL_UTF_MAX\fR bytes are stored in the buffer.
................................................................................
   171    168   \fBTcl_UniCharLen\fR corresponds to \fBstrlen\fR for Unicode
   172    169   characters.  It accepts a null-terminated Unicode string and returns
   173    170   the number of Unicode characters (not bytes) in that string.
   174    171   .PP
   175    172   \fBTcl_UniCharNcmp\fR and \fBTcl_UniCharNcasecmp\fR correspond to
   176    173   \fBstrncmp\fR and \fBstrncasecmp\fR, respectively, for Unicode characters.
   177    174   They accept two null-terminated Unicode strings and the number of characters
   178         -to compare.  Both strings are assumed to be at least \fInumChars\fR characters
          175  +to compare.  Both strings are assumed to be at least \fIuniLength\fR characters
   179    176   long. \fBTcl_UniCharNcmp\fR  compares the two strings character-by-character
   180    177   according to the Unicode character ordering.  It returns an integer greater
   181    178   than, equal to, or less than 0 if the first string is greater than, equal
   182    179   to, or less than the second string respectively.  \fBTcl_UniCharNcasecmp\fR
   183    180   is the Unicode case insensitive version.
   184    181   .PP
   185    182   \fBTcl_UniCharCaseMatch\fR is the Unicode equivalent to
   186    183   \fBTcl_StringCaseMatch\fR.  It accepts a null-terminated Unicode string,
   187    184   a Unicode pattern, and a boolean value specifying whether the match should
   188    185   be case sensitive and returns whether the string matches the pattern.
   189    186   .PP
   190    187   \fBTcl_UtfNcmp\fR corresponds to \fBstrncmp\fR for UTF-8 strings. It
   191    188   accepts two null-terminated UTF-8 strings and the number of characters
   192         -to compare.  (Both strings are assumed to be at least \fInumChars\fR
          189  +to compare.  (Both strings are assumed to be at least \fIlength\fR
   193    190   characters long.)  \fBTcl_UtfNcmp\fR compares the two strings
   194    191   character-by-character according to the Unicode character ordering.
   195    192   It returns an integer greater than, equal to, or less than 0 if the
   196    193   first string is greater than, equal to, or less than the second string
   197    194   respectively.
   198    195   .PP
   199    196   \fBTcl_UtfNcasecmp\fR corresponds to \fBstrncasecmp\fR for UTF-8
................................................................................
   237    234   the start of the UTF-8 string.  If \fIsrc\fR was already at \fIstart\fR, the
   238    235   return value will be \fIstart\fR.
   239    236   .PP
   240    237   \fBTcl_UniCharAtIndex\fR corresponds to a C string array dereference or the
   241    238   Pascal Ord() function.  It returns the Tcl_UniChar represented at the
   242    239   specified character (not byte) \fIindex\fR in the UTF-8 string
   243    240   \fIsrc\fR.  The source string must contain at least \fIindex\fR
   244         -characters.  Behavior is undefined if a negative \fIindex\fR is given.
          241  +characters.
   245    242   .PP
   246    243   \fBTcl_UtfAtIndex\fR returns a pointer to the specified character (not
   247    244   byte) \fIindex\fR in the UTF-8 string \fIsrc\fR.  The source string must
   248    245   contain at least \fIindex\fR characters.  This is equivalent to calling
   249         -\fBTcl_UtfNext\fR \fIindex\fR times.  If a negative \fIindex\fR is given,
          246  +\fBTcl_UtfNext\fR \fIindex\fR times.  If \fIindex\fR is (size_t)-1,
   250    247   the return pointer points to the first character in the source string.
   251    248   .PP
   252    249   \fBTcl_UtfBackslash\fR is a utility procedure used by several of the Tcl
   253    250   commands.  It parses a backslash sequence and stores the properly formed
   254    251   UTF-8 character represented by the backslash sequence in the output
   255    252   buffer \fIdst\fR.  At most \fBTCL_UTF_MAX\fR bytes are stored in the buffer.
   256    253   \fBTcl_UtfBackslash\fR modifies \fI*readPtr\fR to contain the number

Changes to doc/load.n.

   150    150   .SH EXAMPLE
   151    151   .PP
   152    152   The following is a minimal extension:
   153    153   .PP
   154    154   .CS
   155    155   #include <tcl.h>
   156    156   #include <stdio.h>
   157         -static int fooCmd(ClientData clientData,
          157  +static int fooCmd(void *clientData,
   158    158           Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
   159    159       printf("called with %d arguments\en", objc);
   160    160       return TCL_OK;
   161    161   }
   162    162   int Foo_Init(Tcl_Interp *interp) {
   163    163       if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
   164    164   	return TCL_ERROR;

Changes to doc/memory.n.

    21     21   .TP
    22     22   \fBmemory active\fR \fIfile\fR
    23     23   .
    24     24   Write a list of all currently allocated memory to the specified \fIfile\fR.
    25     25   .TP
    26     26   \fBmemory break_on_malloc\fR \fIcount\fR
    27     27   .
    28         -After the \fIcount\fR allocations have been performed, \fBckalloc\fR
           28  +After the \fIcount\fR allocations have been performed, \fBTcl_Alloc\fR
    29     29   outputs a message to this effect and that it is now attempting to enter
    30     30   the C debugger.  Tcl will then issue a \fISIGINT\fR signal against itself.
    31     31   If you are running Tcl under a C debugger, it should then enter the debugger
    32     32   command mode.
    33     33   .TP
    34     34   \fBmemory info\fR
    35     35   .
    36     36   Returns a report containing the total allocations and frees since
    37     37   Tcl began, the current packets allocated (the current
    38         -number of calls to \fBckalloc\fR not met by a corresponding call
    39         -to \fBckfree\fR), the current bytes allocated, and the maximum number
           38  +number of calls to \fBTcl_Alloc\fR not met by a corresponding call
           39  +to \fBTcl_Free\fR), the current bytes allocated, and the maximum number
    40     40   of packets and bytes allocated.
    41     41   .TP
    42     42   \fBmemory init \fR[\fBon\fR|\fBoff\fR]
    43     43   .
    44     44   Turn on or off the pre-initialization of all allocated memory
    45     45   with bogus bytes.  Useful for detecting the use of uninitialized
    46     46   values.
................................................................................
    55     55   .
    56     56   Causes a list of all allocated memory to be written to the specified \fIfile\fR
    57     57   during the finalization of Tcl's memory subsystem.  Useful for checking
    58     58   that memory is properly cleaned up during process exit.
    59     59   .TP
    60     60   \fBmemory tag\fR \fIstring\fR
    61     61   .
    62         -Each packet of memory allocated by \fBckalloc\fR can have associated
           62  +Each packet of memory allocated by \fBTcl_Alloc\fR can have associated
    63     63   with it a string-valued tag.  In the lists of allocated memory generated
    64     64   by \fBmemory active\fR and \fBmemory onexit\fR, the tag for each packet
    65     65   is printed along with other information about the packet.  The
    66     66   \fBmemory tag\fR command sets the tag value for subsequent calls
    67         -to \fBckalloc\fR to be \fIstring\fR.
           67  +to \fBTcl_Alloc\fR to be \fIstring\fR.
    68     68   .TP
    69     69   \fBmemory trace \fR[\fBon\fR|\fBoff\fR]
    70     70   .
    71     71   Turns memory tracing on or off.  When memory tracing is on, every call
    72         -to \fBckalloc\fR causes a line of trace information to be written to
    73         -\fIstderr\fR, consisting of the word \fIckalloc\fR, followed by the
           72  +to \fBTcl_Alloc\fR causes a line of trace information to be written to
           73  +\fIstderr\fR, consisting of the word \fITcl_Alloc\fR, followed by the
    74     74   address returned, the amount of memory allocated, and the C filename
    75     75   and line number of the code performing the allocation.  For example:
    76     76   .RS
    77     77   .PP
    78     78   .CS
    79         -ckalloc 40e478 98 tclProc.c 1406
           79  +Tcl_Alloc 40e478 98 tclProc.c 1406
    80     80   .CE
    81     81   .PP
    82         -Calls to \fBckfree\fR are traced in the same manner.
           82  +Calls to \fBTcl_Free\fR are traced in the same manner.
    83     83   .RE
    84     84   .TP
    85     85   \fBmemory trace_on_at_malloc\fR \fIcount\fR
    86     86   .
    87         -Enable memory tracing after \fIcount\fR \fBckalloc\fRs have been performed.
           87  +Enable memory tracing after \fIcount\fR \fBTcl_Alloc\fRs have been performed.
    88     88   For example, if you enter \fBmemory trace_on_at_malloc 100\fR,
    89         -after the 100th call to \fBckalloc\fR, memory trace information will begin
           89  +after the 100th call to \fBTcl_Alloc\fR, memory trace information will begin
    90     90   being displayed for all allocations and frees.  Since there can be a lot
    91     91   of memory activity before a problem occurs, judicious use of this option
    92     92   can reduce the slowdown caused by tracing (and the amount of trace information
    93     93   produced), if you can identify a number of allocations that occur before
    94     94   the problem sets in.  The current number of memory allocations that have
    95     95   occurred since Tcl started is printed on a guard zone failure.
    96     96   .TP
    97     97   \fBmemory validate \fR[\fBon\fR|\fBoff\fR]
    98     98   .
    99     99   Turns memory validation on or off. When memory validation is enabled,
   100         -on every call to \fBckalloc\fR or \fBckfree\fR, the guard zones are
          100  +on every call to \fBTcl_Alloc\fR or \fBTcl_Free\fR, the guard zones are
   101    101   checked for every piece of memory currently in existence that was
   102         -allocated by \fBckalloc\fR.  This has a large performance impact and
          102  +allocated by \fBTcl_Alloc\fR.  This has a large performance impact and
   103    103   should only be used when overwrite problems are strongly suspected.
   104    104   The advantage of enabling memory validation is that a guard zone
   105         -overwrite can be detected on the first call to \fBckalloc\fR or
   106         -\fBckfree\fR after the overwrite occurred, rather than when the
          105  +overwrite can be detected on the first call to \fBTcl_Alloc\fR or
          106  +\fBTcl_Free\fR after the overwrite occurred, rather than when the
   107    107   specific memory with the overwritten guard zone(s) is freed, which may
   108    108   occur long after the overwrite occurred.
   109    109   .SH "SEE ALSO"
   110         -ckalloc, ckfree, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory, TCL_MEM_DEBUG
          110  +Tcl_Alloc, Tcl_Free, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory, TCL_MEM_DEBUG
   111    111   .SH KEYWORDS
   112    112   memory, debug
   113    113   '\"Local Variables:
   114    114   '\"mode: nroff
   115    115   '\"End:

Changes to generic/regc_locale.c.

   824    824       NOTE(REG_ULOCALE);
   825    825   
   826    826       /*
   827    827        * Search table.
   828    828        */
   829    829   
   830    830       Tcl_DStringInit(&ds);
   831         -    np = Tcl_UniCharToUtfDString(startp, (int)len, &ds);
          831  +    np = Tcl_UniCharToUtfDString(startp, len, &ds);
   832    832       for (cn=cnames; cn->name!=NULL; cn++) {
   833    833   	if (strlen(cn->name)==len && strncmp(cn->name, np, len)==0) {
   834    834   	    break;			/* NOTE BREAK OUT */
   835    835   	}
   836    836       }
   837    837       Tcl_DStringFree(&ds);
   838    838       if (cn->name != NULL) {
................................................................................
   996    996   
   997    997       /*
   998    998        * Extract the class name
   999    999        */
  1000   1000   
  1001   1001       len = endp - startp;
  1002   1002       Tcl_DStringInit(&ds);
  1003         -    np = Tcl_UniCharToUtfDString(startp, (int)len, &ds);
         1003  +    np = Tcl_UniCharToUtfDString(startp, len, &ds);
  1004   1004   
  1005   1005       /*
  1006   1006        * Map the name to the corresponding enumerated value.
  1007   1007        */
  1008   1008   
  1009   1009       index = -1;
  1010   1010       for (namePtr=classNames,i=0 ; *namePtr!=NULL ; namePtr++,i++) {

Changes to generic/regcustom.h.

    32     32   
    33     33   #include "regex.h"
    34     34   
    35     35   /*
    36     36    * Overrides for regguts.h definitions, if any.
    37     37    */
    38     38   
    39         -#define	MALLOC(n)		(void*)(attemptckalloc(n))
    40         -#define	FREE(p)			ckfree((void*)(p))
    41         -#define	REALLOC(p,n)		(void*)(attemptckrealloc((void*)(p),n))
           39  +#define	MALLOC(n)		Tcl_AttemptAlloc(n)
           40  +#define	FREE(p)			Tcl_Free(p)
           41  +#define	REALLOC(p,n)		Tcl_AttemptRealloc(p,n)
    42     42   
    43     43   /*
    44     44    * Do not insert extras between the "begin" and "end" lines - this chunk is
    45     45    * automatically extracted to be fitted into regex.h.
    46     46    */
    47     47   
    48     48   /* --- begin --- */

Changes to generic/tcl.decls.

    36     36   	    const char *name, const char *version, int exact,
    37     37   	    void *clientDataPtr)
    38     38   }
    39     39   declare 2 {
    40     40       TCL_NORETURN void Tcl_Panic(const char *format, ...)
    41     41   }
    42     42   declare 3 {
    43         -    char *Tcl_Alloc(unsigned int size)
           43  +    void *Tcl_Alloc(size_t size)
    44     44   }
    45     45   declare 4 {
    46         -    void Tcl_Free(char *ptr)
           46  +    void Tcl_Free(void *ptr)
    47     47   }
    48     48   declare 5 {
    49         -    char *Tcl_Realloc(char *ptr, unsigned int size)
           49  +    void *Tcl_Realloc(void *ptr, size_t size)
    50     50   }
    51     51   declare 6 {
    52         -    char *Tcl_DbCkalloc(unsigned int size, const char *file, int line)
           52  +    void *Tcl_DbCkalloc(size_t size, const char *file, int line)
    53     53   }
    54     54   declare 7 {
    55         -    void Tcl_DbCkfree(char *ptr, const char *file, int line)
           55  +    void Tcl_DbCkfree(void *ptr, const char *file, int line)
    56     56   }
    57     57   declare 8 {
    58         -    char *Tcl_DbCkrealloc(char *ptr, unsigned int size,
           58  +    void *Tcl_DbCkrealloc(void *ptr, size_t size,
    59     59   	    const char *file, int line)
    60     60   }
    61     61   
    62     62   # Tcl_CreateFileHandler and Tcl_DeleteFileHandler are only available on unix,
    63     63   # but they are part of the old generic interface, so we include them here for
    64     64   # compatibility reasons.
    65     65   
    66     66   declare 9 unix {
    67     67       void Tcl_CreateFileHandler(int fd, int mask, Tcl_FileProc *proc,
    68         -	    ClientData clientData)
           68  +	    void *clientData)
    69     69   }
    70     70   declare 10 unix {
    71     71       void Tcl_DeleteFileHandler(int fd)
    72     72   }
    73     73   declare 11 {
    74     74       void Tcl_SetTimer(const Tcl_Time *timePtr)
    75     75   }
................................................................................
    82     82   declare 14 {
    83     83       int Tcl_AppendAllObjTypes(Tcl_Interp *interp, Tcl_Obj *objPtr)
    84     84   }
    85     85   declare 15 {
    86     86       void Tcl_AppendStringsToObj(Tcl_Obj *objPtr, ...)
    87     87   }
    88     88   declare 16 {
    89         -    void Tcl_AppendToObj(Tcl_Obj *objPtr, const char *bytes, int length)
           89  +    void Tcl_AppendToObj(Tcl_Obj *objPtr, const char *bytes, size_t length)
    90     90   }
    91     91   declare 17 {
    92     92       Tcl_Obj *Tcl_ConcatObj(int objc, Tcl_Obj *const objv[])
    93     93   }
    94     94   declare 18 {
    95     95       int Tcl_ConvertToType(Tcl_Interp *interp, Tcl_Obj *objPtr,
    96     96   	    const Tcl_ObjType *typePtr)
................................................................................
   105    105       int Tcl_DbIsShared(Tcl_Obj *objPtr, const char *file, int line)
   106    106   }
   107    107   # Removed in 9.0 (changed to macro):
   108    108   #declare 22 {
   109    109   #    Tcl_Obj *Tcl_DbNewBooleanObj(int boolValue, const char *file, int line)
   110    110   #}
   111    111   declare 23 {
   112         -    Tcl_Obj *Tcl_DbNewByteArrayObj(const unsigned char *bytes, int length,
          112  +    Tcl_Obj *Tcl_DbNewByteArrayObj(const unsigned char *bytes, size_t length,
   113    113   	    const char *file, int line)
   114    114   }
   115    115   declare 24 {
   116    116       Tcl_Obj *Tcl_DbNewDoubleObj(double doubleValue, const char *file,
   117    117   	    int line)
   118    118   }
   119    119   declare 25 {
................................................................................
   124    124   #declare 26 {
   125    125   #    Tcl_Obj *Tcl_DbNewLongObj(long longValue, const char *file, int line)
   126    126   #}
   127    127   declare 27 {
   128    128       Tcl_Obj *Tcl_DbNewObj(const char *file, int line)
   129    129   }
   130    130   declare 28 {
   131         -    Tcl_Obj *Tcl_DbNewStringObj(const char *bytes, int length,
          131  +    Tcl_Obj *Tcl_DbNewStringObj(const char *bytes, size_t length,
   132    132   	    const char *file, int line)
   133    133   }
   134    134   declare 29 {
   135    135       Tcl_Obj *Tcl_DuplicateObj(Tcl_Obj *objPtr)
   136    136   }
   137    137   declare 30 {
   138    138       void TclFreeObj(Tcl_Obj *objPtr)
................................................................................
   202    202   	    int count, int objc, Tcl_Obj *const objv[])
   203    203   }
   204    204   # Removed in 9.0 (changed to macro):
   205    205   #declare 49 {
   206    206   #    Tcl_Obj *Tcl_NewBooleanObj(int boolValue)
   207    207   #}
   208    208   declare 50 {
   209         -    Tcl_Obj *Tcl_NewByteArrayObj(const unsigned char *bytes, int length)
          209  +    Tcl_Obj *Tcl_NewByteArrayObj(const unsigned char *bytes, size_t length)
   210    210   }
   211    211   declare 51 {
   212    212       Tcl_Obj *Tcl_NewDoubleObj(double doubleValue)
   213    213   }
   214    214   # Removed in 9.0 (changed to macro):
   215    215   #declare 52 {
   216    216   #    Tcl_Obj *Tcl_NewIntObj(int intValue)
................................................................................
   222    222   #declare 54 {
   223    223   #    Tcl_Obj *Tcl_NewLongObj(long longValue)
   224    224   #}
   225    225   declare 55 {
   226    226       Tcl_Obj *Tcl_NewObj(void)
   227    227   }
   228    228   declare 56 {
   229         -    Tcl_Obj *Tcl_NewStringObj(const char *bytes, int length)
          229  +    Tcl_Obj *Tcl_NewStringObj(const char *bytes, size_t length)
   230    230   }
   231    231   # Removed in 9.0 (changed to macro):
   232    232   #declare 57 {
   233    233   #    void Tcl_SetBooleanObj(Tcl_Obj *objPtr, int boolValue)
   234    234   #}
   235    235   declare 58 {
   236         -    unsigned char *Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int length)
          236  +    unsigned char *Tcl_SetByteArrayLength(Tcl_Obj *objPtr, size_t length)
   237    237   }
   238    238   declare 59 {
   239    239       void Tcl_SetByteArrayObj(Tcl_Obj *objPtr, const unsigned char *bytes,
   240         -	    int length)
          240  +	    size_t length)
   241    241   }
   242    242   declare 60 {
   243    243       void Tcl_SetDoubleObj(Tcl_Obj *objPtr, double doubleValue)
   244    244   }
   245    245   # Removed in 9.0 (changed to macro):
   246    246   #declare 61 {
   247    247   #    void Tcl_SetIntObj(Tcl_Obj *objPtr, int intValue)
................................................................................
   250    250       void Tcl_SetListObj(Tcl_Obj *objPtr, int objc, Tcl_Obj *const objv[])
   251    251   }
   252    252   # Removed in 9.0 (changed to macro):
   253    253   #declare 63 {
   254    254   #    void Tcl_SetLongObj(Tcl_Obj *objPtr, long longValue)
   255    255   #}
   256    256   declare 64 {
   257         -    void Tcl_SetObjLength(Tcl_Obj *objPtr, int length)
          257  +    void Tcl_SetObjLength(Tcl_Obj *objPtr, size_t length)
   258    258   }
   259    259   declare 65 {
   260         -    void Tcl_SetStringObj(Tcl_Obj *objPtr, const char *bytes, int length)
          260  +    void Tcl_SetStringObj(Tcl_Obj *objPtr, const char *bytes, size_t length)
   261    261   }
   262    262   # Removed in 9.0, replaced by macro.
   263    263   #declare 66 {deprecated {No longer in use, changed to macro}} {
   264    264   #    void Tcl_AddErrorInfo(Tcl_Interp *interp, const char *message)
   265    265   #}
   266    266   # Removed in 9.0, replaced by macro.
   267    267   #declare 67 {deprecated {No longer in use, changed to macro}} {
................................................................................
   275    275       void Tcl_AppendElement(Tcl_Interp *interp, const char *element)
   276    276   }
   277    277   declare 70 {
   278    278       void Tcl_AppendResult(Tcl_Interp *interp, ...)
   279    279   }
   280    280   declare 71 {
   281    281       Tcl_AsyncHandler Tcl_AsyncCreate(Tcl_AsyncProc *proc,
   282         -	    ClientData clientData)
          282  +	    void *clientData)
   283    283   }
   284    284   declare 72 {
   285    285       void Tcl_AsyncDelete(Tcl_AsyncHandler async)
   286    286   }
   287    287   declare 73 {
   288    288       int Tcl_AsyncInvoke(Tcl_Interp *interp, int code)
   289    289   }
................................................................................
   302    302   #}
   303    303   declare 78 {
   304    304       int Tcl_BadChannelOption(Tcl_Interp *interp, const char *optionName,
   305    305   	    const char *optionList)
   306    306   }
   307    307   declare 79 {
   308    308       void Tcl_CallWhenDeleted(Tcl_Interp *interp, Tcl_InterpDeleteProc *proc,
   309         -	    ClientData clientData)
          309  +	    void *clientData)
   310    310   }
   311    311   declare 80 {
   312         -    void Tcl_CancelIdleCall(Tcl_IdleProc *idleProc, ClientData clientData)
          312  +    void Tcl_CancelIdleCall(Tcl_IdleProc *idleProc, void *clientData)
   313    313   }
   314    314   declare 81 {
   315    315       int Tcl_Close(Tcl_Interp *interp, Tcl_Channel chan)
   316    316   }
   317    317   declare 82 {
   318    318       int Tcl_CommandComplete(const char *cmd)
   319    319   }
   320    320   declare 83 {
   321    321       char *Tcl_Concat(int argc, const char *const *argv)
   322    322   }
   323    323   declare 84 {
   324         -    int Tcl_ConvertElement(const char *src, char *dst, int flags)
          324  +    size_t Tcl_ConvertElement(const char *src, char *dst, int flags)
   325    325   }
   326    326   declare 85 {
   327         -    int Tcl_ConvertCountedElement(const char *src, int length, char *dst,
          327  +    size_t Tcl_ConvertCountedElement(const char *src, size_t length, char *dst,
   328    328   	    int flags)
   329    329   }
   330    330   declare 86 {
   331    331       int Tcl_CreateAlias(Tcl_Interp *slave, const char *slaveCmd,
   332    332   	    Tcl_Interp *target, const char *targetCmd, int argc,
   333    333   	    const char *const *argv)
   334    334   }
................................................................................
   335    335   declare 87 {
   336    336       int Tcl_CreateAliasObj(Tcl_Interp *slave, const char *slaveCmd,
   337    337   	    Tcl_Interp *target, const char *targetCmd, int objc,
   338    338   	    Tcl_Obj *const objv[])
   339    339   }
   340    340   declare 88 {
   341    341       Tcl_Channel Tcl_CreateChannel(const Tcl_ChannelType *typePtr,
   342         -	    const char *chanName, ClientData instanceData, int mask)
          342  +	    const char *chanName, void *instanceData, int mask)
   343    343   }
   344    344   declare 89 {
   345    345       void Tcl_CreateChannelHandler(Tcl_Channel chan, int mask,
   346         -	    Tcl_ChannelProc *proc, ClientData clientData)
          346  +	    Tcl_ChannelProc *proc, void *clientData)
   347    347   }
   348    348   declare 90 {
   349    349       void Tcl_CreateCloseHandler(Tcl_Channel chan, Tcl_CloseProc *proc,
   350         -	    ClientData clientData)
          350  +	    void *clientData)
   351    351   }
   352    352   declare 91 {
   353    353       Tcl_Command Tcl_CreateCommand(Tcl_Interp *interp, const char *cmdName,
   354         -	    Tcl_CmdProc *proc, ClientData clientData,
          354  +	    Tcl_CmdProc *proc, void *clientData,
   355    355   	    Tcl_CmdDeleteProc *deleteProc)
   356    356   }
   357    357   declare 92 {
   358    358       void Tcl_CreateEventSource(Tcl_EventSetupProc *setupProc,
   359         -	    Tcl_EventCheckProc *checkProc, ClientData clientData)
          359  +	    Tcl_EventCheckProc *checkProc, void *clientData)
   360    360   }
   361    361   declare 93 {
   362         -    void Tcl_CreateExitHandler(Tcl_ExitProc *proc, ClientData clientData)
          362  +    void Tcl_CreateExitHandler(Tcl_ExitProc *proc, void *clientData)
   363    363   }
   364    364   declare 94 {
   365    365       Tcl_Interp *Tcl_CreateInterp(void)
   366    366   }
   367    367   # Removed in 9.0:
   368    368   #declare 95 {deprecated {}} {
   369    369   #    void Tcl_CreateMathFunc(Tcl_Interp *interp, const char *name,
   370    370   #	    int numArgs, Tcl_ValueType *argTypes,
   371         -#	    Tcl_MathProc *proc, ClientData clientData)
          371  +#	    Tcl_MathProc *proc, void *clientData)
   372    372   #}
   373    373   declare 96 {
   374    374       Tcl_Command Tcl_CreateObjCommand(Tcl_Interp *interp,
   375    375   	    const char *cmdName,
   376         -	    Tcl_ObjCmdProc *proc, ClientData clientData,
          376  +	    Tcl_ObjCmdProc *proc, void *clientData,
   377    377   	    Tcl_CmdDeleteProc *deleteProc)
   378    378   }
   379    379   declare 97 {
   380    380       Tcl_Interp *Tcl_CreateSlave(Tcl_Interp *interp, const char *slaveName,
   381    381   	    int isSafe)
   382    382   }
   383    383   declare 98 {
   384    384       Tcl_TimerToken Tcl_CreateTimerHandler(int milliseconds,
   385         -	    Tcl_TimerProc *proc, ClientData clientData)
          385  +	    Tcl_TimerProc *proc, void *clientData)
   386    386   }
   387    387   declare 99 {
   388    388       Tcl_Trace Tcl_CreateTrace(Tcl_Interp *interp, int level,
   389         -	    Tcl_CmdTraceProc *proc, ClientData clientData)
          389  +	    Tcl_CmdTraceProc *proc, void *clientData)
   390    390   }
   391    391   declare 100 {
   392    392       void Tcl_DeleteAssocData(Tcl_Interp *interp, const char *name)
   393    393   }
   394    394   declare 101 {
   395    395       void Tcl_DeleteChannelHandler(Tcl_Channel chan, Tcl_ChannelProc *proc,
   396         -	    ClientData clientData)
          396  +	    void *clientData)
   397    397   }
   398    398   declare 102 {
   399    399       void Tcl_DeleteCloseHandler(Tcl_Channel chan, Tcl_CloseProc *proc,
   400         -	    ClientData clientData)
          400  +	    void *clientData)
   401    401   }
   402    402   declare 103 {
   403    403       int Tcl_DeleteCommand(Tcl_Interp *interp, const char *cmdName)
   404    404   }
   405    405   declare 104 {
   406    406       int Tcl_DeleteCommandFromToken(Tcl_Interp *interp, Tcl_Command command)
   407    407   }
   408    408   declare 105 {
   409         -    void Tcl_DeleteEvents(Tcl_EventDeleteProc *proc, ClientData clientData)
          409  +    void Tcl_DeleteEvents(Tcl_EventDeleteProc *proc, void *clientData)
   410    410   }
   411    411   declare 106 {
   412    412       void Tcl_DeleteEventSource(Tcl_EventSetupProc *setupProc,
   413         -	    Tcl_EventCheckProc *checkProc, ClientData clientData)
          413  +	    Tcl_EventCheckProc *checkProc, void *clientData)
   414    414   }
   415    415   declare 107 {
   416         -    void Tcl_DeleteExitHandler(Tcl_ExitProc *proc, ClientData clientData)
          416  +    void Tcl_DeleteExitHandler(Tcl_ExitProc *proc, void *clientData)
   417    417   }
   418    418   declare 108 {
   419    419       void Tcl_DeleteHashEntry(Tcl_HashEntry *entryPtr)
   420    420   }
   421    421   declare 109 {
   422    422       void Tcl_DeleteHashTable(Tcl_HashTable *tablePtr)
   423    423   }
................................................................................
   431    431       void Tcl_DeleteTimerHandler(Tcl_TimerToken token)
   432    432   }
   433    433   declare 113 {
   434    434       void Tcl_DeleteTrace(Tcl_Interp *interp, Tcl_Trace trace)
   435    435   }
   436    436   declare 114 {
   437    437       void Tcl_DontCallWhenDeleted(Tcl_Interp *interp,
   438         -	    Tcl_InterpDeleteProc *proc, ClientData clientData)
          438  +	    Tcl_InterpDeleteProc *proc, void *clientData)
   439    439   }
   440    440   declare 115 {
   441    441       int Tcl_DoOneEvent(int flags)
   442    442   }
   443    443   declare 116 {
   444         -    void Tcl_DoWhenIdle(Tcl_IdleProc *proc, ClientData clientData)
          444  +    void Tcl_DoWhenIdle(Tcl_IdleProc *proc, void *clientData)
   445    445   }
   446    446   declare 117 {
   447         -    char *Tcl_DStringAppend(Tcl_DString *dsPtr, const char *bytes, int length)
          447  +    char *Tcl_DStringAppend(Tcl_DString *dsPtr, const char *bytes, size_t length)
   448    448   }
   449    449   declare 118 {
   450    450       char *Tcl_DStringAppendElement(Tcl_DString *dsPtr, const char *element)
   451    451   }
   452    452   declare 119 {
   453    453       void Tcl_DStringEndSublist(Tcl_DString *dsPtr)
   454    454   }
................................................................................
   461    461   declare 122 {
   462    462       void Tcl_DStringInit(Tcl_DString *dsPtr)
   463    463   }
   464    464   declare 123 {
   465    465       void Tcl_DStringResult(Tcl_Interp *interp, Tcl_DString *dsPtr)
   466    466   }
   467    467   declare 124 {
   468         -    void Tcl_DStringSetLength(Tcl_DString *dsPtr, int length)
          468  +    void Tcl_DStringSetLength(Tcl_DString *dsPtr, size_t length)
   469    469   }
   470    470   declare 125 {
   471    471       void Tcl_DStringStartSublist(Tcl_DString *dsPtr)
   472    472   }
   473    473   declare 126 {
   474    474       int Tcl_Eof(Tcl_Channel chan)
   475    475   }
................................................................................
   487    487       int Tcl_EvalFile(Tcl_Interp *interp, const char *fileName)
   488    488   }
   489    489   # Removed in 9.0, replaced by macro.
   490    490   #declare 131 {
   491    491   #    int Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr)
   492    492   #}
   493    493   declare 132 {
   494         -    void Tcl_EventuallyFree(ClientData clientData, Tcl_FreeProc *freeProc)
          494  +    void Tcl_EventuallyFree(void *clientData, Tcl_FreeProc *freeProc)
   495    495   }
   496    496   declare 133 {
   497    497       TCL_NORETURN void Tcl_Exit(int status)
   498    498   }
   499    499   declare 134 {
   500    500       int Tcl_ExposeCommand(Tcl_Interp *interp, const char *hiddenCmdToken,
   501    501   	    const char *cmdName)
................................................................................
   548    548   }
   549    549   declare 149 {
   550    550       int Tcl_GetAliasObj(Tcl_Interp *interp, const char *slaveCmd,
   551    551   	    Tcl_Interp **targetInterpPtr, const char **targetCmdPtr,
   552    552   	    int *objcPtr, Tcl_Obj ***objv)
   553    553   }
   554    554   declare 150 {
   555         -    ClientData Tcl_GetAssocData(Tcl_Interp *interp, const char *name,
          555  +    void *Tcl_GetAssocData(Tcl_Interp *interp, const char *name,
   556    556   	    Tcl_InterpDeleteProc **procPtr)
   557    557   }
   558    558   declare 151 {
   559    559       Tcl_Channel Tcl_GetChannel(Tcl_Interp *interp, const char *chanName,
   560    560   	    int *modePtr)
   561    561   }
   562    562   declare 152 {
   563    563       int Tcl_GetChannelBufferSize(Tcl_Channel chan)
   564    564   }
   565    565   declare 153 {
   566    566       int Tcl_GetChannelHandle(Tcl_Channel chan, int direction,
   567         -	    ClientData *handlePtr)
          567  +	    void **handlePtr)
   568    568   }
   569    569   declare 154 {
   570         -    ClientData Tcl_GetChannelInstanceData(Tcl_Channel chan)
          570  +    void *Tcl_GetChannelInstanceData(Tcl_Channel chan)
   571    571   }
   572    572   declare 155 {
   573    573       int Tcl_GetChannelMode(Tcl_Channel chan)
   574    574   }
   575    575   declare 156 {
   576    576       const char *Tcl_GetChannelName(Tcl_Channel chan)
   577    577   }
................................................................................
   610    610   }
   611    611   
   612    612   # Tcl_GetOpenFile is only available on unix, but it is a part of the old
   613    613   # generic interface, so we inlcude it here for compatibility reasons.
   614    614   
   615    615   declare 167 unix {
   616    616       int Tcl_GetOpenFile(Tcl_Interp *interp, const char *chanID, int forWriting,
   617         -	    int checkUsage, ClientData *filePtr)
          617  +	    int checkUsage, void **filePtr)
   618    618   }
   619    619   # Obsolete.  Should now use Tcl_FSGetPathType which is objectified
   620    620   # and therefore usually faster.
   621    621   declare 168 {
   622    622       Tcl_PathType Tcl_GetPathType(const char *path)
   623    623   }
   624    624   declare 169 {
   625         -    int Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr)
          625  +    size_t Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr)
   626    626   }
   627    627   declare 170 {
   628         -    int Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr)
          628  +    size_t Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr)
   629    629   }
   630    630   declare 171 {
   631    631       int Tcl_GetServiceMode(void)
   632    632   }
   633    633   declare 172 {
   634    634       Tcl_Interp *Tcl_GetSlave(Tcl_Interp *interp, const char *slaveName)
   635    635   }
................................................................................
   690    690   
   691    691   # This slot is reserved for use by the plus patch:
   692    692   #  declare 188 {
   693    693   #	Tcl_MainLoop
   694    694   #  }
   695    695   
   696    696   declare 189 {
   697         -    Tcl_Channel Tcl_MakeFileChannel(ClientData handle, int mode)
          697  +    Tcl_Channel Tcl_MakeFileChannel(void *handle, int mode)
   698    698   }
   699    699   declare 190 {
   700    700       int Tcl_MakeSafe(Tcl_Interp *interp)
   701    701   }
   702    702   declare 191 {
   703         -    Tcl_Channel Tcl_MakeTcpClientChannel(ClientData tcpSocket)
          703  +    Tcl_Channel Tcl_MakeTcpClientChannel(void *tcpSocket)
   704    704   }
   705    705   declare 192 {
   706    706       char *Tcl_Merge(int argc, const char *const *argv)
   707    707   }
   708    708   declare 193 {
   709    709       Tcl_HashEntry *Tcl_NextHashEntry(Tcl_HashSearch *searchPtr)
   710    710   }
................................................................................
   731    731   declare 199 {
   732    732       Tcl_Channel Tcl_OpenTcpClient(Tcl_Interp *interp, int port,
   733    733   	    const char *address, const char *myaddr, int myport, int async)
   734    734   }
   735    735   declare 200 {
   736    736       Tcl_Channel Tcl_OpenTcpServer(Tcl_Interp *interp, int port,
   737    737   	    const char *host, Tcl_TcpAcceptProc *acceptProc,
   738         -	    ClientData callbackData)
          738  +	    void *callbackData)
   739    739   }
   740    740   declare 201 {
   741         -    void Tcl_Preserve(ClientData data)
          741  +    void Tcl_Preserve(void *data)
   742    742   }
   743    743   declare 202 {
   744    744       void Tcl_PrintDouble(Tcl_Interp *interp, double value, char *dst)
   745    745   }
   746    746   declare 203 {
   747    747       int Tcl_PutEnv(const char *assignment)
   748    748   }
................................................................................
   749    749   declare 204 {
   750    750       const char *Tcl_PosixError(Tcl_Interp *interp)
   751    751   }
   752    752   declare 205 {
   753    753       void Tcl_QueueEvent(Tcl_Event *evPtr, Tcl_QueuePosition position)
   754    754   }
   755    755   declare 206 {
   756         -    int Tcl_Read(Tcl_Channel chan, char *bufPtr, int toRead)
          756  +    size_t Tcl_Read(Tcl_Channel chan, char *bufPtr, size_t toRead)
   757    757   }
   758    758   declare 207 {
   759    759       void Tcl_ReapDetachedProcs(void)
   760    760   }
   761    761   declare 208 {
   762    762       int Tcl_RecordAndEval(Tcl_Interp *interp, const char *cmd, int flags)
   763    763   }
................................................................................
   778    778   	    const char *text, const char *start)
   779    779   }
   780    780   declare 214 {
   781    781       int Tcl_RegExpMatch(Tcl_Interp *interp, const char *text,
   782    782   	    const char *pattern)
   783    783   }
   784    784   declare 215 {
   785         -    void Tcl_RegExpRange(Tcl_RegExp regexp, int index,
          785  +    void Tcl_RegExpRange(Tcl_RegExp regexp, size_t index,
   786    786   	    const char **startPtr, const char **endPtr)
   787    787   }
   788    788   declare 216 {
   789         -    void Tcl_Release(ClientData clientData)
          789  +    void Tcl_Release(void *clientData)
   790    790   }
   791    791   declare 217 {
   792    792       void Tcl_ResetResult(Tcl_Interp *interp)
   793    793   }
   794    794   declare 218 {
   795         -    int Tcl_ScanElement(const char *src, int *flagPtr)
          795  +    size_t Tcl_ScanElement(const char *src, int *flagPtr)
   796    796   }
   797    797   declare 219 {
   798         -    int Tcl_ScanCountedElement(const char *src, int length, int *flagPtr)
          798  +    size_t Tcl_ScanCountedElement(const char *src, size_t length, int *flagPtr)
   799    799   }
   800    800   # Removed in 9.0:
   801    801   #declare 220 {
   802    802   #    int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode)
   803    803   #}
   804    804   declare 221 {
   805    805       int Tcl_ServiceAll(void)
   806    806   }
   807    807   declare 222 {
   808    808       int Tcl_ServiceEvent(int flags)
   809    809   }
   810    810   declare 223 {
   811    811       void Tcl_SetAssocData(Tcl_Interp *interp, const char *name,
   812         -	    Tcl_InterpDeleteProc *proc, ClientData clientData)
          812  +	    Tcl_InterpDeleteProc *proc, void *clientData)
   813    813   }
   814    814   declare 224 {
   815    815       void Tcl_SetChannelBufferSize(Tcl_Channel chan, int sz)
   816    816   }
   817    817   declare 225 {
   818    818       int Tcl_SetChannelOption(Tcl_Interp *interp, Tcl_Channel chan,
   819    819   	    const char *optionName, const char *newValue)
................................................................................
   894    894   # Removed in 9.0, replaced by macro.
   895    895   #declare 247 {deprecated {No longer in use, changed to macro}} {
   896    896   #    int Tcl_TraceVar(Tcl_Interp *interp, const char *varName, int flags,
   897    897   #	    Tcl_VarTraceProc *proc, ClientData clientData)
   898    898   #}
   899    899   declare 248 {
   900    900       int Tcl_TraceVar2(Tcl_Interp *interp, const char *part1, const char *part2,
   901         -	    int flags, Tcl_VarTraceProc *proc, ClientData clientData)
          901  +	    int flags, Tcl_VarTraceProc *proc, void *clientData)
   902    902   }
   903    903   declare 249 {
   904    904       char *Tcl_TranslateFileName(Tcl_Interp *interp, const char *name,
   905    905   	    Tcl_DString *bufferPtr)
   906    906   }
   907    907   declare 250 {
   908         -    int Tcl_Ungets(Tcl_Channel chan, const char *str, int len, int atHead)
          908  +    size_t Tcl_Ungets(Tcl_Channel chan, const char *str, size_t len, int atHead)
   909    909   }
   910    910   declare 251 {
   911    911       void Tcl_UnlinkVar(Tcl_Interp *interp, const char *varName)
   912    912   }
   913    913   declare 252 {
   914    914       int Tcl_UnregisterChannel(Tcl_Interp *interp, Tcl_Channel chan)
   915    915   }
................................................................................
   925    925   #declare 255 {deprecated {No longer in use, changed to macro}} {
   926    926   #    void Tcl_UntraceVar(Tcl_Interp *interp, const char *varName, int flags,
   927    927   #	    Tcl_VarTraceProc *proc, ClientData clientData)
   928    928   #}
   929    929   declare 256 {
   930    930       void Tcl_UntraceVar2(Tcl_Interp *interp, const char *part1,
   931    931   	    const char *part2, int flags, Tcl_VarTraceProc *proc,
   932         -	    ClientData clientData)
          932  +	    void *clientData)
   933    933   }
   934    934   declare 257 {
   935    935       void Tcl_UpdateLinkedVar(Tcl_Interp *interp, const char *varName)
   936    936   }
   937    937   # Removed in 9.0, replaced by macro.
   938    938   #declare 258 {deprecated {No longer in use, changed to macro}} {
   939    939   #    int Tcl_UpVar(Tcl_Interp *interp, const char *frameName,
................................................................................
   948    948   }
   949    949   # Removed in 9.0, replaced by macro.
   950    950   #declare 261 {deprecated {No longer in use, changed to macro}} {
   951    951   #    ClientData Tcl_VarTraceInfo(Tcl_Interp *interp, const char *varName,
   952    952   #	    int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData)
   953    953   #}
   954    954   declare 262 {
   955         -    ClientData Tcl_VarTraceInfo2(Tcl_Interp *interp, const char *part1,
          955  +    void *Tcl_VarTraceInfo2(Tcl_Interp *interp, const char *part1,
   956    956   	    const char *part2, int flags, Tcl_VarTraceProc *procPtr,
   957         -	    ClientData prevClientData)
          957  +	    void *prevClientData)
   958    958   }
   959    959   declare 263 {
   960         -    int Tcl_Write(Tcl_Channel chan, const char *s, int slen)
          960  +    size_t Tcl_Write(Tcl_Channel chan, const char *s, size_t slen)
   961    961   }
   962    962   declare 264 {
   963    963       void Tcl_WrongNumArgs(Tcl_Interp *interp, int objc,
   964    964   	    Tcl_Obj *const objv[], const char *message)
   965    965   }
   966    966   declare 265 {
   967    967       int Tcl_DumpActiveMemory(const char *fileName)
................................................................................
  1039   1039   # to the alphabetical order used elsewhere in this file, but I decided
  1040   1040   # against that to ease the maintenance of the patch across new tcl versions
  1041   1041   # (patch usually has no problems to integrate the patch file for the last
  1042   1042   # version into the new one).
  1043   1043   
  1044   1044   declare 281 {
  1045   1045       Tcl_Channel Tcl_StackChannel(Tcl_Interp *interp,
  1046         -	    const Tcl_ChannelType *typePtr, ClientData instanceData,
         1046  +	    const Tcl_ChannelType *typePtr, void *instanceData,
  1047   1047   	    int mask, Tcl_Channel prevChan)
  1048   1048   }
  1049   1049   declare 282 {
  1050   1050       int Tcl_UnstackChannel(Tcl_Interp *interp, Tcl_Channel chan)
  1051   1051   }
  1052   1052   declare 283 {
  1053   1053       Tcl_Channel Tcl_GetStackedChannel(Tcl_Channel chan)
................................................................................
  1067   1067   declare 286 {
  1068   1068       void Tcl_AppendObjToObj(Tcl_Obj *objPtr, Tcl_Obj *appendObjPtr)
  1069   1069   }
  1070   1070   declare 287 {
  1071   1071       Tcl_Encoding Tcl_CreateEncoding(const Tcl_EncodingType *typePtr)
  1072   1072   }
  1073   1073   declare 288 {
  1074         -    void Tcl_CreateThreadExitHandler(Tcl_ExitProc *proc, ClientData clientData)
         1074  +    void Tcl_CreateThreadExitHandler(Tcl_ExitProc *proc, void *clientData)
  1075   1075   }
  1076   1076   declare 289 {
  1077         -    void Tcl_DeleteThreadExitHandler(Tcl_ExitProc *proc, ClientData clientData)
         1077  +    void Tcl_DeleteThreadExitHandler(Tcl_ExitProc *proc, void *clientData)
  1078   1078   }
  1079   1079   # Removed in 9.0, replaced by macro.
  1080   1080   #declare 290 {
  1081   1081   #    void Tcl_DiscardResult(Tcl_SavedResult *statePtr)
  1082   1082   #}
  1083   1083   declare 291 {
  1084         -    int Tcl_EvalEx(Tcl_Interp *interp, const char *script, int numBytes,
         1084  +    int Tcl_EvalEx(Tcl_Interp *interp, const char *script, size_t numBytes,
  1085   1085   	    int flags)
  1086   1086   }
  1087   1087   declare 292 {
  1088   1088       int Tcl_EvalObjv(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[],
  1089   1089   	    int flags)
  1090   1090   }
  1091   1091   declare 293 {
................................................................................
  1092   1092       int Tcl_EvalObjEx(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags)
  1093   1093   }
  1094   1094   declare 294 {
  1095   1095       TCL_NORETURN void Tcl_ExitThread(int status)
  1096   1096   }
  1097   1097   declare 295 {
  1098   1098       int Tcl_ExternalToUtf(Tcl_Interp *interp, Tcl_Encoding encoding,
  1099         -	    const char *src, int srcLen, int flags,
  1100         -	    Tcl_EncodingState *statePtr, char *dst, int dstLen,
         1099  +	    const char *src, size_t srcLen, int flags,
         1100  +	    Tcl_EncodingState *statePtr, char *dst, size_t dstLen,
  1101   1101   	    int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)
  1102   1102   }
  1103   1103   declare 296 {
  1104   1104       char *Tcl_ExternalToUtfDString(Tcl_Encoding encoding,
  1105         -	    const char *src, int srcLen, Tcl_DString *dsPtr)
         1105  +	    const char *src, size_t srcLen, Tcl_DString *dsPtr)
  1106   1106   }
  1107   1107   declare 297 {
  1108   1108       void Tcl_FinalizeThread(void)
  1109   1109   }
  1110   1110   declare 298 {
  1111         -    void Tcl_FinalizeNotifier(ClientData clientData)
         1111  +    void Tcl_FinalizeNotifier(void *clientData)
  1112   1112   }
  1113   1113   declare 299 {
  1114   1114       void Tcl_FreeEncoding(Tcl_Encoding encoding)
  1115   1115   }
  1116   1116   declare 300 {
  1117   1117       Tcl_ThreadId Tcl_GetCurrentThread(void)
  1118   1118   }
................................................................................
  1123   1123       const char *Tcl_GetEncodingName(Tcl_Encoding encoding)
  1124   1124   }
  1125   1125   declare 303 {
  1126   1126       void Tcl_GetEncodingNames(Tcl_Interp *interp)
  1127   1127   }
  1128   1128   declare 304 {
  1129   1129       int Tcl_GetIndexFromObjStruct(Tcl_Interp *interp, Tcl_Obj *objPtr,
  1130         -	    const void *tablePtr, int offset, const char *msg, int flags,
         1130  +	    const void *tablePtr, size_t offset, const char *msg, int flags,
  1131   1131   	    int *indexPtr)
  1132   1132   }
  1133   1133   declare 305 {
  1134         -    void *Tcl_GetThreadData(Tcl_ThreadDataKey *keyPtr, int size)
         1134  +    void *Tcl_GetThreadData(Tcl_ThreadDataKey *keyPtr, size_t size)
  1135   1135   }
  1136   1136   declare 306 {
  1137   1137       Tcl_Obj *Tcl_GetVar2Ex(Tcl_Interp *interp, const char *part1,
  1138   1138   	    const char *part2, int flags)
  1139   1139   }
  1140   1140   declare 307 {
  1141         -    ClientData Tcl_InitNotifier(void)
         1141  +    void *Tcl_InitNotifier(void)
  1142   1142   }
  1143   1143   declare 308 {
  1144   1144       void Tcl_MutexLock(Tcl_Mutex *mutexPtr)
  1145   1145   }
  1146   1146   declare 309 {
  1147   1147       void Tcl_MutexUnlock(Tcl_Mutex *mutexPtr)
  1148   1148   }
................................................................................
  1150   1150       void Tcl_ConditionNotify(Tcl_Condition *condPtr)
  1151   1151   }
  1152   1152   declare 311 {
  1153   1153       void Tcl_ConditionWait(Tcl_Condition *condPtr, Tcl_Mutex *mutexPtr,
  1154   1154   	    const Tcl_Time *timePtr)
  1155   1155   }
  1156   1156   declare 312 {
  1157         -    int Tcl_NumUtfChars(const char *src, int length)
         1157  +    size_t Tcl_NumUtfChars(const char *src, size_t length)
  1158   1158   }
  1159   1159   declare 313 {
  1160         -    int Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr, int charsToRead,
  1161         -	    int appendFlag)
         1160  +    size_t Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr,
         1161  +	    size_t charsToRead, int appendFlag)
  1162   1162   }
  1163   1163   # Removed in 9.0, replaced by macro.
  1164   1164   #declare 314 {deprecated {No longer in use, changed to macro}} {
  1165   1165   #    void Tcl_RestoreResult(Tcl_Interp *interp, Tcl_SavedResult *statePtr)
  1166   1166   #}
  1167   1167   # Removed in 9.0, replaced by macro.
  1168   1168   #declare 315 {deprecated {No longer in use, changed to macro}} {
................................................................................
  1179   1179       void Tcl_ThreadAlert(Tcl_ThreadId threadId)
  1180   1180   }
  1181   1181   declare 319 {
  1182   1182       void Tcl_ThreadQueueEvent(Tcl_ThreadId threadId, Tcl_Event *evPtr,
  1183   1183   	    Tcl_QueuePosition position)
  1184   1184   }
  1185   1185   declare 320 {
  1186         -    int Tcl_UniCharAtIndex(const char *src, int index)
         1186  +    int Tcl_UniCharAtIndex(const char *src, size_t index)
  1187   1187   }
  1188   1188   declare 321 {
  1189   1189       int Tcl_UniCharToLower(int ch)
  1190   1190   }
  1191   1191   declare 322 {
  1192   1192       int Tcl_UniCharToTitle(int ch)
  1193   1193   }
................................................................................
  1194   1194   declare 323 {
  1195   1195       int Tcl_UniCharToUpper(int ch)
  1196   1196   }
  1197   1197   declare 324 {
  1198   1198       int Tcl_UniCharToUtf(int ch, char *buf)
  1199   1199   }
  1200   1200   declare 325 {
  1201         -    const char *Tcl_UtfAtIndex(const char *src, int index)
         1201  +    const char *Tcl_UtfAtIndex(const char *src, size_t index)
  1202   1202   }
  1203   1203   declare 326 {
  1204         -    int Tcl_UtfCharComplete(const char *src, int length)
         1204  +    int Tcl_UtfCharComplete(const char *src, size_t length)
  1205   1205   }
  1206   1206   declare 327 {
  1207         -    int Tcl_UtfBackslash(const char *src, int *readPtr, char *dst)
         1207  +    size_t Tcl_UtfBackslash(const char *src, int *readPtr, char *dst)
  1208   1208   }
  1209   1209   declare 328 {
  1210   1210       const char *Tcl_UtfFindFirst(const char *src, int ch)
  1211   1211   }
  1212   1212   declare 329 {
  1213   1213       const char *Tcl_UtfFindLast(const char *src, int ch)
  1214   1214   }
................................................................................
  1216   1216       const char *Tcl_UtfNext(const char *src)
  1217   1217   }
  1218   1218   declare 331 {
  1219   1219       const char *Tcl_UtfPrev(const char *src, const char *start)
  1220   1220   }
  1221   1221   declare 332 {
  1222   1222       int Tcl_UtfToExternal(Tcl_Interp *interp, Tcl_Encoding encoding,
  1223         -	    const char *src, int srcLen, int flags,
  1224         -	    Tcl_EncodingState *statePtr, char *dst, int dstLen,
         1223  +	    const char *src, size_t srcLen, int flags,
         1224  +	    Tcl_EncodingState *statePtr, char *dst, size_t dstLen,
  1225   1225   	    int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr)
  1226   1226   }
  1227   1227   declare 333 {
  1228   1228       char *Tcl_UtfToExternalDString(Tcl_Encoding encoding,
  1229         -	    const char *src, int srcLen, Tcl_DString *dsPtr)
         1229  +	    const char *src, size_t srcLen, Tcl_DString *dsPtr)
  1230   1230   }
  1231   1231   declare 334 {
  1232   1232       int Tcl_UtfToLower(char *src)
  1233   1233   }
  1234   1234   declare 335 {
  1235   1235       int Tcl_UtfToTitle(char *src)
  1236   1236   }
................................................................................
  1237   1237   declare 336 {
  1238   1238       int Tcl_UtfToUniChar(const char *src, Tcl_UniChar *chPtr)
  1239   1239   }
  1240   1240   declare 337 {
  1241   1241       int Tcl_UtfToUpper(char *src)
  1242   1242   }
  1243   1243   declare 338 {
  1244         -    int Tcl_WriteChars(Tcl_Channel chan, const char *src, int srcLen)
         1244  +    size_t Tcl_WriteChars(Tcl_Channel chan, const char *src, size_t srcLen)
  1245   1245   }
  1246   1246   declare 339 {
  1247         -    int Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr)
         1247  +    size_t Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr)
  1248   1248   }
  1249   1249   declare 340 {
  1250   1250       char *Tcl_GetString(Tcl_Obj *objPtr)
  1251   1251   }
  1252   1252   # Removed in 9.0:
  1253   1253   #declare 341 {deprecated {Use Tcl_GetEncodingSearchPath}} {
  1254   1254   #    const char *Tcl_GetDefaultEncodingDir(void)
  1255   1255   #}
  1256   1256   # Removed in 9.0:
  1257   1257   #declare 342 {deprecated {Use Tcl_SetEncodingSearchPath}} {
  1258   1258   #    void Tcl_SetDefaultEncodingDir(const char *path)
  1259   1259   #}
  1260   1260   declare 343 {
  1261         -    void Tcl_AlertNotifier(ClientData clientData)
         1261  +    void Tcl_AlertNotifier(void *clientData)
  1262   1262   }
  1263   1263   declare 344 {
  1264   1264       void Tcl_ServiceModeHook(int mode)
  1265   1265   }
  1266   1266   declare 345 {
  1267   1267       int Tcl_UniCharIsAlnum(int ch)
  1268   1268   }
................................................................................
  1281   1281   declare 350 {
  1282   1282       int Tcl_UniCharIsUpper(int ch)
  1283   1283   }
  1284   1284   declare 351 {
  1285   1285       int Tcl_UniCharIsWordChar(int ch)
  1286   1286   }
  1287   1287   declare 352 {
  1288         -    int Tcl_UniCharLen(const Tcl_UniChar *uniStr)
         1288  +    size_t Tcl_UniCharLen(const Tcl_UniChar *uniStr)
  1289   1289   }
  1290   1290   declare 353 {
  1291   1291       int Tcl_UniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct,
  1292         -	    unsigned long numChars)
         1292  +	    size_t numChars)
  1293   1293   }
  1294   1294   declare 354 {
  1295   1295       char *Tcl_UniCharToUtfDString(const Tcl_UniChar *uniStr,
  1296         -	    int uniLength, Tcl_DString *dsPtr)
         1296  +	    size_t uniLength, Tcl_DString *dsPtr)
  1297   1297   }
  1298   1298   declare 355 {
  1299   1299       Tcl_UniChar *Tcl_UtfToUniCharDString(const char *src,
  1300         -	    int length, Tcl_DString *dsPtr)
         1300  +	    size_t length, Tcl_DString *dsPtr)
  1301   1301   }
  1302   1302   declare 356 {
  1303   1303       Tcl_RegExp Tcl_GetRegExpFromObj(Tcl_Interp *interp, Tcl_Obj *patObj,
  1304   1304   	    int flags)
  1305   1305   }
  1306   1306   # Removed in 9.0:
  1307   1307   #declare 357 {deprecated {Use Tcl_EvalTokensStandard}} {
................................................................................
  1309   1309   #	    int count)
  1310   1310   #}
  1311   1311   declare 358 {
  1312   1312       void Tcl_FreeParse(Tcl_Parse *parsePtr)
  1313   1313   }
  1314   1314   declare 359 {
  1315   1315       void Tcl_LogCommandInfo(Tcl_Interp *interp, const char *script,
  1316         -	    const char *command, int length)
         1316  +	    const char *command, size_t length)
  1317   1317   }
  1318   1318   declare 360 {
  1319         -    int Tcl_ParseBraces(Tcl_Interp *interp, const char *start, int numBytes,
  1320         -	    Tcl_Parse *parsePtr, int append, const char **termPtr)
         1319  +    int Tcl_ParseBraces(Tcl_Interp *interp, const char *start,
         1320  +	    size_t numBytes, Tcl_Parse *parsePtr, int append,
         1321  +	    const char **termPtr)
  1321   1322   }
  1322   1323   declare 361 {
  1323         -    int Tcl_ParseCommand(Tcl_Interp *interp, const char *start, int numBytes,
  1324         -	    int nested, Tcl_Parse *parsePtr)
         1324  +    int Tcl_ParseCommand(Tcl_Interp *interp, const char *start,
         1325  +	    size_t numBytes, int nested, Tcl_Parse *parsePtr)
  1325   1326   }
  1326   1327   declare 362 {
  1327         -    int Tcl_ParseExpr(Tcl_Interp *interp, const char *start, int numBytes,
         1328  +    int Tcl_ParseExpr(Tcl_Interp *interp, const char *start, size_t numBytes,
  1328   1329   	    Tcl_Parse *parsePtr)
  1329   1330   }
  1330   1331   declare 363 {
  1331   1332       int Tcl_ParseQuotedString(Tcl_Interp *interp, const char *start,
  1332         -	    int numBytes, Tcl_Parse *parsePtr, int append,
         1333  +	    size_t numBytes, Tcl_Parse *parsePtr, int append,
  1333   1334   	    const char **termPtr)
  1334   1335   }
  1335   1336   declare 364 {
  1336         -    int Tcl_ParseVarName(Tcl_Interp *interp, const char *start, int numBytes,
  1337         -	    Tcl_Parse *parsePtr, int append)
         1337  +    int Tcl_ParseVarName(Tcl_Interp *interp, const char *start,
         1338  +	    size_t numBytes, Tcl_Parse *parsePtr, int append)
  1338   1339   }
  1339   1340   # These 4 functions are obsolete, use Tcl_FSGetCwd, Tcl_FSChdir,
  1340   1341   # Tcl_FSAccess and Tcl_FSStat
  1341   1342   declare 365 {
  1342   1343       char *Tcl_GetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr)
  1343   1344   }
  1344   1345   declare 366 {
................................................................................
  1347   1348   declare 367 {
  1348   1349      int Tcl_Access(const char *path, int mode)
  1349   1350   }
  1350   1351   declare 368 {
  1351   1352       int Tcl_Stat(const char *path, struct stat *bufPtr)
  1352   1353   }
  1353   1354   declare 369 {
  1354         -    int Tcl_UtfNcmp(const char *s1, const char *s2, unsigned long n)
         1355  +    int Tcl_UtfNcmp(const char *s1, const char *s2, size_t n)
  1355   1356   }
  1356   1357   declare 370 {
  1357         -    int Tcl_UtfNcasecmp(const char *s1, const char *s2, unsigned long n)
         1358  +    int Tcl_UtfNcasecmp(const char *s1, const char *s2, size_t n)
  1358   1359   }
  1359   1360   declare 371 {
  1360   1361       int Tcl_StringCaseMatch(const char *str, const char *pattern, int nocase)
  1361   1362   }
  1362   1363   declare 372 {
  1363   1364       int Tcl_UniCharIsControl(int ch)
  1364   1365   }
................................................................................
  1369   1370       int Tcl_UniCharIsPrint(int ch)
  1370   1371   }
  1371   1372   declare 375 {
  1372   1373       int Tcl_UniCharIsPunct(int ch)
  1373   1374   }
  1374   1375   declare 376 {
  1375   1376       int Tcl_RegExpExecObj(Tcl_Interp *interp, Tcl_RegExp regexp,
  1376         -	    Tcl_Obj *textObj, int offset, int nmatches, int flags)
         1377  +	    Tcl_Obj *textObj, size_t offset, size_t nmatches, int flags)
  1377   1378   }
  1378   1379   declare 377 {
  1379   1380       void Tcl_RegExpGetInfo(Tcl_RegExp regexp, Tcl_RegExpInfo *infoPtr)
  1380   1381   }
  1381   1382   declare 378 {
  1382         -    Tcl_Obj *Tcl_NewUnicodeObj(const Tcl_UniChar *unicode, int numChars)
         1383  +    Tcl_Obj *Tcl_NewUnicodeObj(const Tcl_UniChar *unicode, size_t numChars)
  1383   1384   }
  1384   1385   declare 379 {
  1385   1386       void Tcl_SetUnicodeObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode,
  1386         -	    int numChars)
         1387  +	    size_t numChars)
  1387   1388   }
  1388   1389   declare 380 {
  1389         -    int Tcl_GetCharLength(Tcl_Obj *objPtr)
         1390  +    size_t Tcl_GetCharLength(Tcl_Obj *objPtr)
  1390   1391   }
  1391   1392   declare 381 {
  1392         -    int Tcl_GetUniChar(Tcl_Obj *objPtr, int index)
         1393  +    int Tcl_GetUniChar(Tcl_Obj *objPtr, size_t index)
  1393   1394   }
  1394   1395   # Removed in 9.0, replaced by macro.
  1395   1396   #declare 382 {deprecated {No longer in use, changed to macro}} {
  1396   1397   #    Tcl_UniChar *Tcl_GetUnicode(Tcl_Obj *objPtr)
  1397   1398   #}
  1398   1399   declare 383 {
  1399         -    Tcl_Obj *Tcl_GetRange(Tcl_Obj *objPtr, int first, int last)
         1400  +    Tcl_Obj *Tcl_GetRange(Tcl_Obj *objPtr, size_t first, size_t last)
  1400   1401   }
  1401   1402   declare 384 {
  1402   1403       void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr, const Tcl_UniChar *unicode,
  1403         -	    int length)
         1404  +	    size_t length)
  1404   1405   }
  1405   1406   declare 385 {
  1406   1407       int Tcl_RegExpMatchObj(Tcl_Interp *interp, Tcl_Obj *textObj,
  1407   1408   	    Tcl_Obj *patternObj)
  1408   1409   }
  1409   1410   declare 386 {
  1410   1411       void Tcl_SetNotifier(Tcl_NotifierProcs *notifierProcPtr)
................................................................................
  1415   1416   declare 388 {
  1416   1417       int Tcl_GetChannelNames(Tcl_Interp *interp)
  1417   1418   }
  1418   1419   declare 389 {
  1419   1420       int Tcl_GetChannelNamesEx(Tcl_Interp *interp, const char *pattern)
  1420   1421   }
  1421   1422   declare 390 {
  1422         -    int Tcl_ProcObjCmd(ClientData clientData, Tcl_Interp *interp,
         1423  +    int Tcl_ProcObjCmd(void *clientData, Tcl_Interp *interp,
  1423   1424   	    int objc, Tcl_Obj *const objv[])
  1424   1425   }
  1425   1426   declare 391 {
  1426   1427       void Tcl_ConditionFinalize(Tcl_Condition *condPtr)
  1427   1428   }
  1428   1429   declare 392 {
  1429   1430       void Tcl_MutexFinalize(Tcl_Mutex *mutex)
  1430   1431   }
  1431   1432   declare 393 {
  1432   1433       int Tcl_CreateThread(Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc,
  1433         -	    ClientData clientData, int stackSize, int flags)
         1434  +	    void *clientData, size_t stackSize, int flags)
  1434   1435   }
  1435   1436   
  1436   1437   # Introduced in 8.3.2
  1437   1438   declare 394 {
  1438         -    int Tcl_ReadRaw(Tcl_Channel chan, char *dst, int bytesToRead)
         1439  +    size_t Tcl_ReadRaw(Tcl_Channel chan, char *dst, size_t bytesToRead)
  1439   1440   }
  1440   1441   declare 395 {
  1441         -    int Tcl_WriteRaw(Tcl_Channel chan, const char *src, int srcLen)
         1442  +    size_t Tcl_WriteRaw(Tcl_Channel chan, const char *src, size_t srcLen)
  1442   1443   }
  1443   1444   declare 396 {
  1444   1445       Tcl_Channel Tcl_GetTopChannel(Tcl_Channel chan)
  1445   1446   }
  1446   1447   declare 397 {
  1447   1448       int Tcl_ChannelBuffered(Tcl_Channel chan)
  1448   1449   }
................................................................................
  1522   1523       void Tcl_ClearChannelHandlers(Tcl_Channel channel)
  1523   1524   }
  1524   1525   declare 418 {
  1525   1526       int Tcl_IsChannelExisting(const char *channelName)
  1526   1527   }
  1527   1528   declare 419 {
  1528   1529       int Tcl_UniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct,
  1529         -	    unsigned long numChars)
         1530  +	    size_t numChars)
  1530   1531   }
  1531   1532   declare 420 {
  1532   1533       int Tcl_UniCharCaseMatch(const Tcl_UniChar *uniStr,
  1533   1534   	    const Tcl_UniChar *uniPattern, int nocase)
  1534   1535   }
  1535   1536   # Removed in 9.0, as it is actually a macro:
  1536   1537   #declare 421 {
................................................................................
  1545   1546       void Tcl_InitCustomHashTable(Tcl_HashTable *tablePtr, int keyType,
  1546   1547   	    const Tcl_HashKeyType *typePtr)
  1547   1548   }
  1548   1549   declare 424 {
  1549   1550       void Tcl_InitObjHashTable(Tcl_HashTable *tablePtr)
  1550   1551   }
  1551   1552   declare 425 {
  1552         -    ClientData Tcl_CommandTraceInfo(Tcl_Interp *interp, const char *varName,
         1553  +    void *Tcl_CommandTraceInfo(Tcl_Interp *interp, const char *varName,
  1553   1554   	    int flags, Tcl_CommandTraceProc *procPtr,
  1554         -	    ClientData prevClientData)
         1555  +	    void *prevClientData)
  1555   1556   }
  1556   1557   declare 426 {
  1557   1558       int Tcl_TraceCommand(Tcl_Interp *interp, const char *varName, int flags,
  1558         -	    Tcl_CommandTraceProc *proc, ClientData clientData)
         1559  +	    Tcl_CommandTraceProc *proc, void *clientData)
  1559   1560   }
  1560   1561   declare 427 {
  1561   1562       void Tcl_UntraceCommand(Tcl_Interp *interp, const char *varName,
  1562         -	    int flags, Tcl_CommandTraceProc *proc, ClientData clientData)
         1563  +	    int flags, Tcl_CommandTraceProc *proc, void *clientData)
  1563   1564   }
  1564   1565   declare 428 {
  1565         -    char *Tcl_AttemptAlloc(unsigned int size)
         1566  +    void *Tcl_AttemptAlloc(size_t size)
  1566   1567   }
  1567   1568   declare 429 {
  1568         -    char *Tcl_AttemptDbCkalloc(unsigned int size, const char *file, int line)
         1569  +    void *Tcl_AttemptDbCkalloc(size_t size, const char *file, int line)
  1569   1570   }
  1570   1571   declare 430 {
  1571         -    char *Tcl_AttemptRealloc(char *ptr, unsigned int size)
         1572  +    void *Tcl_AttemptRealloc(void *ptr, size_t size)
  1572   1573   }
  1573   1574   declare 431 {
  1574         -    char *Tcl_AttemptDbCkrealloc(char *ptr, unsigned int size,
         1575  +    void *Tcl_AttemptDbCkrealloc(void *ptr, size_t size,
  1575   1576   	    const char *file, int line)
  1576   1577   }
  1577   1578   declare 432 {
  1578         -    int Tcl_AttemptSetObjLength(Tcl_Obj *objPtr, int length)
         1579  +    int Tcl_AttemptSetObjLength(Tcl_Obj *objPtr, size_t length)
  1579   1580   }
  1580   1581   
  1581   1582   # TIP#10 (thread-aware channels) akupries
  1582   1583   declare 433 {
  1583   1584       Tcl_ThreadId Tcl_GetChannelThread(Tcl_Channel channel)
  1584   1585   }
  1585   1586   
................................................................................
  1589   1590   }
  1590   1591   
  1591   1592   # TIP#15 (math function introspection) dkf
  1592   1593   # Removed in 9.0:
  1593   1594   #declare 435 {deprecated {}} {
  1594   1595   #    int Tcl_GetMathFuncInfo(Tcl_Interp *interp, const char *name,
  1595   1596   #	    int *numArgsPtr, Tcl_ValueType **argTypesPtr,
  1596         -#	    Tcl_MathProc **procPtr, ClientData *clientDataPtr)
         1597  +#	    Tcl_MathProc **procPtr, void **clientDataPtr)
  1597   1598   #}
  1598   1599   # Removed in 9.0:
  1599   1600   #declare 436 {deprecated {}} {
  1600   1601   #    Tcl_Obj *Tcl_ListMathFuncs(Tcl_Interp *interp, const char *pattern)
  1601   1602   #}
  1602   1603   
  1603   1604   # TIP#36 (better access to 'subst') dkf
................................................................................
  1695   1696       Tcl_Obj *Tcl_FSGetNormalizedPath(Tcl_Interp *interp, Tcl_Obj *pathPtr)
  1696   1697   }
  1697   1698   declare 464 {
  1698   1699       Tcl_Obj *Tcl_FSJoinToPath(Tcl_Obj *pathPtr, int objc,
  1699   1700   	    Tcl_Obj *const objv[])
  1700   1701   }
  1701   1702   declare 465 {
  1702         -    ClientData Tcl_FSGetInternalRep(Tcl_Obj *pathPtr,
         1703  +    void *Tcl_FSGetInternalRep(Tcl_Obj *pathPtr,
  1703   1704   	    const Tcl_Filesystem *fsPtr)
  1704   1705   }
  1705   1706   declare 466 {
  1706   1707       Tcl_Obj *Tcl_FSGetTranslatedPath(Tcl_Interp *interp, Tcl_Obj *pathPtr)
  1707   1708   }
  1708   1709   declare 467 {
  1709   1710       int Tcl_FSEvalFile(Tcl_Interp *interp, Tcl_Obj *fileName)
  1710   1711   }
  1711   1712   declare 468 {
  1712   1713       Tcl_Obj *Tcl_FSNewNativePath(const Tcl_Filesystem *fromFilesystem,
  1713         -	    ClientData clientData)
         1714  +	    void *clientData)
  1714   1715   }
  1715   1716   declare 469 {
  1716   1717       const void *Tcl_FSGetNativePath(Tcl_Obj *pathPtr)
  1717   1718   }
  1718   1719   declare 470 {
  1719   1720       Tcl_Obj *Tcl_FSFileSystemInfo(Tcl_Obj *pathPtr)
  1720   1721   }
................................................................................
  1721   1722   declare 471 {
  1722   1723       Tcl_Obj *Tcl_FSPathSeparator(Tcl_Obj *pathPtr)
  1723   1724   }
  1724   1725   declare 472 {
  1725   1726       Tcl_Obj *Tcl_FSListVolumes(void)
  1726   1727   }
  1727   1728   declare 473 {
  1728         -    int Tcl_FSRegister(ClientData clientData, const Tcl_Filesystem *fsPtr)
         1729  +    int Tcl_FSRegister(void *clientData, const Tcl_Filesystem *fsPtr)
  1729   1730   }
  1730   1731   declare 474 {
  1731   1732       int Tcl_FSUnregister(const Tcl_Filesystem *fsPtr)
  1732   1733   }
  1733   1734   declare 475 {
  1734         -    ClientData Tcl_FSData(const Tcl_Filesystem *fsPtr)
         1735  +    void *Tcl_FSData(const Tcl_Filesystem *fsPtr)
  1735   1736   }
  1736   1737   declare 476 {
  1737   1738       const char *Tcl_FSGetTranslatedStringPath(Tcl_Interp *interp,
  1738   1739   	    Tcl_Obj *pathPtr)
  1739   1740   }
  1740   1741   declare 477 {
  1741   1742       const Tcl_Filesystem *Tcl_FSGetFileSystemForPath(Tcl_Obj *pathPtr)
................................................................................
  1751   1752   declare 480 {
  1752   1753       void Tcl_FSMountsChanged(const Tcl_Filesystem *fsPtr)
  1753   1754   }
  1754   1755   
  1755   1756   # TIP#56 (evaluate a parsed script) msofer
  1756   1757   declare 481 {
  1757   1758       int Tcl_EvalTokensStandard(Tcl_Interp *interp, Tcl_Token *tokenPtr,
  1758         -	    int count)
         1759  +	    size_t count)
  1759   1760   }
  1760   1761   
  1761   1762   # TIP#73 (access to current time) kbk
  1762   1763   declare 482 {
  1763   1764       void Tcl_GetTime(Tcl_Time *timeBuf)
  1764   1765   }
  1765   1766   
  1766   1767   # TIP#32 (object-enabled traces) kbk
  1767   1768   declare 483 {
  1768   1769       Tcl_Trace Tcl_CreateObjTrace(Tcl_Interp *interp, int level, int flags,
  1769         -	    Tcl_CmdObjTraceProc *objProc, ClientData clientData,
         1770  +	    Tcl_CmdObjTraceProc *objProc, void *clientData,
  1770   1771   	    Tcl_CmdObjTraceDeleteProc *delProc)
  1771   1772   }
  1772   1773   declare 484 {
  1773   1774       int Tcl_GetCommandInfoFromToken(Tcl_Command token, Tcl_CmdInfo *infoPtr)
  1774   1775   }
  1775   1776   declare 485 {
  1776   1777       int Tcl_SetCommandInfoFromToken(Tcl_Command token,
................................................................................
  1860   1861   	    const Tcl_Config *configuration, const char *valEncoding)
  1861   1862   }
  1862   1863   
  1863   1864   # TIP #139 (partial exposure of namespace API - transferred from tclInt.decls)
  1864   1865   # dkf, API by Brent Welch?
  1865   1866   declare 506 {
  1866   1867       Tcl_Namespace *Tcl_CreateNamespace(Tcl_Interp *interp, const char *name,
  1867         -	    ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc)
         1868  +	    void *clientData, Tcl_NamespaceDeleteProc *deleteProc)
  1868   1869   }
  1869   1870   declare 507 {
  1870   1871       void Tcl_DeleteNamespace(Tcl_Namespace *nsPtr)
  1871   1872   }
  1872   1873   declare 508 {
  1873   1874       int Tcl_AppendExportList(Tcl_Interp *interp, Tcl_Namespace *nsPtr,
  1874   1875   	    Tcl_Obj *objPtr)
................................................................................
  1917   1918   declare 519 {
  1918   1919       Tcl_ExitProc *Tcl_SetExitProc(TCL_NORETURN1 Tcl_ExitProc *proc)
  1919   1920   }
  1920   1921   
  1921   1922   # TIP#143 (resource limits) dkf
  1922   1923   declare 520 {
  1923   1924       void Tcl_LimitAddHandler(Tcl_Interp *interp, int type,
  1924         -	    Tcl_LimitHandlerProc *handlerProc, ClientData clientData,
         1925  +	    Tcl_LimitHandlerProc *handlerProc, void *clientData,
  1925   1926   	    Tcl_LimitHandlerDeleteProc *deleteProc)
  1926   1927   }
  1927   1928   declare 521 {
  1928   1929       void Tcl_LimitRemoveHandler(Tcl_Interp *interp, int type,
  1929         -	    Tcl_LimitHandlerProc *handlerProc, ClientData clientData)
         1930  +	    Tcl_LimitHandlerProc *handlerProc, void *clientData)
  1930   1931   }
  1931   1932   declare 522 {
  1932   1933       int Tcl_LimitReady(Tcl_Interp *interp)
  1933   1934   }
  1934   1935   declare 523 {
  1935   1936       int Tcl_LimitCheck(Tcl_Interp *interp)
  1936   1937   }
................................................................................
  2035   2036   	    Tcl_Namespace **namespacePtrPtr)
  2036   2037   }
  2037   2038   
  2038   2039   # TIP#233 (virtualized time) akupries
  2039   2040   declare 552 {
  2040   2041       void Tcl_SetTimeProc(Tcl_GetTimeProc *getProc,
  2041   2042   	    Tcl_ScaleTimeProc *scaleProc,
  2042         -	    ClientData clientData)
         2043  +	    void *clientData)
  2043   2044   }
  2044   2045   declare 553 {
  2045   2046       void Tcl_QueryTimeProc(Tcl_GetTimeProc **getProc,
  2046   2047   	    Tcl_ScaleTimeProc **scaleProc,
  2047         -	    ClientData *clientData)
         2048  +	    void **clientData)
  2048   2049   }
  2049   2050   
  2050   2051   # TIP#218 (driver thread actions) davygrvy/akupries ChannelType ver 4
  2051   2052   declare 554 {
  2052   2053       Tcl_DriverThreadActionProc *Tcl_ChannelThreadActionProc(
  2053   2054   	    const Tcl_ChannelType *chanTypePtr)
  2054   2055   }
................................................................................
  2131   2132   }
  2132   2133   
  2133   2134   # TIP#270 (utility C routines for string formatting) dgp
  2134   2135   declare 574 {
  2135   2136       void Tcl_AppendObjToErrorInfo(Tcl_Interp *interp, Tcl_Obj *objPtr)
  2136   2137   }
  2137   2138   declare 575 {
  2138         -    void Tcl_AppendLimitedToObj(Tcl_Obj *objPtr, const char *bytes, int length,
  2139         -	    int limit, const char *ellipsis)
         2139  +    void Tcl_AppendLimitedToObj(Tcl_Obj *objPtr, const char *bytes,
         2140  +	    size_t length, size_t limit, const char *ellipsis)
  2140   2141   }
  2141   2142   declare 576 {
  2142   2143       Tcl_Obj *Tcl_Format(Tcl_Interp *interp, const char *format, int objc,
  2143   2144   	    Tcl_Obj *const objv[])
  2144   2145   }
  2145   2146   declare 577 {
  2146   2147       int Tcl_AppendFormatToObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
................................................................................
  2154   2155   }
  2155   2156   
  2156   2157   # ----- BASELINE -- FOR -- 8.5.0 ----- #
  2157   2158   
  2158   2159   # TIP #285 (script cancellation support) jmistachkin
  2159   2160   declare 580 {
  2160   2161       int Tcl_CancelEval(Tcl_Interp *interp, Tcl_Obj *resultObjPtr,
  2161         -	    ClientData clientData, int flags)
         2162  +	    void *clientData, int flags)
  2162   2163   }
  2163   2164   declare 581 {
  2164   2165       int Tcl_Canceled(Tcl_Interp *interp, int flags)
  2165   2166   }
  2166   2167   
  2167   2168   # TIP#304 (chan pipe) aferrieux
  2168   2169   declare 582 {
................................................................................
  2170   2171   	    Tcl_Channel *wchan, int flags)
  2171   2172   }
  2172   2173   
  2173   2174   # TIP #322 (NRE public interface) msofer
  2174   2175   declare 583 {
  2175   2176       Tcl_Command Tcl_NRCreateCommand(Tcl_Interp *interp,
  2176   2177   	    const char *cmdName, Tcl_ObjCmdProc *proc,
  2177         -	    Tcl_ObjCmdProc *nreProc, ClientData clientData,
         2178  +	    Tcl_ObjCmdProc *nreProc, void *clientData,
  2178   2179   	    Tcl_CmdDeleteProc *deleteProc)
  2179   2180   }
  2180   2181   declare 584 {
  2181   2182       int Tcl_NREvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags)
  2182   2183   }
  2183   2184   declare 585 {
  2184         -    int Tcl_NREvalObjv(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[],
  2185         -	    int flags)
         2185  +    int Tcl_NREvalObjv(Tcl_Interp *interp, int objc,
         2186  +	    Tcl_Obj *const objv[], int flags)
  2186   2187   }
  2187   2188   declare 586 {
  2188   2189       int Tcl_NRCmdSwap(Tcl_Interp *interp, Tcl_Command cmd, int objc,
  2189   2190   	    Tcl_Obj *const objv[], int flags)
  2190   2191   }
  2191   2192   declare 587 {
  2192   2193       void Tcl_NRAddCallback(Tcl_Interp *interp, Tcl_NRPostProc *postProcPtr,
  2193         -	    ClientData data0, ClientData data1, ClientData data2,
  2194         -	    ClientData data3)
         2194  +	    void *data0, void *data1, void *data2,
         2195  +	    void *data3)
  2195   2196   }
  2196   2197   # For use by NR extenders, to have a simple way to also provide a (required!)
  2197   2198   # classic objProc
  2198   2199   declare 588 {
  2199   2200       int Tcl_NRCallObjProc(Tcl_Interp *interp, Tcl_ObjCmdProc *objProc,
  2200         -	    ClientData clientData, int objc, Tcl_Obj *const objv[])
         2201  +	    void *clientData, int objc, Tcl_Obj *const objv[])
  2201   2202   }
  2202   2203   
  2203   2204   # TIP#316 (Tcl_StatBuf reader functions) dkf
  2204   2205   declare 589 {
  2205   2206       unsigned Tcl_GetFSDeviceFromStat(const Tcl_StatBuf *statPtr)
  2206   2207   }
  2207   2208   declare 590 {
................................................................................
  2284   2285   # TIP#234 (zlib interface) dkf/Pascal Scheffers
  2285   2286   declare 610 {
  2286   2287       int Tcl_ZlibDeflate(Tcl_Interp *interp, int format, Tcl_Obj *data,
  2287   2288   	    int level, Tcl_Obj *gzipHeaderDictObj)
  2288   2289   }
  2289   2290   declare 611 {
  2290   2291       int Tcl_ZlibInflate(Tcl_Interp *interp, int format, Tcl_Obj *data,
  2291         -	    int buffersize, Tcl_Obj *gzipHeaderDictObj)
         2292  +	    size_t buffersize, Tcl_Obj *gzipHeaderDictObj)
  2292   2293   }
  2293   2294   declare 612 {
  2294   2295       unsigned int Tcl_ZlibCRC32(unsigned int crc, const unsigned char *buf,
  2295         -	    int len)
         2296  +	    size_t len)
  2296   2297   }
  2297   2298   declare 613 {
  2298   2299       unsigned int Tcl_ZlibAdler32(unsigned int adler, const unsigned char *buf,
  2299         -	    int len)
         2300  +	    size_t len)
  2300   2301   }
  2301   2302   declare 614 {
  2302   2303       int Tcl_ZlibStreamInit(Tcl_Interp *interp, int mode, int format,
  2303   2304   	    int level, Tcl_Obj *dictObj, Tcl_ZlibStream *zshandle)
  2304   2305   }
  2305   2306   declare 615 {
  2306   2307       Tcl_Obj *Tcl_ZlibStreamGetCommandName(Tcl_ZlibStream zshandle)
................................................................................
  2311   2312   declare 617 {
  2312   2313       int Tcl_ZlibStreamChecksum(Tcl_ZlibStream zshandle)
  2313   2314   }
  2314   2315   declare 618 {
  2315   2316       int Tcl_ZlibStreamPut(Tcl_ZlibStream zshandle, Tcl_Obj *data, int flush)
  2316   2317   }
  2317   2318   declare 619 {
  2318         -    int Tcl_ZlibStreamGet(Tcl_ZlibStream zshandle, Tcl_Obj *data, int count)
         2319  +    int Tcl_ZlibStreamGet(Tcl_ZlibStream zshandle, Tcl_Obj *data,
         2320  +	    size_t count)
  2319   2321   }
  2320   2322   declare 620 {
  2321   2323       int Tcl_ZlibStreamClose(Tcl_ZlibStream zshandle)
  2322   2324   }
  2323   2325   declare 621 {
  2324   2326       int Tcl_ZlibStreamReset(Tcl_ZlibStream zshandle)
  2325   2327   }
................................................................................
  2369   2371   
  2370   2372   # ----- BASELINE -- FOR -- 8.6.0 ----- #
  2371   2373   
  2372   2374   # TIP #456
  2373   2375   declare 631 {
  2374   2376       Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, const char *service,
  2375   2377   	    const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc,
  2376         -	    ClientData callbackData)
         2378  +	    void *callbackData)
  2377   2379   }
  2378   2380   
  2379   2381   # TIP #430
  2380   2382   declare 632 {
  2381   2383       int TclZipfs_Mount(Tcl_Interp *interp, const char *mountPoint,
  2382   2384   	    const char *zipname, const char *passwd)
  2383   2385   }
................................................................................
  2407   2409   
  2408   2410   ################################
  2409   2411   # Windows specific functions
  2410   2412   
  2411   2413   # Added in Tcl 8.1
  2412   2414   
  2413   2415   declare 0 win {
  2414         -    TCHAR *Tcl_WinUtfToTChar(const char *str, int len, Tcl_DString *dsPtr)
         2416  +    TCHAR *Tcl_WinUtfToTChar(const char *str, size_t len, Tcl_DString *dsPtr)
  2415   2417   }
  2416   2418   declare 1 win {
  2417         -    char *Tcl_WinTCharToUtf(const TCHAR *str, int len, Tcl_DString *dsPtr)
         2419  +    char *Tcl_WinTCharToUtf(const TCHAR *str, size_t len, Tcl_DString *dsPtr)
  2418   2420   }
  2419   2421   
  2420   2422   ################################
  2421   2423   # Mac OS X specific functions
  2422   2424   
  2423   2425   declare 0 macosx {
  2424   2426       int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp,
  2425   2427   	    const char *bundleName, int hasResourceFile,
  2426         -	    int maxPathLen, char *libraryPath)
         2428  +	    size_t maxPathLen, char *libraryPath)
  2427   2429   }
  2428   2430   declare 1 macosx {
  2429   2431       int Tcl_MacOSXOpenVersionedBundleResources(Tcl_Interp *interp,
  2430   2432   	    const char *bundleName, const char *bundleVersion,
  2431         -	    int hasResourceFile, int maxPathLen, char *libraryPath)
         2433  +	    int hasResourceFile, size_t maxPathLen, char *libraryPath)
  2432   2434   }
  2433   2435   
  2434   2436   ##############################################################################
  2435   2437   
  2436   2438   # Public functions that are not accessible via the stubs table.
  2437   2439   
  2438   2440   export {

Changes to generic/tcl.h.

   391    391    *----------------------------------------------------------------------------
   392    392    * Definition of the interface to functions implementing threads. A function
   393    393    * following this definition is given to each call of 'Tcl_CreateThread' and
   394    394    * will be called as the main fuction of the new thread created by that call.
   395    395    */
   396    396   
   397    397   #if defined _WIN32
   398         -typedef unsigned (__stdcall Tcl_ThreadCreateProc) (ClientData clientData);
          398  +typedef unsigned (__stdcall Tcl_ThreadCreateProc) (void *clientData);
   399    399   #else
   400         -typedef void (Tcl_ThreadCreateProc) (ClientData clientData);
          400  +typedef void (Tcl_ThreadCreateProc) (void *clientData);
   401    401   #endif
   402    402   
   403    403   /*
   404    404    * Threading function return types used for abstracting away platform
   405    405    * differences when writing a Tcl_ThreadCreateProc. See the NewThread function
   406    406    * in generic/tclThreadTest.c for it's usage.
   407    407    */
................................................................................
   532    532   
   533    533   /*
   534    534    *----------------------------------------------------------------------------
   535    535    * Function types defined by Tcl:
   536    536    */
   537    537   
   538    538   typedef int (Tcl_AppInitProc) (Tcl_Interp *interp);
   539         -typedef int (Tcl_AsyncProc) (ClientData clientData, Tcl_Interp *interp,
          539  +typedef int (Tcl_AsyncProc) (void *clientData, Tcl_Interp *interp,
   540    540   	int code);
   541         -typedef void (Tcl_ChannelProc) (ClientData clientData, int mask);
   542         -typedef void (Tcl_CloseProc) (ClientData data);
   543         -typedef void (Tcl_CmdDeleteProc) (ClientData clientData);
   544         -typedef int (Tcl_CmdProc) (ClientData clientData, Tcl_Interp *interp,
          541  +typedef void (Tcl_ChannelProc) (void *clientData, int mask);
          542  +typedef void (Tcl_CloseProc) (void *data);
          543  +typedef void (Tcl_CmdDeleteProc) (void *clientData);
          544  +typedef int (Tcl_CmdProc) (void *clientData, Tcl_Interp *interp,
   545    545   	int argc, const char *argv[]);
   546         -typedef void (Tcl_CmdTraceProc) (ClientData clientData, Tcl_Interp *interp,
          546  +typedef void (Tcl_CmdTraceProc) (void *clientData, Tcl_Interp *interp,
   547    547   	int level, char *command, Tcl_CmdProc *proc,
   548         -	ClientData cmdClientData, int argc, const char *argv[]);
   549         -typedef int (Tcl_CmdObjTraceProc) (ClientData clientData, Tcl_Interp *interp,
          548  +	void *cmdClientData, int argc, const char *argv[]);
          549  +typedef int (Tcl_CmdObjTraceProc) (void *clientData, Tcl_Interp *interp,
   550    550   	int level, const char *command, Tcl_Command commandInfo, int objc,
   551    551   	struct Tcl_Obj *const *objv);
   552         -typedef void (Tcl_CmdObjTraceDeleteProc) (ClientData clientData);
          552  +typedef void (Tcl_CmdObjTraceDeleteProc) (void *clientData);
   553    553   typedef void (Tcl_DupInternalRepProc) (struct Tcl_Obj *srcPtr,
   554    554   	struct Tcl_Obj *dupPtr);
   555         -typedef int (Tcl_EncodingConvertProc) (ClientData clientData, const char *src,
          555  +typedef int (Tcl_EncodingConvertProc) (void *clientData, const char *src,
   556    556   	int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst,
   557    557   	int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr);
   558         -typedef void (Tcl_EncodingFreeProc) (ClientData clientData);
          558  +#define Tcl_EncodingFreeProc Tcl_FreeProc
   559    559   typedef int (Tcl_EventProc) (Tcl_Event *evPtr, int flags);
   560         -typedef void (Tcl_EventCheckProc) (ClientData clientData, int flags);
   561         -typedef int (Tcl_EventDeleteProc) (Tcl_Event *evPtr, ClientData clientData);
   562         -typedef void (Tcl_EventSetupProc) (ClientData clientData, int flags);
   563         -typedef void (Tcl_ExitProc) (ClientData clientData);
   564         -typedef void (Tcl_FileProc) (ClientData clientData, int mask);
   565         -typedef void (Tcl_FileFreeProc) (ClientData clientData);
          560  +typedef void (Tcl_EventCheckProc) (void *clientData, int flags);
          561  +typedef int (Tcl_EventDeleteProc) (Tcl_Event *evPtr, void *clientData);
          562  +typedef void (Tcl_EventSetupProc) (void *clientData, int flags);
          563  +#define Tcl_ExitProc Tcl_FreeProc
          564  +typedef void (Tcl_FileProc) (void *clientData, int mask);
          565  +#define Tcl_FileFreeProc Tcl_FreeProc
   566    566   typedef void (Tcl_FreeInternalRepProc) (struct Tcl_Obj *objPtr);
   567         -typedef void (Tcl_FreeProc) (char *blockPtr);
   568         -typedef void (Tcl_IdleProc) (ClientData clientData);
   569         -typedef void (Tcl_InterpDeleteProc) (ClientData clientData,
          567  +typedef void (Tcl_FreeProc) (void *blockPtr);
          568  +typedef void (Tcl_IdleProc) (void *clientData);
          569  +typedef void (Tcl_InterpDeleteProc) (void *clientData,
   570    570   	Tcl_Interp *interp);
   571         -typedef void (Tcl_NamespaceDeleteProc) (ClientData clientData);
   572         -typedef int (Tcl_ObjCmdProc) (ClientData clientData, Tcl_Interp *interp,
          571  +typedef void (Tcl_NamespaceDeleteProc) (void *clientData);
          572  +typedef int (Tcl_ObjCmdProc) (void *clientData, Tcl_Interp *interp,
   573    573   	int objc, struct Tcl_Obj *const *objv);
   574    574   typedef int (Tcl_PackageInitProc) (Tcl_Interp *interp);
   575    575   typedef int (Tcl_PackageUnloadProc) (Tcl_Interp *interp, int flags);
   576    576   typedef void (Tcl_PanicProc) (const char *format, ...);
   577         -typedef void (Tcl_TcpAcceptProc) (ClientData callbackData, Tcl_Channel chan,
          577  +typedef void (Tcl_TcpAcceptProc) (void *callbackData, Tcl_Channel chan,
   578    578   	char *address, int port);
   579         -typedef void (Tcl_TimerProc) (ClientData clientData);
          579  +typedef void (Tcl_TimerProc) (void *clientData);
   580    580   typedef int (Tcl_SetFromAnyProc) (Tcl_Interp *interp, struct Tcl_Obj *objPtr);
   581    581   typedef void (Tcl_UpdateStringProc) (struct Tcl_Obj *objPtr);
   582         -typedef char * (Tcl_VarTraceProc) (ClientData clientData, Tcl_Interp *interp,
          582  +typedef char * (Tcl_VarTraceProc) (void *clientData, Tcl_Interp *interp,
   583    583   	const char *part1, const char *part2, int flags);
   584         -typedef void (Tcl_CommandTraceProc) (ClientData clientData, Tcl_Interp *interp,
          584  +typedef void (Tcl_CommandTraceProc) (void *clientData, Tcl_Interp *interp,
   585    585   	const char *oldName, const char *newName, int flags);
   586    586   typedef void (Tcl_CreateFileHandlerProc) (int fd, int mask, Tcl_FileProc *proc,
   587         -	ClientData clientData);
          587  +	void *clientData);
   588    588   typedef void (Tcl_DeleteFileHandlerProc) (int fd);
   589         -typedef void (Tcl_AlertNotifierProc) (ClientData clientData);
          589  +typedef void (Tcl_AlertNotifierProc) (void *clientData);
   590    590   typedef void (Tcl_ServiceModeHookProc) (int mode);
   591         -typedef ClientData (Tcl_InitNotifierProc) (void);
   592         -typedef void (Tcl_FinalizeNotifierProc) (ClientData clientData);
          591  +typedef void *(Tcl_InitNotifierProc) (void);
          592  +typedef void (Tcl_FinalizeNotifierProc) (void *clientData);
   593    593   typedef void (Tcl_MainLoopProc) (void);
   594    594   
   595    595   /*
   596    596    *----------------------------------------------------------------------------
   597    597    * The following structure represents a type of object, which is a particular
   598    598    * internal representation for an object plus a set of functions that provide
   599    599    * standard operations on objects of that type.
................................................................................
   620    620   /*
   621    621    * One of the following structures exists for each object in the Tcl system.
   622    622    * An object stores a value as either a string, some internal representation,
   623    623    * or both.
   624    624    */
   625    625   
   626    626   typedef struct Tcl_Obj {
   627         -    int refCount;		/* When 0 the object will be freed. */
          627  +    size_t refCount;		/* When 0 the object will be freed. */
   628    628       char *bytes;		/* This points to the first byte of the
   629    629   				 * object's string representation. The array
   630    630   				 * must be followed by a null byte (i.e., at
   631    631   				 * offset length) but may also contain
   632    632   				 * embedded null characters. The array's
   633         -				 * storage is allocated by ckalloc. NULL means
          633  +				 * storage is allocated by Tcl_Alloc. NULL means
   634    634   				 * the string rep is invalid and must be
   635    635   				 * regenerated from the internal rep.  Clients
   636    636   				 * should use Tcl_GetStringFromObj or
   637    637   				 * Tcl_GetString to get a pointer to the byte
   638    638   				 * array as a readonly value. */
   639         -    int length;			/* The number of bytes at *bytes, not
          639  +    size_t length;		/* The number of bytes at *bytes, not
   640    640   				 * including the terminating null. */
   641    641       const Tcl_ObjType *typePtr;	/* Denotes the object's type. Always
   642    642   				 * corresponds to the type of the object's
   643    643   				 * internal rep. NULL indicates the object has
   644    644   				 * no internal rep (has no type). */
   645    645       union {			/* The internal representation: */
   646    646   	long longValue;		/*   - an long integer value. */
................................................................................
   695    695   typedef struct Tcl_Namespace {
   696    696       char *name;			/* The namespace's name within its parent
   697    697   				 * namespace. This contains no ::'s. The name
   698    698   				 * of the global namespace is "" although "::"
   699    699   				 * is an synonym. */
   700    700       char *fullName;		/* The namespace's fully qualified name. This
   701    701   				 * starts with ::. */
   702         -    ClientData clientData;	/* Arbitrary value associated with this
          702  +    void *clientData;	/* Arbitrary value associated with this
   703    703   				 * namespace. */
   704    704       Tcl_NamespaceDeleteProc *deleteProc;
   705    705   				/* Function invoked when deleting the
   706    706   				 * namespace to, e.g., free clientData. */
   707    707       struct Tcl_Namespace *parentPtr;
   708    708   				/* Points to the namespace that contains this
   709    709   				 * one. NULL if this is the global
................................................................................
   767    767   
   768    768   typedef struct Tcl_CmdInfo {
   769    769       int isNativeObjectProc;	/* 1 if objProc was registered by a call to
   770    770   				 * Tcl_CreateObjCommand; 0 otherwise.
   771    771   				 * Tcl_SetCmdInfo does not modify this
   772    772   				 * field. */
   773    773       Tcl_ObjCmdProc *objProc;	/* Command's object-based function. */
   774         -    ClientData objClientData;	/* ClientData for object proc. */
          774  +    void *objClientData;	/* ClientData for object proc. */
   775    775       Tcl_CmdProc *proc;		/* Command's string-based function. */
   776         -    ClientData clientData;	/* ClientData for string proc. */
          776  +    void *clientData;	/* ClientData for string proc. */
   777    777       Tcl_CmdDeleteProc *deleteProc;
   778    778   				/* Function to call when command is
   779    779   				 * deleted. */
   780         -    ClientData deleteData;	/* Value to pass to deleteProc (usually the
          780  +    void *deleteData;	/* Value to pass to deleteProc (usually the
   781    781   				 * same as clientData). */
   782    782       Tcl_Namespace *namespacePtr;/* Points to the namespace that contains this
   783    783   				 * command. Note that Tcl_SetCmdInfo will not
   784    784   				 * change a command's namespace; use
   785    785   				 * TclRenameCommand or Tcl_Eval (of 'rename')
   786    786   				 * to do that. */
   787    787   } Tcl_CmdInfo;
................................................................................
   793    793    * macros Tcl_DStringValue and Tcl_DStringLength.
   794    794    */
   795    795   
   796    796   #define TCL_DSTRING_STATIC_SIZE 200
   797    797   typedef struct Tcl_DString {
   798    798       char *string;		/* Points to beginning of string: either
   799    799   				 * staticSpace below or a malloced array. */
   800         -    int length;			/* Number of non-NULL characters in the
          800  +    size_t length;		/* Number of non-NULL characters in the
   801    801   				 * string. */
   802         -    int spaceAvl;		/* Total number of bytes available for the
          802  +    size_t spaceAvl;		/* Total number of bytes available for the
   803    803   				 * string and its terminating NULL char. */
   804    804       char staticSpace[TCL_DSTRING_STATIC_SIZE];
   805    805   				/* Space to use in common case where string is
   806    806   				 * small. */
   807    807   } Tcl_DString;
   808    808   
   809    809   #define Tcl_DStringLength(dsPtr) ((dsPtr)->length)
................................................................................
   953    953   
   954    954   /*
   955    955    *----------------------------------------------------------------------------
   956    956    * Forward declarations of Tcl_HashTable and related types.
   957    957    */
   958    958   
   959    959   #ifndef TCL_HASH_TYPE
   960         -#  define TCL_HASH_TYPE unsigned
          960  +#  define TCL_HASH_TYPE size_t
   961    961   #endif
   962    962   
   963    963   typedef struct Tcl_HashKeyType Tcl_HashKeyType;
   964    964   typedef struct Tcl_HashTable Tcl_HashTable;
   965    965   typedef struct Tcl_HashEntry Tcl_HashEntry;
   966    966   
   967    967   typedef TCL_HASH_TYPE (Tcl_HashKeyProc) (Tcl_HashTable *tablePtr, void *keyPtr);
................................................................................
   975    975    * should access any of these fields directly; use the macros defined below.
   976    976    */
   977    977   
   978    978   struct Tcl_HashEntry {
   979    979       Tcl_HashEntry *nextPtr;	/* Pointer to next entry in this hash bucket,
   980    980   				 * or NULL for end of chain. */
   981    981       Tcl_HashTable *tablePtr;	/* Pointer to table containing entry. */
   982         -    unsigned int hash;		/* Hash value. */
   983         -    ClientData clientData;	/* Application stores something here with
          982  +    size_t hash;		/* Hash value. */
          983  +    void *clientData;		/* Application stores something here with
   984    984   				 * Tcl_SetHashValue. */
   985    985       union {			/* Key has one of these forms: */
   986    986   	char *oneWordValue;	/* One-word value for key. */
   987    987   	Tcl_Obj *objPtr;	/* Tcl_Obj * key value. */
   988    988   	int words[1];		/* Multiple integer words for key. The actual
   989    989   				 * size will be as large as necessary for this
   990    990   				 * table's keys. */
................................................................................
  1064   1064   struct Tcl_HashTable {
  1065   1065       Tcl_HashEntry **buckets;	/* Pointer to bucket array. Each element
  1066   1066   				 * points to first entry in bucket's hash
  1067   1067   				 * chain, or NULL. */
  1068   1068       Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
  1069   1069   				/* Bucket array used for small tables (to
  1070   1070   				 * avoid mallocs and frees). */
  1071         -    int numBuckets;		/* Total number of buckets allocated at
         1071  +    size_t numBuckets;		/* Total number of buckets allocated at
  1072   1072   				 * **bucketPtr. */
  1073         -    int numEntries;		/* Total number of entries present in
         1073  +    size_t numEntries;		/* Total number of entries present in
  1074   1074   				 * table. */
  1075         -    int rebuildSize;		/* Enlarge table when numEntries gets to be
         1075  +    size_t rebuildSize;		/* Enlarge table when numEntries gets to be
  1076   1076   				 * this large. */
  1077         -    unsigned int mask;		/* Mask value used in hashing function. */
         1077  +    size_t mask;		/* Mask value used in hashing function. */
  1078   1078       int downShift;		/* Shift count used in hashing function.
  1079   1079   				 * Designed to use high-order bits of
  1080   1080   				 * randomized keys. */
  1081   1081       int keyType;		/* Type of keys used in this table. It's
  1082   1082   				 * either TCL_CUSTOM_KEYS, TCL_STRING_KEYS,
  1083   1083   				 * TCL_ONE_WORD_KEYS, or an integer giving the
  1084   1084   				 * number of ints that is the size of the
................................................................................
  1094   1094   /*
  1095   1095    * Structure definition for information used to keep track of searches through
  1096   1096    * hash tables:
  1097   1097    */
  1098   1098   
  1099   1099   typedef struct Tcl_HashSearch {
  1100   1100       Tcl_HashTable *tablePtr;	/* Table being searched. */
  1101         -    int nextIndex;		/* Index of next bucket to be enumerated after
         1101  +    size_t nextIndex;		/* Index of next bucket to be enumerated after
  1102   1102   				 * present one. */
  1103   1103       Tcl_HashEntry *nextEntryPtr;/* Next entry to be enumerated in the current
  1104   1104   				 * bucket. */
  1105   1105   } Tcl_HashSearch;
  1106   1106   
  1107   1107   /*
  1108   1108    * Acceptable key types for hash tables:
................................................................................
  1135   1135    * dictionaries. These fields should not be accessed by code outside
  1136   1136    * tclDictObj.c
  1137   1137    */
  1138   1138   
  1139   1139   typedef struct {
  1140   1140       void *next;			/* Search position for underlying hash
  1141   1141   				 * table. */
  1142         -    unsigned int epoch; 	/* Epoch marker for dictionary being searched,
         1142  +    size_t epoch;		/* Epoch marker for dictionary being searched,
  1143   1143   				 * or 0 if search has terminated. */
  1144   1144       Tcl_Dict dictionaryPtr;	/* Reference to dictionary being searched. */
  1145   1145   } Tcl_DictSearch;
  1146   1146   
  1147   1147   /*
  1148   1148    *----------------------------------------------------------------------------
  1149   1149    * Flag values to pass to Tcl_DoOneEvent to disable searches for some kinds of
................................................................................
  1201   1201   typedef void (Tcl_SetTimerProc) (const Tcl_Time *timePtr);
  1202   1202   typedef int (Tcl_WaitForEventProc) (const Tcl_Time *timePtr);
  1203   1203   
  1204   1204   /*
  1205   1205    * TIP #233 (Virtualized Time)
  1206   1206    */
  1207   1207   
  1208         -typedef void (Tcl_GetTimeProc)   (Tcl_Time *timebuf, ClientData clientData);
  1209         -typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, ClientData clientData);
         1208  +typedef void (Tcl_GetTimeProc)   (Tcl_Time *timebuf, void *clientData);
         1209  +typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, void *clientData);
  1210   1210   
  1211   1211   /*
  1212   1212    *----------------------------------------------------------------------------
  1213   1213    * Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler to
  1214   1214    * indicate what sorts of events are of interest:
  1215   1215    */
  1216   1216   
................................................................................
  1261   1261   #define TCL_CHANNEL_THREAD_INSERT (0)
  1262   1262   #define TCL_CHANNEL_THREAD_REMOVE (1)
  1263   1263   
  1264   1264   /*
  1265   1265    * Typedefs for the various operations in a channel type:
  1266   1266    */
  1267   1267   
  1268         -typedef int	(Tcl_DriverBlockModeProc) (ClientData instanceData, int mode);
  1269         -typedef int	(Tcl_DriverCloseProc) (ClientData instanceData,
         1268  +typedef int	(Tcl_DriverBlockModeProc) (void *instanceData, int mode);
         1269  +typedef int	(Tcl_DriverCloseProc) (void *instanceData,
  1270   1270   			Tcl_Interp *interp);
  1271         -typedef int	(Tcl_DriverClose2Proc) (ClientData instanceData,
         1271  +typedef int	(Tcl_DriverClose2Proc) (void *instanceData,
  1272   1272   			Tcl_Interp *interp, int flags);
  1273         -typedef int	(Tcl_DriverInputProc) (ClientData instanceData, char *buf,
         1273  +typedef int	(Tcl_DriverInputProc) (void *instanceData, char *buf,
  1274   1274   			int toRead, int *errorCodePtr);
  1275         -typedef int	(Tcl_DriverOutputProc) (ClientData instanceData,
         1275  +typedef int	(Tcl_DriverOutputProc) (void *instanceData,
  1276   1276   			const char *buf, int toWrite, int *errorCodePtr);
  1277         -typedef int	(Tcl_DriverSeekProc) (ClientData instanceData, long offset,
         1277  +typedef int	(Tcl_DriverSeekProc) (void *instanceData, long offset,
  1278   1278   			int mode, int *errorCodePtr);
  1279         -typedef int	(Tcl_DriverSetOptionProc) (ClientData instanceData,
         1279  +typedef int	(Tcl_DriverSetOptionProc) (void *instanceData,
  1280   1280   			Tcl_Interp *interp, const char *optionName,
  1281   1281   			const char *value);
  1282         -typedef int	(Tcl_DriverGetOptionProc) (ClientData instanceData,
         1282  +typedef int	(Tcl_DriverGetOptionProc) (void *instanceData,
  1283   1283   			Tcl_Interp *interp, const char *optionName,
  1284   1284   			Tcl_DString *dsPtr);
  1285         -typedef void	(Tcl_DriverWatchProc) (ClientData instanceData, int mask);
  1286         -typedef int	(Tcl_DriverGetHandleProc) (ClientData instanceData,
  1287         -			int direction, ClientData *handlePtr);
  1288         -typedef int	(Tcl_DriverFlushProc) (ClientData instanceData);
  1289         -typedef int	(Tcl_DriverHandlerProc) (ClientData instanceData,
         1285  +typedef void	(Tcl_DriverWatchProc) (void *instanceData, int mask);
         1286  +typedef int	(Tcl_DriverGetHandleProc) (void *instanceData,
         1287  +			int direction, void **handlePtr);
         1288  +typedef int	(Tcl_DriverFlushProc) (void *instanceData);
         1289  +typedef int	(Tcl_DriverHandlerProc) (void *instanceData,
  1290   1290   			int interestMask);
  1291         -typedef Tcl_WideInt (Tcl_DriverWideSeekProc) (ClientData instanceData,
         1291  +typedef Tcl_WideInt (Tcl_DriverWideSeekProc) (void *instanceData,
  1292   1292   			Tcl_WideInt offset, int mode, int *errorCodePtr);
  1293   1293   /*
  1294   1294    * TIP #218, Channel Thread Actions
  1295   1295    */
  1296         -typedef void	(Tcl_DriverThreadActionProc) (ClientData instanceData,
         1296  +typedef void	(Tcl_DriverThreadActionProc) (void *instanceData,
  1297   1297   			int action);
  1298   1298   /*
  1299   1299    * TIP #208, File Truncation (etc.)
  1300   1300    */
  1301         -typedef int	(Tcl_DriverTruncateProc) (ClientData instanceData,
         1301  +typedef int	(Tcl_DriverTruncateProc) (void *instanceData,
  1302   1302   			Tcl_WideInt length);
  1303   1303   
  1304   1304   /*
  1305   1305    * struct Tcl_ChannelType:
  1306   1306    *
  1307   1307    * One such structure exists for each type (kind) of channel. It collects
  1308   1308    * together in one place all the functions that are part of the specific
................................................................................
  1476   1476   typedef int (Tcl_FSFileAttrsSetProc) (Tcl_Interp *interp, int index,
  1477   1477   	Tcl_Obj *pathPtr, Tcl_Obj *objPtr);
  1478   1478   typedef Tcl_Obj * (Tcl_FSLinkProc) (Tcl_Obj *pathPtr, Tcl_Obj *toPtr,
  1479   1479   	int linkType);
  1480   1480   typedef int (Tcl_FSLoadFileProc) (Tcl_Interp *interp, Tcl_Obj *pathPtr,
  1481   1481   	Tcl_LoadHandle *handlePtr, Tcl_FSUnloadFileProc **unloadProcPtr);
  1482   1482   typedef int (Tcl_FSPathInFilesystemProc) (Tcl_Obj *pathPtr,
  1483         -	ClientData *clientDataPtr);
         1483  +	void **clientDataPtr);
  1484   1484   typedef Tcl_Obj * (Tcl_FSFilesystemPathTypeProc) (Tcl_Obj *pathPtr);
  1485   1485   typedef Tcl_Obj * (Tcl_FSFilesystemSeparatorProc) (Tcl_Obj *pathPtr);
  1486         -typedef void (Tcl_FSFreeInternalRepProc) (ClientData clientData);
  1487         -typedef ClientData (Tcl_FSDupInternalRepProc) (ClientData clientData);
  1488         -typedef Tcl_Obj * (Tcl_FSInternalToNormalizedProc) (ClientData clientData);
  1489         -typedef ClientData (Tcl_FSCreateInternalRepProc) (Tcl_Obj *pathPtr);
         1486  +#define Tcl_FSFreeInternalRepProc Tcl_FreeProc
         1487  +typedef void *(Tcl_FSDupInternalRepProc) (void *clientData);
         1488  +typedef Tcl_Obj * (Tcl_FSInternalToNormalizedProc) (void *clientData);
         1489  +typedef void *(Tcl_FSCreateInternalRepProc) (Tcl_Obj *pathPtr);
  1490   1490   
  1491   1491   typedef struct Tcl_FSVersion_ *Tcl_FSVersion;
  1492   1492   
  1493   1493   /*
  1494   1494    *----------------------------------------------------------------------------
  1495   1495    * Data structures related to hooking into the filesystem
  1496   1496    */
................................................................................
  1512   1512    * Not all entries need be non-NULL; any which are NULL are simply ignored.
  1513   1513    * However, a complete filesystem should provide all of these functions. The
  1514   1514    * explanations in the structure show the importance of each function.
  1515   1515    */
  1516   1516   
  1517   1517   typedef struct Tcl_Filesystem {
  1518   1518       const char *typeName;	/* The name of the filesystem. */
  1519         -    int structureLength;	/* Length of this structure, so future binary
         1519  +    size_t structureLength;	/* Length of this structure, so future binary
  1520   1520   				 * compatibility can be assured. */
  1521   1521       Tcl_FSVersion version;	/* Version of the filesystem type. */
  1522   1522       Tcl_FSPathInFilesystemProc *pathInFilesystemProc;
  1523   1523   				/* Function to check whether a path is in this
  1524   1524   				 * filesystem. This is the most important
  1525   1525   				 * filesystem function. */
  1526   1526       Tcl_FSDupInternalRepProc *dupInternalRepProc;
................................................................................
  1702   1702    * token.
  1703   1703    */
  1704   1704   
  1705   1705   typedef struct Tcl_Token {
  1706   1706       int type;			/* Type of token, such as TCL_TOKEN_WORD; see
  1707   1707   				 * below for valid types. */
  1708   1708       const char *start;		/* First character in token. */
  1709         -    int size;			/* Number of bytes in token. */
  1710         -    int numComponents;		/* If this token is composed of other tokens,
         1709  +    size_t size;			/* Number of bytes in token. */
         1710  +    size_t numComponents;		/* If this token is composed of other tokens,
  1711   1711   				 * this field tells how many of them there are
  1712   1712   				 * (including components of components, etc.).
  1713   1713   				 * The component tokens immediately follow
  1714   1714   				 * this one. */
  1715   1715   } Tcl_Token;
  1716   1716   
  1717   1717   /*
................................................................................
  1817   1817    */
  1818   1818   
  1819   1819   #define NUM_STATIC_TOKENS 20
  1820   1820   
  1821   1821   typedef struct Tcl_Parse {
  1822   1822       const char *commentStart;	/* Pointer to # that begins the first of one
  1823   1823   				 * or more comments preceding the command. */
  1824         -    int commentSize;		/* Number of bytes in comments (up through
         1824  +    size_t commentSize;		/* Number of bytes in comments (up through
  1825   1825   				 * newline character that terminates the last
  1826   1826   				 * comment). If there were no comments, this
  1827   1827   				 * field is 0. */
  1828   1828       const char *commandStart;	/* First character in first word of
  1829   1829   				 * command. */
  1830   1830       int commandSize;		/* Number of bytes in command, including first
  1831   1831   				 * character of first word, up through the
................................................................................
  1885   1885   				 * encoding type. */
  1886   1886       Tcl_EncodingConvertProc *toUtfProc;
  1887   1887   				/* Function to convert from external encoding
  1888   1888   				 * into UTF-8. */
  1889   1889       Tcl_EncodingConvertProc *fromUtfProc;
  1890   1890   				/* Function to convert from UTF-8 into
  1891   1891   				 * external encoding. */
  1892         -    Tcl_EncodingFreeProc *freeProc;
         1892  +    Tcl_FreeProc *freeProc;
  1893   1893   				/* If non-NULL, function to call when this
  1894   1894   				 * encoding is deleted. */
  1895         -    ClientData clientData;	/* Arbitrary value associated with encoding
         1895  +    void *clientData;	/* Arbitrary value associated with encoding
  1896   1896   				 * type. Passed to conversion functions. */
  1897   1897       int nullSize;		/* Number of zero bytes that signify
  1898   1898   				 * end-of-string in this encoding. This number
  1899   1899   				 * is used to determine the source string
  1900   1900   				 * length when the srcLen argument is
  1901   1901   				 * negative. Must be 1 or 2. */
  1902   1902   } Tcl_EncodingType;
................................................................................
  2042   2042   #define TCL_LIMIT_TIME		0x02
  2043   2043   
  2044   2044   /*
  2045   2045    * Structure containing information about a limit handler to be called when a
  2046   2046    * command- or time-limit is exceeded by an interpreter.
  2047   2047    */
  2048   2048   
  2049         -typedef void (Tcl_LimitHandlerProc) (ClientData clientData, Tcl_Interp *interp);
  2050         -typedef void (Tcl_LimitHandlerDeleteProc) (ClientData clientData);
         2049  +typedef void (Tcl_LimitHandlerProc) (void *clientData, Tcl_Interp *interp);
         2050  +typedef void (Tcl_LimitHandlerDeleteProc) (void *clientData);
  2051   2051   
  2052   2052   /*
  2053   2053    *----------------------------------------------------------------------------
  2054   2054    * Override definitions for libtommath.
  2055   2055    */
  2056   2056   
  2057   2057   typedef struct mp_int mp_int;
................................................................................
  2074   2074   				 * argv array. */
  2075   2075       void *srcPtr;		/* Value to be used in setting dst; usage
  2076   2076   				 * depends on type.*/
  2077   2077       void *dstPtr;		/* Address of value to be modified; usage
  2078   2078   				 * depends on type.*/
  2079   2079       const char *helpStr;	/* Documentation message describing this
  2080   2080   				 * option. */
  2081         -    ClientData clientData;	/* Word to pass to function callbacks. */
         2081  +    void *clientData;	/* Word to pass to function callbacks. */
  2082   2082   } Tcl_ArgvInfo;
  2083   2083   
  2084   2084   /*
  2085   2085    * Legal values for the type field of a Tcl_ArgInfo: see the user
  2086   2086    * documentation for details.
  2087   2087    */
  2088   2088   
................................................................................
  2097   2097   #define TCL_ARGV_END		23
  2098   2098   
  2099   2099   /*
  2100   2100    * Types of callback functions for the TCL_ARGV_FUNC and TCL_ARGV_GENFUNC
  2101   2101    * argument types:
  2102   2102    */
  2103   2103   
  2104         -typedef int (Tcl_ArgvFuncProc)(ClientData clientData, Tcl_Obj *objPtr,
         2104  +typedef int (Tcl_ArgvFuncProc)(void *clientData, Tcl_Obj *objPtr,
  2105   2105   	void *dstPtr);
  2106         -typedef int (Tcl_ArgvGenFuncProc)(ClientData clientData, Tcl_Interp *interp,
         2106  +typedef int (Tcl_ArgvGenFuncProc)(void *clientData, Tcl_Interp *interp,
  2107   2107   	int objc, Tcl_Obj *const *objv, void *dstPtr);
  2108   2108   
  2109   2109   /*
  2110   2110    * Shorthand for commonly used argTable entries.
  2111   2111    */
  2112   2112   
  2113   2113   #define TCL_ARGV_AUTO_HELP \
................................................................................
  2172   2172    *----------------------------------------------------------------------------
  2173   2173    * Definitions needed for the Tcl_OpenTcpServerEx function. [TIP #456]
  2174   2174    */
  2175   2175   #define TCL_TCPSERVER_REUSEADDR (1<<0)
  2176   2176   #define TCL_TCPSERVER_REUSEPORT (1<<1)
  2177   2177   
  2178   2178   /*
  2179         - * Constants for special int-typed values, see TIP #494
         2179  + * Constants for special size_t-typed values, see TIP #494
  2180   2180    */
  2181   2181   
  2182         -#define TCL_IO_FAILURE	(-1)
  2183         -#define TCL_AUTO_LENGTH	(-1)
         2182  +#define TCL_IO_FAILURE	((size_t)-1)
         2183  +#define TCL_AUTO_LENGTH	((size_t)-1)
  2184   2184   
  2185   2185   /*
  2186   2186    *----------------------------------------------------------------------------
  2187   2187    * Single public declaration for NRE.
  2188   2188    */
  2189   2189   
  2190         -typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp,
         2190  +typedef int (Tcl_NRPostProc) (void *data[], Tcl_Interp *interp,
  2191   2191   				int result);
  2192   2192   
  2193   2193   /*
  2194   2194    *----------------------------------------------------------------------------
  2195   2195    * The following constant is used to test for older versions of Tcl in the
  2196   2196    * stubs tables. If TCL_UTF_MAX>4 use a different value.
  2197   2197    */
  2198   2198   
  2199         -#define TCL_STUB_MAGIC		((int) 0xFCA3BACF + (TCL_UTF_MAX>4))
         2199  +#define TCL_STUB_MAGIC		((int) 0xFCA3BACB + (int) sizeof(void *) + (TCL_UTF_MAX>4))
  2200   2200   
  2201   2201   /*
  2202   2202    * The following function is required to be defined in all stubs aware
  2203   2203    * extensions. The function is actually implemented in the stub library, not
  2204   2204    * the main Tcl library, although there is a trivial implementation in the
  2205   2205    * main library in case an extension is statically linked into an application.
  2206   2206    */
................................................................................
  2274   2274   #   define TCLAPI MODULE_SCOPE
  2275   2275   #endif
  2276   2276   
  2277   2277   #include "tclPlatDecls.h"
  2278   2278   
  2279   2279   /*
  2280   2280    *----------------------------------------------------------------------------
  2281         - * The following declarations either map ckalloc and ckfree to malloc and
  2282         - * free, or they map them to functions with all sorts of debugging hooks
  2283         - * defined in tclCkalloc.c.
         2281  + * The following declarations map ckalloc and ckfree to Tcl_Alloc and
         2282  + * Tcl_Free.
  2284   2283    */
  2285   2284   
  2286         -#ifdef TCL_MEM_DEBUG
         2285  +#define ckalloc Tcl_Alloc
         2286  +#define ckfree Tcl_Free
         2287  +#define ckrealloc Tcl_Realloc
         2288  +#define attemptckalloc Tcl_AttemptAlloc
         2289  +#define attemptckrealloc Tcl_AttemptRealloc
  2287   2290   
  2288         -#   define ckalloc(x) \
  2289         -    ((void *) Tcl_DbCkalloc((unsigned)(x), __FILE__, __LINE__))
  2290         -#   define ckfree(x) \
  2291         -    Tcl_DbCkfree((char *)(x), __FILE__, __LINE__)
  2292         -#   define ckrealloc(x,y) \
  2293         -    ((void *) Tcl_DbCkrealloc((char *)(x), (unsigned)(y), __FILE__, __LINE__))
  2294         -#   define attemptckalloc(x) \
  2295         -    ((void *) Tcl_AttemptDbCkalloc((unsigned)(x), __FILE__, __LINE__))
  2296         -#   define attemptckrealloc(x,y) \
  2297         -    ((void *) Tcl_AttemptDbCkrealloc((char *)(x), (unsigned)(y), __FILE__, __LINE__))
  2298         -
  2299         -#else /* !TCL_MEM_DEBUG */
         2291  +#ifndef TCL_MEM_DEBUG
  2300   2292   
  2301   2293   /*
  2302   2294    * If we are not using the debugging allocator, we should call the Tcl_Alloc,
  2303   2295    * et al. routines in order to guarantee that every module is using the same
  2304   2296    * memory allocator both inside and outside of the Tcl library.
  2305   2297    */
  2306   2298   
  2307         -#   define ckalloc(x) \
  2308         -    ((void *) Tcl_Alloc((unsigned)(x)))
  2309         -#   define ckfree(x) \
  2310         -    Tcl_Free((char *)(x))
  2311         -#   define ckrealloc(x,y) \
  2312         -    ((void *) Tcl_Realloc((char *)(x), (unsigned)(y)))
  2313         -#   define attemptckalloc(x) \
  2314         -    ((void *) Tcl_AttemptAlloc((unsigned)(x)))
  2315         -#   define attemptckrealloc(x,y) \
  2316         -    ((void *) Tcl_AttemptRealloc((char *)(x), (unsigned)(y)))
  2317   2299   #   undef  Tcl_InitMemory
  2318   2300   #   define Tcl_InitMemory(x)
  2319   2301   #   undef  Tcl_DumpActiveMemory
  2320   2302   #   define Tcl_DumpActiveMemory(x)
  2321   2303   #   undef  Tcl_ValidateAllMemory
  2322   2304   #   define Tcl_ValidateAllMemory(x,y)
  2323   2305   
................................................................................
  2383   2365   
  2384   2366   /*
  2385   2367    *----------------------------------------------------------------------------
  2386   2368    * Macros for clients to use to access fields of hash entries:
  2387   2369    */
  2388   2370   
  2389   2371   #define Tcl_GetHashValue(h) ((h)->clientData)
  2390         -#define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData) (value))
         2372  +#define Tcl_SetHashValue(h, value) ((h)->clientData = (void *) (value))
  2391   2373   #define Tcl_GetHashKey(tablePtr, h) \
  2392   2374   	((void *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS || \
  2393   2375   		    (tablePtr)->keyType == TCL_CUSTOM_PTR_KEYS) \
  2394   2376   		   ? (h)->key.oneWordValue \
  2395   2377   		   : (h)->key.string))
  2396   2378   
  2397   2379   /*

Changes to generic/tclAlloc.c.

   245    245    *
   246    246    * Side effects:
   247    247    *	None.
   248    248    *
   249    249    *----------------------------------------------------------------------
   250    250    */
   251    251   
   252         -char *
          252  +void *
   253    253   TclpAlloc(
   254         -    unsigned int numBytes)	/* Number of bytes to allocate. */
          254  +    size_t numBytes)	/* Number of bytes to allocate. */
   255    255   {
   256    256       register union overhead *overPtr;
   257    257       register size_t bucket;
   258    258       register unsigned amount;
   259    259       struct block *bigBlockPtr = NULL;
   260    260   
   261    261       if (!allocInit) {
................................................................................
   271    271       /*
   272    272        * First the simple case: we simple allocate big blocks directly.
   273    273        */
   274    274   
   275    275       if (numBytes >= MAXMALLOC - OVERHEAD) {
   276    276   	if (numBytes <= UINT_MAX - OVERHEAD -sizeof(struct block)) {
   277    277   	    bigBlockPtr = (struct block *) TclpSysAlloc((unsigned)
   278         -		    (sizeof(struct block) + OVERHEAD + numBytes), 0);
          278  +		    (sizeof(struct block) + OVERHEAD + numBytes));
   279    279   	}
   280    280   	if (bigBlockPtr == NULL) {
   281    281   	    Tcl_MutexUnlock(allocMutexPtr);
   282    282   	    return NULL;
   283    283   	}
   284    284   	bigBlockPtr->nextPtr = bigBlocks.nextPtr;
   285    285   	bigBlocks.nextPtr = bigBlockPtr;
................................................................................
   402    402       ASSERT(size > 0);
   403    403   
   404    404       amount = MAXMALLOC;
   405    405       numBlocks = amount / size;
   406    406       ASSERT(numBlocks*size == amount);
   407    407   
   408    408       blockPtr = (struct block *) TclpSysAlloc(
   409         -	    (sizeof(struct block) + amount), 1);
          409  +	    (sizeof(struct block) + amount));
   410    410       /* no more room! */
   411    411       if (blockPtr == NULL) {
   412    412   	return;
   413    413       }
   414    414       blockPtr->nextPtr = blockList;
   415    415       blockList = blockPtr;
   416    416   
................................................................................
   442    442    *	None.
   443    443    *
   444    444    *----------------------------------------------------------------------
   445    445    */
   446    446   
   447    447   void
   448    448   TclpFree(
   449         -    char *oldPtr)		/* Pointer to memory to free. */
          449  +    void *oldPtr)		/* Pointer to memory to free. */
   450    450   {
   451    451       register size_t size;
   452    452       register union overhead *overPtr;
   453    453       struct block *bigBlockPtr;
   454    454   
   455    455       if (oldPtr == NULL) {
   456    456   	return;
................................................................................
   505    505    *
   506    506    * Side effects:
   507    507    *	None.
   508    508    *
   509    509    *----------------------------------------------------------------------
   510    510    */
   511    511   
   512         -char *
          512  +void *
   513    513   TclpRealloc(
   514         -    char *oldPtr,		/* Pointer to alloced block. */
   515         -    unsigned int numBytes)	/* New size of memory. */
          514  +    void *oldPtr,		/* Pointer to alloced block. */
          515  +    size_t numBytes)	/* New size of memory. */
   516    516   {
   517    517       int i;
   518    518       union overhead *overPtr;
   519    519       struct block *bigBlockPtr;
   520    520       int expensive;
   521    521       size_t maxSize;
   522    522   
................................................................................
   688    688    *
   689    689    * Side effects:
   690    690    *	None.
   691    691    *
   692    692    *----------------------------------------------------------------------
   693    693    */
   694    694   
   695         -char *
          695  +#undef TclpAlloc
          696  +void *
   696    697   TclpAlloc(
   697         -    unsigned int numBytes)	/* Number of bytes to allocate. */
          698  +    size_t numBytes)	/* Number of bytes to allocate. */
   698    699   {
   699         -    return (char *) malloc(numBytes);
          700  +    return malloc(numBytes);
   700    701   }
   701    702   
   702    703   /*
   703    704    *----------------------------------------------------------------------
   704    705    *
   705    706    * TclpFree --
   706    707    *
................................................................................
   711    712    *
   712    713    * Side effects:
   713    714    *	None.
   714    715    *
   715    716    *----------------------------------------------------------------------
   716    717    */
   717    718   
          719  +#undef TclpFree
   718    720   void
   719    721   TclpFree(
   720         -    char *oldPtr)		/* Pointer to memory to free. */
          722  +    void *oldPtr)		/* Pointer to memory to free. */
   721    723   {
   722    724       free(oldPtr);
   723    725       return;
   724    726   }
   725    727   
   726    728   /*
   727    729    *----------------------------------------------------------------------
................................................................................
   735    737    *
   736    738    * Side effects:
   737    739    *	None.
   738    740    *
   739    741    *----------------------------------------------------------------------
   740    742    */
   741    743   
   742         -char *
          744  +void *
   743    745   TclpRealloc(
   744         -    char *oldPtr,		/* Pointer to alloced block. */
   745         -    unsigned int numBytes)	/* New size of memory. */
          746  +    void *oldPtr,		/* Pointer to alloced block. */
          747  +    size_t numBytes)	/* New size of memory. */
   746    748   {
   747         -    return (char *) realloc(oldPtr, numBytes);
          749  +    return realloc(oldPtr, numBytes);
   748    750   }
   749    751   
   750    752   #endif /* !USE_TCLALLOC */
   751    753   #endif /* !TCL_THREADS */
   752    754   
   753    755   /*
   754    756    * Local Variables:
   755    757    * mode: c
   756    758    * c-basic-offset: 4
   757    759    * fill-column: 78
   758    760    * End:
   759    761    */

Changes to generic/tclAssembly.c.

   839    839       CompileEnv compEnv;		/* Compilation environment structure */
   840    840       register ByteCode *codePtr = NULL;
   841    841   				/* Bytecode resulting from the assembly */
   842    842       Namespace* namespacePtr;	/* Namespace in which variable and command
   843    843   				 * names in the bytecode resolve */
   844    844       int status;			/* Status return from Tcl_AssembleCode */
   845    845       const char* source;		/* String representation of the source code */
   846         -    int sourceLen;		/* Length of the source code in bytes */
          846  +    size_t sourceLen;		/* Length of the source code in bytes */
   847    847   
   848    848   
   849    849       /*
   850    850        * Get the expression ByteCode from the object. If it exists, make sure it
   851    851        * is valid in the current context.
   852    852        */
   853    853   
................................................................................
   973    973        */
   974    974   
   975    975       if (TCL_ERROR == TclAssembleCode(envPtr, tokenPtr[1].start,
   976    976   	    tokenPtr[1].size, TCL_EVAL_DIRECT)) {
   977    977   
   978    978   	Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
   979    979   		"\n    (\"%.*s\" body, line %d)",
   980         -		parsePtr->tokenPtr->size, parsePtr->tokenPtr->start,
          980  +		(int)parsePtr->tokenPtr->size, parsePtr->tokenPtr->start,
   981    981   		Tcl_GetErrorLine(interp)));
   982    982   	envPtr->numCommands = numCommands;
   983    983   	envPtr->codeNext = envPtr->codeStart + offset;
   984    984   	envPtr->currStackDepth = depth;
   985    985   	TclCompileSyntaxError(interp, envPtr);
   986    986       }
   987    987       return TCL_OK;
................................................................................
  1200   1200        */
  1201   1201   
  1202   1202       for (thisBB = assemEnvPtr->head_bb; thisBB != NULL; thisBB = nextBB) {
  1203   1203   	if (thisBB->jumpTarget != NULL) {
  1204   1204   	    Tcl_DecrRefCount(thisBB->jumpTarget);
  1205   1205   	}
  1206   1206   	if (thisBB->foreignExceptions != NULL) {
  1207         -	    ckfree(thisBB->foreignExceptions);
         1207  +	    Tcl_Free(thisBB->foreignExceptions);
  1208   1208   	}
  1209   1209   	nextBB = thisBB->successor1;
  1210   1210   	if (thisBB->jtPtr != NULL) {
  1211   1211   	    DeleteMirrorJumpTable(thisBB->jtPtr);
  1212   1212   	    thisBB->jtPtr = NULL;
  1213   1213   	}
  1214         -	ckfree(thisBB);
         1214  +	Tcl_Free(thisBB);
  1215   1215       }
  1216   1216   
  1217   1217       /*
  1218   1218        * Dispose what's left.
  1219   1219        */
  1220   1220   
  1221   1221       Tcl_DeleteHashTable(&assemEnvPtr->labelHash);
................................................................................
  1253   1253       Tcl_Obj* instNameObj;	/* Name of the instruction */
  1254   1254       int tblIdx;			/* Index in TalInstructionTable of the
  1255   1255   				 * instruction */
  1256   1256       enum TalInstType instType;	/* Type of the instruction */
  1257   1257       Tcl_Obj* operand1Obj = NULL;
  1258   1258   				/* First operand to the instruction */
  1259   1259       const char* operand1;	/* String rep of the operand */
  1260         -    int operand1Len;		/* String length of the operand */
         1260  +    size_t operand1Len;		/* String length of the operand */
  1261   1261       int opnd;			/* Integer representation of an operand */
  1262   1262       int litIndex;		/* Literal pool index of a constant */
  1263   1263       int localVar;		/* LVT index of a local variable */
  1264   1264       int flags;			/* Flags for a basic block */
  1265   1265       JumptableInfo* jtPtr;	/* Pointer to a jumptable */
  1266   1266       int infoIndex;		/* Index of the jumptable in auxdata */
  1267   1267       int status = TCL_ERROR;	/* Return value from this function */
................................................................................
  1525   1525   	    Tcl_WrongNumArgs(interp, 1, &instNameObj, "table");
  1526   1526   	    goto cleanup;
  1527   1527   	}
  1528   1528   	if (GetNextOperand(assemEnvPtr, &tokenPtr, &operand1Obj) != TCL_OK) {
  1529   1529   	    goto cleanup;
  1530   1530   	}
  1531   1531   
  1532         -	jtPtr = ckalloc(sizeof(JumptableInfo));
         1532  +	jtPtr = Tcl_Alloc(sizeof(JumptableInfo));
  1533   1533   
  1534   1534   	Tcl_InitHashTable(&jtPtr->hashTable, TCL_STRING_KEYS);
  1535   1535   	assemEnvPtr->curr_bb->jumpLine = assemEnvPtr->cmdLine;
  1536   1536   	assemEnvPtr->curr_bb->jumpOffset = envPtr->codeNext-envPtr->codeStart;
  1537   1537   	DEBUG_PRINT("bb %p jumpLine %d jumpOffset %d\n",
  1538   1538   		assemEnvPtr->curr_bb, assemEnvPtr->cmdLine,
  1539   1539   		envPtr->codeNext - envPtr->codeStart);
................................................................................
  1924   1924        */
  1925   1925   
  1926   1926       DEBUG_PRINT("basic block %p has %d exceptions starting at %d\n",
  1927   1927   	    curr_bb, exceptionCount, savedExceptArrayNext);
  1928   1928       curr_bb->foreignExceptionBase = savedExceptArrayNext;
  1929   1929       curr_bb->foreignExceptionCount = exceptionCount;
  1930   1930       curr_bb->foreignExceptions =
  1931         -	    ckalloc(exceptionCount * sizeof(ExceptionRange));
         1931  +	    Tcl_Alloc(exceptionCount * sizeof(ExceptionRange));
  1932   1932       memcpy(curr_bb->foreignExceptions,
  1933   1933   	    envPtr->exceptArrayPtr + savedExceptArrayNext,
  1934   1934   	    exceptionCount * sizeof(ExceptionRange));
  1935   1935       for (i = 0; i < exceptionCount; ++i) {
  1936   1936   	curr_bb->foreignExceptions[i].nestingLevel -= envPtr->exceptDepth;
  1937   1937       }
  1938   1938       envPtr->exceptArrayNext = savedExceptArrayNext;
................................................................................
  1989   1989   	return TCL_ERROR;
  1990   1990       }
  1991   1991   
  1992   1992       /*
  1993   1993        * Allocate the jumptable.
  1994   1994        */
  1995   1995   
  1996         -    jtPtr = ckalloc(sizeof(JumptableInfo));
         1996  +    jtPtr = Tcl_Alloc(sizeof(JumptableInfo));
  1997   1997       jtHashPtr = &jtPtr->hashTable;
  1998   1998       Tcl_InitHashTable(jtHashPtr, TCL_STRING_KEYS);
  1999   1999   
  2000   2000       /*
  2001   2001        * Fill the keys and labels into the table.
  2002   2002        */
  2003   2003   
................................................................................
  2054   2054   	    entry != NULL;
  2055   2055   	    entry = Tcl_NextHashEntry(&search)) {
  2056   2056   	label = Tcl_GetHashValue(entry);
  2057   2057   	Tcl_DecrRefCount(label);
  2058   2058   	Tcl_SetHashValue(entry, NULL);
  2059   2059       }
  2060   2060       Tcl_DeleteHashTable(jtHashPtr);
  2061         -    ckfree(jtPtr);
         2061  +    Tcl_Free(jtPtr);
  2062   2062   }
  2063   2063   
  2064   2064   /*
  2065   2065    *-----------------------------------------------------------------------------
  2066   2066    *
  2067   2067    * GetNextOperand --
  2068   2068    *
................................................................................
  2297   2297       Tcl_Interp* interp = (Tcl_Interp*) envPtr->iPtr;
  2298   2298   				/* Tcl interpreter */
  2299   2299       Tcl_Token* tokenPtr = *tokenPtrPtr;
  2300   2300   				/* INOUT: Pointer to the next token in the
  2301   2301   				 * source code. */
  2302   2302       Tcl_Obj* varNameObj;	/* Name of the variable */
  2303   2303       const char* varNameStr;
  2304         -    int varNameLen;
         2304  +    size_t varNameLen;
  2305   2305       int localVar;		/* Index of the variable in the LVT */
  2306   2306   
  2307   2307       if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &varNameObj) != TCL_OK) {
  2308   2308   	return -1;
  2309   2309       }
  2310   2310       varNameStr = TclGetStringFromObj(varNameObj, &varNameLen);
  2311   2311       if (CheckNamespaceQualifiers(interp, varNameStr, varNameLen)) {
................................................................................
  2637   2637    */
  2638   2638   
  2639   2639   static BasicBlock *
  2640   2640   AllocBB(
  2641   2641       AssemblyEnv* assemEnvPtr)	/* Assembly environment */
  2642   2642   {
  2643   2643       CompileEnv* envPtr = assemEnvPtr->envPtr;
  2644         -    BasicBlock *bb = ckalloc(sizeof(BasicBlock));
         2644  +    BasicBlock *bb = Tcl_Alloc(sizeof(BasicBlock));
  2645   2645   
  2646   2646       bb->originalStartOffset =
  2647   2647   	    bb->startOffset = envPtr->codeNext - envPtr->codeStart;
  2648   2648       bb->startLine = assemEnvPtr->cmdLine + 1;
  2649   2649       bb->jumpOffset = -1;
  2650   2650       bb->jumpLine = -1;
  2651   2651       bb->prevPtr = assemEnvPtr->curr_bb;
................................................................................
  3915   3915   	}
  3916   3916       }
  3917   3917   
  3918   3918       /*
  3919   3919        * Allocate memory for a stack of active catches.
  3920   3920        */
  3921   3921   
  3922         -    catches = ckalloc(maxCatchDepth * sizeof(BasicBlock*));
  3923         -    catchIndices = ckalloc(maxCatchDepth * sizeof(int));
         3922  +    catches = Tcl_Alloc(maxCatchDepth * sizeof(BasicBlock*));
         3923  +    catchIndices = Tcl_Alloc(maxCatchDepth * sizeof(int));
  3924   3924       for (i = 0; i < maxCatchDepth; ++i) {
  3925   3925   	catches[i] = NULL;
  3926   3926   	catchIndices[i] = -1;
  3927   3927       }
  3928   3928   
  3929   3929       /*
  3930   3930        * Walk through the basic blocks and manage exception ranges.
................................................................................
  3955   3955       if (catchDepth != 0) {
  3956   3956   	Tcl_Panic("unclosed catch at end of code in "
  3957   3957   		"tclAssembly.c:BuildExceptionRanges, can't happen");
  3958   3958       }
  3959   3959   
  3960   3960       /* Free temp storage */
  3961   3961   
  3962         -    ckfree(catchIndices);
  3963         -    ckfree(catches);
         3962  +    Tcl_Free(catchIndices);
         3963  +    Tcl_Free(catches);
  3964   3964   
  3965   3965       return TCL_OK;
  3966   3966   }
  3967   3967   
  3968   3968   /*
  3969   3969    *-----------------------------------------------------------------------------
  3970   3970    *

Changes to generic/tclAsync.c.

   114    114       Tcl_AsyncProc *proc,	/* Procedure to call when handler is
   115    115   				 * invoked. */
   116    116       ClientData clientData)	/* Argument to pass to handler. */
   117    117   {
   118    118       AsyncHandler *asyncPtr;
   119    119       ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
   120    120   
   121         -    asyncPtr = ckalloc(sizeof(AsyncHandler));
          121  +    asyncPtr = Tcl_Alloc(sizeof(AsyncHandler));
   122    122       asyncPtr->ready = 0;
   123    123       asyncPtr->nextPtr = NULL;
   124    124       asyncPtr->proc = proc;
   125    125       asyncPtr->clientData = clientData;
   126    126       asyncPtr->originTsd = tsdPtr;
   127    127       asyncPtr->originThrdId = Tcl_GetCurrentThread();
   128    128   
................................................................................
   306    306   	    prevPtr->nextPtr = asyncPtr->nextPtr;
   307    307   	}
   308    308   	if (asyncPtr == tsdPtr->lastHandler) {
   309    309   	    tsdPtr->lastHandler = prevPtr;
   310    310   	}
   311    311       }
   312    312       Tcl_MutexUnlock(&tsdPtr->asyncMutex);
   313         -    ckfree(asyncPtr);
          313  +    Tcl_Free(asyncPtr);
   314    314   }
   315    315   
   316    316   /*
   317    317    *----------------------------------------------------------------------
   318    318    *
   319    319    * Tcl_AsyncReady --
   320    320    *

Changes to generic/tclBasic.c.

    49     49   
    50     50   typedef struct {
    51     51       Tcl_Interp *interp;		/* Interp this struct belongs to. */
    52     52       Tcl_AsyncHandler async;	/* Async handler token for script
    53     53   				 * cancellation. */
    54     54       char *result;		/* The script cancellation result or NULL for
    55     55   				 * a default result. */
    56         -    int length;			/* Length of the above error message. */
           56  +    size_t length;		/* Length of the above error message. */
    57     57       ClientData clientData;	/* Ignored */
    58     58       int flags;			/* Additional flags */
    59     59   } CancelInfo;
    60     60   static Tcl_HashTable cancelTable;
    61     61   static int cancelTableInitialized = 0;	/* 0 means not yet initialized. */
    62     62   TCL_DECLARE_MUTEX(cancelLock);
    63     63   
................................................................................
   522    522   
   523    523       /*
   524    524        * Initialize support for namespaces and create the global namespace
   525    525        * (whose name is ""; an alias is "::"). This also initializes the Tcl
   526    526        * object type table and other object management code.
   527    527        */
   528    528   
   529         -    iPtr = ckalloc(sizeof(Interp));
          529  +    iPtr = Tcl_Alloc(sizeof(Interp));
   530    530       interp = (Tcl_Interp *) iPtr;
   531    531   
   532    532       iPtr->legacyResult = NULL;
   533    533       /* Special invalid value: Any attempt to free the legacy result
   534    534        * will cause a crash. */
   535    535       iPtr->legacyFreeProc = (void (*) (void))-1;
   536    536       iPtr->errorLine = 0;
................................................................................
   551    551   
   552    552       /*
   553    553        * TIP #280 - Initialize the arrays used to extend the ByteCode and Proc
   554    554        * structures.
   555    555        */
   556    556   
   557    557       iPtr->cmdFramePtr = NULL;
   558         -    iPtr->linePBodyPtr = ckalloc(sizeof(Tcl_HashTable));
   559         -    iPtr->lineBCPtr = ckalloc(sizeof(Tcl_HashTable));
   560         -    iPtr->lineLAPtr = ckalloc(sizeof(Tcl_HashTable));
   561         -    iPtr->lineLABCPtr = ckalloc(sizeof(Tcl_HashTable));
          558  +    iPtr->linePBodyPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
          559  +    iPtr->lineBCPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
          560  +    iPtr->lineLAPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
          561  +    iPtr->lineLABCPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
   562    562       Tcl_InitHashTable(iPtr->linePBodyPtr, TCL_ONE_WORD_KEYS);
   563    563       Tcl_InitHashTable(iPtr->lineBCPtr, TCL_ONE_WORD_KEYS);
   564    564       Tcl_InitHashTable(iPtr->lineLAPtr, TCL_ONE_WORD_KEYS);
   565    565       Tcl_InitHashTable(iPtr->lineLABCPtr, TCL_ONE_WORD_KEYS);
   566    566       iPtr->scriptCLLocPtr = NULL;
   567    567   
   568    568       iPtr->activeVarTracePtr = NULL;
................................................................................
   648    648   
   649    649       /*
   650    650        * Initialise the rootCallframe. It cannot be allocated on the stack, as
   651    651        * it has to be in place before TclCreateExecEnv tries to use a variable.
   652    652        */
   653    653   
   654    654       /* This is needed to satisfy GCC 3.3's strict aliasing rules */
   655         -    framePtr = ckalloc(sizeof(CallFrame));
          655  +    framePtr = Tcl_Alloc(sizeof(CallFrame));
   656    656       (void) Tcl_PushCallFrame(interp, (Tcl_CallFrame *) framePtr,
   657    657   	    (Tcl_Namespace *) iPtr->globalNsPtr, /*isProcCallFrame*/ 0);
   658    658       framePtr->objc = 0;
   659    659   
   660    660       iPtr->framePtr = framePtr;
   661    661       iPtr->varFramePtr = framePtr;
   662    662       iPtr->rootFramePtr = framePtr;
................................................................................
   678    678   
   679    679       /*
   680    680        * TIP #285, Script cancellation support.
   681    681        */
   682    682   
   683    683       iPtr->asyncCancelMsg = Tcl_NewObj();
   684    684   
   685         -    cancelInfo = ckalloc(sizeof(CancelInfo));
          685  +    cancelInfo = Tcl_Alloc(sizeof(CancelInfo));
   686    686       cancelInfo->interp = interp;
   687    687   
   688    688       iPtr->asyncCancel = Tcl_AsyncCreate(CancelEvalProc, cancelInfo);
   689    689       cancelInfo->async = iPtr->asyncCancel;
   690    690       cancelInfo->result = NULL;
   691    691       cancelInfo->length = 0;
   692    692   
................................................................................
   771    771   		&& (cmdInfoPtr->nreProc == NULL)) {
   772    772   	    Tcl_Panic("builtin command with NULL object command proc and a NULL compile proc");
   773    773   	}
   774    774   
   775    775   	hPtr = Tcl_CreateHashEntry(&iPtr->globalNsPtr->cmdTable,
   776    776   		cmdInfoPtr->name, &isNew);
   777    777   	if (isNew) {
   778         -	    cmdPtr = ckalloc(sizeof(Command));
          778  +	    cmdPtr = Tcl_Alloc(sizeof(Command));
   779    779   	    cmdPtr->hPtr = hPtr;
   780    780   	    cmdPtr->nsPtr = iPtr->globalNsPtr;
   781    781   	    cmdPtr->refCount = 1;
   782    782   	    cmdPtr->cmdEpoch = 0;
   783    783   	    cmdPtr->compileProc = cmdInfoPtr->compileProc;
   784    784   	    cmdPtr->proc = TclInvokeObjectCommand;
   785    785   	    cmdPtr->clientData = cmdPtr;
................................................................................
   891    891       if (mathopNSPtr == NULL) {
   892    892   	Tcl_Panic("can't create math operator namespace");
   893    893       }
   894    894       Tcl_Export(interp, mathopNSPtr, "*", 1);
   895    895   #define MATH_OP_PREFIX_LEN 15 /* == strlen("::tcl::mathop::") */
   896    896       memcpy(mathFuncName, "::tcl::mathop::", MATH_OP_PREFIX_LEN);
   897    897       for (opcmdInfoPtr=mathOpCmds ; opcmdInfoPtr->name!=NULL ; opcmdInfoPtr++){
   898         -	TclOpCmdClientData *occdPtr = ckalloc(sizeof(TclOpCmdClientData));
          898  +	TclOpCmdClientData *occdPtr = Tcl_Alloc(sizeof(TclOpCmdClientData));
   899    899   
   900    900   	occdPtr->op = opcmdInfoPtr->name;
   901    901   	occdPtr->i.numArgs = opcmdInfoPtr->i.numArgs;
   902    902   	occdPtr->expected = opcmdInfoPtr->expected;
   903    903   	strcpy(mathFuncName + MATH_OP_PREFIX_LEN, opcmdInfoPtr->name);
   904    904   	cmdPtr = (Command *) Tcl_CreateObjCommand(interp, mathFuncName,
   905    905   		opcmdInfoPtr->objProc, occdPtr, DeleteOpCmdClientData);
................................................................................
  1001   1001   
  1002   1002   static void
  1003   1003   DeleteOpCmdClientData(
  1004   1004       ClientData clientData)
  1005   1005   {
  1006   1006       TclOpCmdClientData *occdPtr = clientData;
  1007   1007   
  1008         -    ckfree(occdPtr);
         1008  +    Tcl_Free(occdPtr);
  1009   1009   }
  1010   1010   
  1011   1011   /*
  1012   1012    * ---------------------------------------------------------------------
  1013   1013    *
  1014   1014    * TclRegisterCommandTypeName, TclGetCommandTypeName --
  1015   1015    *
................................................................................
  1138   1138   {
  1139   1139       Interp *iPtr = (Interp *) interp;
  1140   1140       static Tcl_ThreadDataKey assocDataCounterKey;
  1141   1141       int *assocDataCounterPtr =
  1142   1142   	    Tcl_GetThreadData(&assocDataCounterKey, sizeof(int));
  1143   1143       int isNew;
  1144   1144       char buffer[32 + TCL_INTEGER_SPACE];
  1145         -    AssocData *dPtr = ckalloc(sizeof(AssocData));
         1145  +    AssocData *dPtr = Tcl_Alloc(sizeof(AssocData));
  1146   1146       Tcl_HashEntry *hPtr;
  1147   1147   
  1148   1148       sprintf(buffer, "Assoc Data Key #%d", *assocDataCounterPtr);
  1149   1149       (*assocDataCounterPtr)++;
  1150   1150   
  1151   1151       if (iPtr->assocData == NULL) {
  1152         -	iPtr->assocData = ckalloc(sizeof(Tcl_HashTable));
         1152  +	iPtr->assocData = Tcl_Alloc(sizeof(Tcl_HashTable));
  1153   1153   	Tcl_InitHashTable(iPtr->assocData, TCL_STRING_KEYS);
  1154   1154       }
  1155   1155       hPtr = Tcl_CreateHashEntry(iPtr->assocData, buffer, &isNew);
  1156   1156       dPtr->proc = proc;
  1157   1157       dPtr->clientData = clientData;
  1158   1158       Tcl_SetHashValue(hPtr, dPtr);
  1159   1159   }
................................................................................
  1194   1194       if (hTablePtr == NULL) {
  1195   1195   	return;
  1196   1196       }
  1197   1197       for (hPtr = Tcl_FirstHashEntry(hTablePtr, &hSearch); hPtr != NULL;
  1198   1198   	    hPtr = Tcl_NextHashEntry(&hSearch)) {
  1199   1199   	dPtr = Tcl_GetHashValue(hPtr);
  1200   1200   	if ((dPtr->proc == proc) && (dPtr->clientData == clientData)) {
  1201         -	    ckfree(dPtr);
         1201  +	    Tcl_Free(dPtr);
  1202   1202   	    Tcl_DeleteHashEntry(hPtr);
  1203   1203   	    return;
  1204   1204   	}
  1205   1205       }
  1206   1206   }
  1207   1207   
  1208   1208   /*
................................................................................
  1234   1234   {
  1235   1235       Interp *iPtr = (Interp *) interp;
  1236   1236       AssocData *dPtr;
  1237   1237       Tcl_HashEntry *hPtr;
  1238   1238       int isNew;
  1239   1239   
  1240   1240       if (iPtr->assocData == NULL) {
  1241         -	iPtr->assocData = ckalloc(sizeof(Tcl_HashTable));
         1241  +	iPtr->assocData = Tcl_Alloc(sizeof(Tcl_HashTable));
  1242   1242   	Tcl_InitHashTable(iPtr->assocData, TCL_STRING_KEYS);
  1243   1243       }
  1244   1244       hPtr = Tcl_CreateHashEntry(iPtr->assocData, name, &isNew);
  1245   1245       if (isNew == 0) {
  1246   1246   	dPtr = Tcl_GetHashValue(hPtr);
  1247   1247       } else {
  1248         -	dPtr = ckalloc(sizeof(AssocData));
         1248  +	dPtr = Tcl_Alloc(sizeof(AssocData));
  1249   1249       }
  1250   1250       dPtr->proc = proc;
  1251   1251       dPtr->clientData = clientData;
  1252   1252   
  1253   1253       Tcl_SetHashValue(hPtr, dPtr);
  1254   1254   }
  1255   1255   
................................................................................
  1286   1286       if (hPtr == NULL) {
  1287   1287   	return;
  1288   1288       }
  1289   1289       dPtr = Tcl_GetHashValue(hPtr);
  1290   1290       if (dPtr->proc != NULL) {
  1291   1291   	dPtr->proc(dPtr->clientData, interp);
  1292   1292       }
  1293         -    ckfree(dPtr);
         1293  +    Tcl_Free(dPtr);
  1294   1294       Tcl_DeleteHashEntry(hPtr);
  1295   1295   }
  1296   1296   
  1297   1297   /*
  1298   1298    *----------------------------------------------------------------------
  1299   1299    *
  1300   1300    * Tcl_GetAssocData --
................................................................................
  1482   1482       Tcl_MutexLock(&cancelLock);
  1483   1483       hPtr = Tcl_FindHashEntry(&cancelTable, (char *) iPtr);
  1484   1484       if (hPtr != NULL) {
  1485   1485   	CancelInfo *cancelInfo = Tcl_GetHashValue(hPtr);
  1486   1486   
  1487   1487   	if (cancelInfo != NULL) {
  1488   1488   	    if (cancelInfo->result != NULL) {
  1489         -		ckfree(cancelInfo->result);
         1489  +		Tcl_Free(cancelInfo->result);
  1490   1490   	    }
  1491         -	    ckfree(cancelInfo);
         1491  +	    Tcl_Free(cancelInfo);
  1492   1492   	}
  1493   1493   
  1494   1494   	Tcl_DeleteHashEntry(hPtr);
  1495   1495       }
  1496   1496   
  1497   1497       if (iPtr->asyncCancel != NULL) {
  1498   1498   	Tcl_AsyncDelete(iPtr->asyncCancel);
................................................................................
  1539   1539   	 */
  1540   1540   
  1541   1541   	hPtr = Tcl_FirstHashEntry(hTablePtr, &search);
  1542   1542   	for (; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
  1543   1543   	    Tcl_DeleteCommandFromToken(interp, Tcl_GetHashValue(hPtr));
  1544   1544   	}
  1545   1545   	Tcl_DeleteHashTable(hTablePtr);
  1546         -	ckfree(hTablePtr);
         1546  +	Tcl_Free(hTablePtr);
  1547   1547       }
  1548   1548   
  1549   1549       /*
  1550   1550        * Invoke deletion callbacks; note that a callback can create new
  1551   1551        * callbacks, so we iterate.
  1552   1552        */
  1553   1553   
................................................................................
  1560   1560   		hPtr != NULL;
  1561   1561   		hPtr = Tcl_FirstHashEntry(hTablePtr, &search)) {
  1562   1562   	    dPtr = Tcl_GetHashValue(hPtr);
  1563   1563   	    Tcl_DeleteHashEntry(hPtr);
  1564   1564   	    if (dPtr->proc != NULL) {
  1565   1565   		dPtr->proc(dPtr->clientData, interp);
  1566   1566   	    }
  1567         -	    ckfree(dPtr);
         1567  +	    Tcl_Free(dPtr);
  1568   1568   	}
  1569   1569   	Tcl_DeleteHashTable(hTablePtr);
  1570         -	ckfree(hTablePtr);
         1570  +	Tcl_Free(hTablePtr);
  1571   1571       }
  1572   1572   
  1573   1573       /*
  1574   1574        * Pop the root frame pointer and finish deleting the global
  1575   1575        * namespace. The order is important [Bug 1658572].
  1576   1576        */
  1577   1577   
  1578   1578       if ((iPtr->framePtr != iPtr->rootFramePtr) && !TclInExit()) {
  1579   1579   	Tcl_Panic("DeleteInterpProc: popping rootCallFrame with other frames on top");
  1580   1580       }
  1581   1581       Tcl_PopCallFrame(interp);
  1582         -    ckfree(iPtr->rootFramePtr);
         1582  +    Tcl_Free(iPtr->rootFramePtr);
  1583   1583       iPtr->rootFramePtr = NULL;
  1584   1584       Tcl_DeleteNamespace((Tcl_Namespace *) iPtr->globalNsPtr);
  1585   1585   
  1586   1586       /*
  1587   1587        * Free up the result *after* deleting variables, since variable deletion
  1588   1588        * could have transferred ownership of the result string to Tcl.
  1589   1589        */
................................................................................
  1623   1623       }
  1624   1624       Tcl_DecrRefCount(iPtr->emptyObjPtr);
  1625   1625       iPtr->emptyObjPtr = NULL;
  1626   1626   
  1627   1627       resPtr = iPtr->resolverPtr;
  1628   1628       while (resPtr) {
  1629   1629   	nextResPtr = resPtr->nextPtr;
  1630         -	ckfree(resPtr->name);
  1631         -	ckfree(resPtr);
         1630  +	Tcl_Free(resPtr->name);
         1631  +	Tcl_Free(resPtr);
  1632   1632   	resPtr = nextResPtr;
  1633   1633       }
  1634   1634   
  1635   1635       /*
  1636   1636        * Free up literal objects created for scripts compiled by the
  1637   1637        * interpreter.
  1638   1638        */
................................................................................
  1651   1651   	Proc *procPtr = (Proc *) Tcl_GetHashKey(iPtr->linePBodyPtr, hPtr);
  1652   1652   
  1653   1653   	procPtr->iPtr = NULL;
  1654   1654   	if (cfPtr) {
  1655   1655   	    if (cfPtr->type == TCL_LOCATION_SOURCE) {
  1656   1656   		Tcl_DecrRefCount(cfPtr->data.eval.path);
  1657   1657   	    }
  1658         -	    ckfree(cfPtr->line);
  1659         -	    ckfree(cfPtr);
         1658  +	    Tcl_Free(cfPtr->line);
         1659  +	    Tcl_Free(cfPtr);
  1660   1660   	}
  1661   1661   	Tcl_DeleteHashEntry(hPtr);
  1662   1662       }
  1663   1663       Tcl_DeleteHashTable(iPtr->linePBodyPtr);
  1664         -    ckfree(iPtr->linePBodyPtr);
         1664  +    Tcl_Free(iPtr->linePBodyPtr);
  1665   1665       iPtr->linePBodyPtr = NULL;
  1666   1666   
  1667   1667       /*
  1668   1668        * See also tclCompile.c, TclCleanupByteCode
  1669   1669        */
  1670   1670   
  1671   1671       for (hPtr = Tcl_FirstHashEntry(iPtr->lineBCPtr, &search);
................................................................................
  1673   1673   	    hPtr = Tcl_NextHashEntry(&search)) {
  1674   1674   	ExtCmdLoc *eclPtr = Tcl_GetHashValue(hPtr);
  1675   1675   
  1676   1676   	if (eclPtr->type == TCL_LOCATION_SOURCE) {
  1677   1677   	    Tcl_DecrRefCount(eclPtr->path);
  1678   1678   	}
  1679   1679   	for (i=0; i< eclPtr->nuloc; i++) {
  1680         -	    ckfree(eclPtr->loc[i].line);
         1680  +	    Tcl_Free(eclPtr->loc[i].line);
  1681   1681   	}
  1682   1682   
  1683   1683   	if (eclPtr->loc != NULL) {
  1684         -	    ckfree(eclPtr->loc);
         1684  +	    Tcl_Free(eclPtr->loc);
  1685   1685   	}
  1686   1686   
  1687         -	ckfree(eclPtr);
         1687  +	Tcl_Free(eclPtr);
  1688   1688   	Tcl_DeleteHashEntry(hPtr);
  1689   1689       }
  1690   1690       Tcl_DeleteHashTable(iPtr->lineBCPtr);
  1691         -    ckfree(iPtr->lineBCPtr);
         1691  +    Tcl_Free(iPtr->lineBCPtr);
  1692   1692       iPtr->lineBCPtr = NULL;
  1693   1693   
  1694   1694       /*
  1695   1695        * Location stack for uplevel/eval/... scripts which were passed through
  1696   1696        * proc arguments. Actually we track all arguments as we do not and cannot
  1697   1697        * know which arguments will be used as scripts and which will not.
  1698   1698        */
................................................................................
  1703   1703   	 * are no arguments, so this table has to be empty.
  1704   1704   	 */
  1705   1705   
  1706   1706   	Tcl_Panic("Argument location tracking table not empty");
  1707   1707       }
  1708   1708   
  1709   1709       Tcl_DeleteHashTable(iPtr->lineLAPtr);
  1710         -    ckfree(iPtr->lineLAPtr);
         1710  +    Tcl_Free(iPtr->lineLAPtr);
  1711   1711       iPtr->lineLAPtr = NULL;
  1712   1712   
  1713   1713       if (iPtr->lineLABCPtr->numEntries && !TclInExit()) {
  1714   1714   	/*
  1715   1715   	 * When the interp goes away we have nothing on the stack, so there
  1716   1716   	 * are no arguments, so this table has to be empty.
  1717   1717   	 */
  1718   1718   
  1719   1719   	Tcl_Panic("Argument location tracking table not empty");
  1720   1720       }
  1721   1721   
  1722   1722       Tcl_DeleteHashTable(iPtr->lineLABCPtr);
  1723         -    ckfree(iPtr->lineLABCPtr);
         1723  +    Tcl_Free(iPtr->lineLABCPtr);
  1724   1724       iPtr->lineLABCPtr = NULL;
  1725   1725   
  1726   1726       /*
  1727   1727        * Squelch the tables of traces on variables and searches over arrays in
  1728   1728        * the in the interpreter.
  1729   1729        */
  1730   1730   
  1731   1731       Tcl_DeleteHashTable(&iPtr->varTraces);
  1732   1732       Tcl_DeleteHashTable(&iPtr->varSearches);
  1733   1733   
  1734         -    ckfree(iPtr);
         1734  +    Tcl_Free(iPtr);
  1735   1735   }
  1736   1736   
  1737   1737   /*
  1738   1738    *---------------------------------------------------------------------------
  1739   1739    *
  1740   1740    * Tcl_HideCommand --
  1741   1741    *
................................................................................
  1831   1831   
  1832   1832       /*
  1833   1833        * Initialize the hidden command table if necessary.
  1834   1834        */
  1835   1835   
  1836   1836       hiddenCmdTablePtr = iPtr->hiddenCmdTablePtr;
  1837   1837       if (hiddenCmdTablePtr == NULL) {
  1838         -	hiddenCmdTablePtr = ckalloc(sizeof(Tcl_HashTable));
         1838  +	hiddenCmdTablePtr = Tcl_Alloc(sizeof(Tcl_HashTable));
  1839   1839   	Tcl_InitHashTable(hiddenCmdTablePtr, TCL_STRING_KEYS);
  1840   1840   	iPtr->hiddenCmdTablePtr = hiddenCmdTablePtr;
  1841   1841       }
  1842   1842   
  1843   1843       /*
  1844   1844        * It is an error to move an exposed command to a hidden command with
  1845   1845        * hiddenCmdToken if a hidden command with the name hiddenCmdToken already
................................................................................
  2195   2195       if (!isNew) {
  2196   2196   	/*
  2197   2197   	 * If the deletion callback recreated the command, just throw away
  2198   2198   	 * the new command (if we try to delete it again, we could get
  2199   2199   	 * stuck in an infinite loop).
  2200   2200   	 */
  2201   2201   
  2202         -	ckfree(Tcl_GetHashValue(hPtr));
         2202  +	Tcl_Free(Tcl_GetHashValue(hPtr));
  2203   2203       }
  2204   2204   
  2205   2205       if (!deleted) {
  2206   2206   
  2207   2207   	/*
  2208   2208   	 * Command resolvers (per-interp, per-namespace) might have resolved
  2209   2209   	 * to a command for the given namespace scope with this command not
................................................................................
  2221   2221   	 * However, we do not need to recompute this just yet; next time we
  2222   2222   	 * need the info will be soon enough.
  2223   2223   	 */
  2224   2224   
  2225   2225   	TclInvalidateNsCmdLookup(nsPtr);
  2226   2226   	TclInvalidateNsPath(nsPtr);
  2227   2227       }
  2228         -    cmdPtr = ckalloc(sizeof(Command));
         2228  +    cmdPtr = Tcl_Alloc(sizeof(Command));
  2229   2229       Tcl_SetHashValue(hPtr, cmdPtr);
  2230   2230       cmdPtr->hPtr = hPtr;
  2231   2231       cmdPtr->nsPtr = nsPtr;
  2232   2232       cmdPtr->refCount = 1;
  2233   2233       cmdPtr->cmdEpoch = 0;
  2234   2234       cmdPtr->compileProc = NULL;
  2235   2235       cmdPtr->objProc = TclInvokeStringCommand;
................................................................................
  2441   2441       if (!isNew) {
  2442   2442   	/*
  2443   2443   	 * If the deletion callback recreated the command, just throw away the
  2444   2444   	 * new command (if we try to delete it again, we could get stuck in an
  2445   2445   	 * infinite loop).
  2446   2446   	 */
  2447   2447   
  2448         -	ckfree(Tcl_GetHashValue(hPtr));
         2448  +	Tcl_Free(Tcl_GetHashValue(hPtr));
  2449   2449       }
  2450   2450   
  2451   2451       if (!deleted) {
  2452   2452   	/*
  2453   2453   	 * Command resolvers (per-interp, per-namespace) might have resolved
  2454   2454   	 * to a command for the given namespace scope with this command not
  2455   2455   	 * being registered with the namespace's command table. During BC
................................................................................
  2466   2466   	 * However, we do not need to recompute this just yet; next time we
  2467   2467   	 * need the info will be soon enough.
  2468   2468   	 */
  2469   2469   
  2470   2470   	TclInvalidateNsCmdLookup(nsPtr);
  2471   2471   	TclInvalidateNsPath(nsPtr);
  2472   2472       }
  2473         -    cmdPtr = ckalloc(sizeof(Command));
         2473  +    cmdPtr = Tcl_Alloc(sizeof(Command));
  2474   2474       Tcl_SetHashValue(hPtr, cmdPtr);
  2475   2475       cmdPtr->hPtr = hPtr;
  2476   2476       cmdPtr->nsPtr = nsPtr;
  2477   2477       cmdPtr->refCount = 1;
  2478   2478       cmdPtr->cmdEpoch = 0;
  2479   2479       cmdPtr->compileProc = NULL;
  2480   2480       cmdPtr->objProc = proc;
................................................................................
  3221   3221   	 */
  3222   3222   
  3223   3223   	tracePtr = cmdPtr->tracePtr;
  3224   3224   	while (tracePtr != NULL) {
  3225   3225   	    CommandTrace *nextPtr = tracePtr->nextPtr;
  3226   3226   
  3227   3227   	    if (tracePtr->refCount-- <= 1) {
  3228         -		ckfree(tracePtr);
         3228  +		Tcl_Free(tracePtr);
  3229   3229   	    }
  3230   3230   	    tracePtr = nextPtr;
  3231   3231   	}
  3232   3232   	cmdPtr->tracePtr = NULL;
  3233   3233       }
  3234   3234   
  3235   3235       /*
................................................................................
  3260   3260   	 * created when a command was imported into a namespace, this client
  3261   3261   	 * data will be a pointer to a ImportedCmdData structure describing
  3262   3262   	 * the "real" command that this imported command refers to.
  3263   3263   	 *
  3264   3264   	 * If you are getting a crash during the call to deleteProc and
  3265   3265   	 * cmdPtr->deleteProc is a pointer to the function free(), the most
  3266   3266   	 * likely cause is that your extension allocated memory for the
  3267         -	 * clientData argument to Tcl_CreateObjCommand with the ckalloc()
         3267  +	 * clientData argument to Tcl_CreateObjCommand with the Tcl_Alloc()
  3268   3268   	 * macro and you are now trying to deallocate this memory with free()
  3269         -	 * instead of ckfree(). You should pass a pointer to your own method
  3270         -	 * that calls ckfree().
         3269  +	 * instead of Tcl_Free(). You should pass a pointer to your own method
         3270  +	 * that calls Tcl_Free().
  3271   3271   	 */
  3272   3272   
  3273   3273   	cmdPtr->deleteProc(cmdPtr->deleteData);
  3274   3274       }
  3275   3275   
  3276   3276       /*
  3277   3277        * If this command was imported into other namespaces, then imported
................................................................................
  3415   3415   	if (state == NULL) {
  3416   3416   	    state = Tcl_SaveInterpState((Tcl_Interp *) iPtr, TCL_OK);
  3417   3417   	}
  3418   3418   	tracePtr->traceProc(tracePtr->clientData, (Tcl_Interp *) iPtr,
  3419   3419   		oldName, newName, flags);
  3420   3420   	cmdPtr->flags &= ~tracePtr->flags;
  3421   3421   	if (tracePtr->refCount-- <= 1) {
  3422         -	    ckfree(tracePtr);
         3422  +	    Tcl_Free(tracePtr);
  3423   3423   	}
  3424   3424       }
  3425   3425   
  3426   3426       if (state) {
  3427   3427   	Tcl_RestoreInterpState((Tcl_Interp *) iPtr, state);
  3428   3428       }
  3429   3429   
................................................................................
  3547   3547   
  3548   3548   void
  3549   3549   TclCleanupCommand(
  3550   3550       register Command *cmdPtr)	/* Points to the Command structure to
  3551   3551   				 * be freed. */
  3552   3552   {
  3553   3553       if (cmdPtr->refCount-- <= 1) {
  3554         -	ckfree(cmdPtr);
         3554  +	Tcl_Free(cmdPtr);
  3555   3555       }
  3556   3556   }
  3557   3557   
  3558   3558   /*
  3559   3559    *----------------------------------------------------------------------
  3560   3560    *
  3561   3561    * TclInterpReady --
................................................................................
  3726   3726       /*
  3727   3727        * If the TCL_LEAVE_ERR_MSG flags bit is set, place an error in the
  3728   3728        * interp's result; otherwise, we leave it alone.
  3729   3729        */
  3730   3730   
  3731   3731       if (flags & TCL_LEAVE_ERR_MSG) {
  3732   3732           const char *id, *message = NULL;
  3733         -        int length;
         3733  +        size_t length;
  3734   3734   
  3735   3735           /*
  3736   3736            * Setup errorCode variables so that we can differentiate between
  3737   3737            * being canceled and unwound.
  3738   3738            */
  3739   3739   
  3740   3740           if (iPtr->asyncCancelMsg != NULL) {
................................................................................
  3834   3834        * TCL_CANCEL_UNWIND flags bit is set, the script in progress is not
  3835   3835        * allowed to catch the script cancellation because the evaluation stack
  3836   3836        * for the interp is completely unwound.
  3837   3837        */
  3838   3838   
  3839   3839       if (resultObjPtr != NULL) {
  3840   3840   	result = TclGetStringFromObj(resultObjPtr, &cancelInfo->length);
  3841         -	cancelInfo->result = ckrealloc(cancelInfo->result,cancelInfo->length);
         3841  +	cancelInfo->result = Tcl_Realloc(cancelInfo->result,cancelInfo->length);
  3842   3842   	memcpy(cancelInfo->result, result, (size_t) cancelInfo->length);
  3843   3843   	TclDecrRefCount(resultObjPtr);	/* Discard their result object. */
  3844   3844       } else {
  3845   3845   	cancelInfo->result = NULL;
  3846   3846   	cancelInfo->length = 0;
  3847   3847       }
  3848   3848       cancelInfo->clientData = clientData;
................................................................................
  4318   4318       ClientData data[],
  4319   4319       Tcl_Interp *interp,
  4320   4320       int result)
  4321   4321   {
  4322   4322       Interp *iPtr = (Interp *) interp;
  4323   4323       Tcl_Obj *listPtr;
  4324   4324       const char *cmdString;
  4325         -    int cmdLen;
         4325  +    size_t cmdLen;
  4326   4326       int objc = PTR2INT(data[0]);
  4327   4327       Tcl_Obj **objv = data[1];
  4328   4328   
  4329   4329       if ((result == TCL_ERROR) && !(iPtr->flags & ERR_ALREADY_LOGGED)){
  4330   4330   	/*
  4331   4331   	 * If there was an error, a command string will be needed for the
  4332   4332   	 * error log: get it out of the itemPtr. The details depend on the
................................................................................
  4382   4382        * to hold both the handler prefix and all words of the command invokation
  4383   4383        * itself.
  4384   4384        */
  4385   4385   
  4386   4386       Tcl_ListObjGetElements(NULL, currNsPtr->unknownHandlerPtr,
  4387   4387   	    &handlerObjc, &handlerObjv);
  4388   4388       newObjc = objc + handlerObjc;
  4389         -    newObjv = TclStackAlloc(interp, (int) sizeof(Tcl_Obj *) * newObjc);
         4389  +    newObjv = TclStackAlloc(interp, sizeof(Tcl_Obj *) * newObjc);
  4390   4390   
  4391   4391       /*
  4392   4392        * Copy command prefix from unknown handler and add on the real command's
  4393   4393        * full argument list. Note that we only use memcpy() once because we have
  4394   4394        * to increment the reference count of all the handler arguments anyway.
  4395   4395        */
  4396   4396   
................................................................................
  4474   4474       Command **cmdPtrPtr,
  4475   4475       Tcl_Obj *commandPtr,
  4476   4476       int objc,
  4477   4477       Tcl_Obj *const objv[])
  4478   4478   {
  4479   4479       Interp *iPtr = (Interp *) interp;
  4480   4480       Command *cmdPtr = *cmdPtrPtr;
  4481         -    size_t newEpoch, cmdEpoch = cmdPtr->cmdEpoch;
  4482         -    int length, traceCode = TCL_OK;
         4481  +    size_t length, newEpoch, cmdEpoch = cmdPtr->cmdEpoch;
         4482  +    int traceCode = TCL_OK;
  4483   4483       const char *command = TclGetStringFromObj(commandPtr, &length);
  4484   4484   
  4485   4485       /*
  4486   4486        * Call trace functions.
  4487   4487        * Execute any command or execution traces. Note that we bump up the
  4488   4488        * command's reference count for the duration of the calling of the
  4489   4489        * traces so that the structure doesn't go away underneath our feet.
................................................................................
  4527   4527   {
  4528   4528       Interp *iPtr = (Interp *) interp;
  4529   4529       int traceCode = TCL_OK;
  4530   4530       int objc = PTR2INT(data[0]);
  4531   4531       Tcl_Obj *commandPtr = data[1];
  4532   4532       Command *cmdPtr = data[2];
  4533   4533       Tcl_Obj **objv = data[3];
  4534         -    int length;
         4534  +    size_t length;
  4535   4535       const char *command = TclGetStringFromObj(commandPtr, &length);
  4536   4536   
  4537   4537       if (!(cmdPtr->flags & CMD_IS_DELETED)) {
  4538   4538   	if (cmdPtr->flags & CMD_HAS_EXEC_TRACES){
  4539   4539   	    traceCode = TclCheckExecutionTraces(interp, command, length,
  4540   4540   		    cmdPtr, result, TCL_TRACE_LEAVE_EXEC, objc, objv);
  4541   4541   	}
................................................................................
  4610   4610   int
  4611   4611   Tcl_EvalTokensStandard(
  4612   4612       Tcl_Interp *interp,		/* Interpreter in which to lookup variables,
  4613   4613   				 * execute nested commands, and report
  4614   4614   				 * errors. */
  4615   4615       Tcl_Token *tokenPtr,	/* Pointer to first in an array of tokens to
  4616   4616   				 * evaluate and concatenate. */
  4617         -    int count)			/* Number of tokens to consider at tokenPtr.
         4617  +    size_t count)			/* Number of tokens to consider at tokenPtr.
  4618   4618   				 * Must be at least 1. */
  4619   4619   {
  4620   4620       return TclSubstTokens(interp, tokenPtr, count, /* numLeftPtr */ NULL, 1,
  4621   4621   	    NULL, NULL);
  4622   4622   }
  4623   4623   
  4624   4624   /*
................................................................................
  4643   4643    */
  4644   4644   
  4645   4645   int
  4646   4646   Tcl_EvalEx(
  4647   4647       Tcl_Interp *interp,		/* Interpreter in which to evaluate the
  4648   4648   				 * script. Also used for error reporting. */
  4649   4649       const char *script,		/* First character of script to evaluate. */
  4650         -    int numBytes,		/* Number of bytes in script. If < 0, the
         4650  +    size_t numBytes,		/* Number of bytes in script. If -1, the
  4651   4651   				 * script consists of all bytes up to the
  4652   4652   				 * first null character. */
  4653   4653       int flags)			/* Collection of OR-ed bits that control the
  4654   4654   				 * evaluation of the script. Only
  4655   4655   				 * TCL_EVAL_GLOBAL is currently supported. */
  4656   4656   {
  4657   4657       return TclEvalEx(interp, script, numBytes, flags, 1, NULL, script);
................................................................................
  4658   4658   }
  4659   4659   
  4660   4660   int
  4661   4661   TclEvalEx(
  4662   4662       Tcl_Interp *interp,		/* Interpreter in which to evaluate the
  4663   4663   				 * script. Also used for error reporting. */
  4664   4664       const char *script,		/* First character of script to evaluate. */
  4665         -    int numBytes,		/* Number of bytes in script. If < 0, the
         4665  +    size_t numBytes,		/* Number of bytes in script. If -1, the
  4666   4666   				 * script consists of all bytes up to the
  4667   4667   				 * first NUL character. */
  4668   4668       int flags,			/* Collection of OR-ed bits that control the
  4669   4669   				 * evaluation of the script. Only
  4670   4670   				 * TCL_EVAL_GLOBAL is currently supported. */
  4671   4671       int line,			/* The line the script starts on. */
  4672   4672       int *clNextOuter,		/* Information about an outer context for */
................................................................................
  4723   4723   	if (clNextOuter) {
  4724   4724   	    clNext = clNextOuter;
  4725   4725   	} else {
  4726   4726   	    clNext = &iPtr->scriptCLLocPtr->loc[0];
  4727   4727   	}
  4728   4728       }
  4729   4729   
  4730         -    if (numBytes < 0) {
         4730  +    if (numBytes == TCL_AUTO_LENGTH) {
  4731   4731   	numBytes = strlen(script);
  4732   4732       }
  4733   4733       Tcl_ResetResult(interp);
  4734   4734   
  4735   4735       savedVarFramePtr = iPtr->varFramePtr;
  4736   4736       if (flags & TCL_EVAL_GLOBAL) {
  4737   4737   	iPtr->varFramePtr = iPtr->rootFramePtr;
................................................................................
  4840   4840   	    unsigned int numWords = parsePtr->numWords;
  4841   4841   
  4842   4842   	    /*
  4843   4843   	     * Generate an array of objects for the words of the command.
  4844   4844   	     */
  4845   4845   
  4846   4846   	    if (numWords > minObjs) {
  4847         -		expand =    ckalloc(numWords * sizeof(int));
  4848         -		objvSpace = ckalloc(numWords * sizeof(Tcl_Obj *));
  4849         -		lineSpace = ckalloc(numWords * sizeof(int));
         4847  +		expand =    Tcl_Alloc(numWords * sizeof(int));
         4848  +		objvSpace = Tcl_Alloc(numWords * sizeof(Tcl_Obj *));
         4849  +		lineSpace = Tcl_Alloc(numWords * sizeof(int));
  4850   4850   	    }
  4851   4851   	    expandRequested = 0;
  4852   4852   	    objv = objvSpace;
  4853   4853   	    lines = lineSpace;
  4854   4854   
  4855   4855   	    iPtr->cmdFramePtr = eeFramePtr->nextPtr;
  4856   4856   	    for (objectsUsed = 0, tokenPtr = parsePtr->tokenPtr;
................................................................................
  4928   4928   		Tcl_Obj **copy = objvSpace;
  4929   4929   		int *lcopy = lineSpace;
  4930   4930   		int wordIdx = numWords;
  4931   4931   		int objIdx = objectsNeeded - 1;
  4932   4932   
  4933   4933   		if ((numWords > minObjs) || (objectsNeeded > minObjs)) {
  4934   4934   		    objv = objvSpace =
  4935         -			    ckalloc(objectsNeeded * sizeof(Tcl_Obj *));
  4936         -		    lines = lineSpace = ckalloc(objectsNeeded * sizeof(int));
         4935  +			    Tcl_Alloc(objectsNeeded * sizeof(Tcl_Obj *));
         4936  +		    lines = lineSpace = Tcl_Alloc(objectsNeeded * sizeof(int));
  4937   4937   		}
  4938   4938   
  4939   4939   		objectsUsed = 0;
  4940   4940   		while (wordIdx--) {
  4941   4941   		    if (expand[wordIdx]) {
  4942   4942   			int numElements;
  4943   4943   			Tcl_Obj **elements, *temp = copy[wordIdx];
................................................................................
  4956   4956   			objv[objIdx--] = copy[wordIdx];
  4957   4957   			objectsUsed++;
  4958   4958   		    }
  4959   4959   		}
  4960   4960   		objv += objIdx+1;
  4961   4961   
  4962   4962   		if (copy != stackObjArray) {
  4963         -		    ckfree(copy);
         4963  +		    Tcl_Free(copy);
  4964   4964   		}
  4965   4965   		if (lcopy != linesStack) {
  4966         -		    ckfree(lcopy);
         4966  +		    Tcl_Free(lcopy);
  4967   4967   		}
  4968   4968   	    }
  4969   4969   
  4970   4970   	    /*
  4971   4971   	     * Execute the command and free the objects for its words.
  4972   4972   	     *
  4973   4973   	     * TIP #280: Remember the command itself for 'info frame'. We
................................................................................
  5004   5004   		goto error;
  5005   5005   	    }
  5006   5006   	    for (i = 0; i < objectsUsed; i++) {
  5007   5007   		Tcl_DecrRefCount(objv[i]);
  5008   5008   	    }
  5009   5009   	    objectsUsed = 0;
  5010   5010   	    if (objvSpace != stackObjArray) {
  5011         -		ckfree(objvSpace);
         5011  +		Tcl_Free(objvSpace);
  5012   5012   		objvSpace = stackObjArray;
  5013         -		ckfree(lineSpace);
         5013  +		Tcl_Free(lineSpace);
  5014   5014   		lineSpace = linesStack;
  5015   5015   	    }
  5016   5016   
  5017   5017   	    /*
  5018   5018   	     * Free expand separately since objvSpace could have been
  5019   5019   	     * reallocated above.
  5020   5020   	     */
  5021   5021   
  5022   5022   	    if (expand != expandStack) {
  5023         -		ckfree(expand);
         5023  +		Tcl_Free(expand);
  5024   5024   		expand = expandStack;
  5025   5025   	    }
  5026   5026   	}
  5027   5027   
  5028   5028   	/*
  5029   5029   	 * Advance to the next command in the script.
  5030   5030   	 *
................................................................................
  5082   5082       for (i = 0; i < objectsUsed; i++) {
  5083   5083   	Tcl_DecrRefCount(objv[i]);
  5084   5084       }
  5085   5085       if (gotParse) {
  5086   5086   	Tcl_FreeParse(parsePtr);
  5087   5087       }
  5088   5088       if (objvSpace != stackObjArray) {
  5089         -	ckfree(objvSpace);
  5090         -	ckfree(lineSpace);
         5089  +	Tcl_Free(objvSpace);
         5090  +	Tcl_Free(lineSpace);
  5091   5091       }
  5092   5092       if (expand != expandStack) {
  5093         -	ckfree(expand);
         5093  +	Tcl_Free(expand);
  5094   5094       }
  5095   5095       iPtr->varFramePtr = savedVarFramePtr;
  5096   5096   
  5097   5097    cleanup_return:
  5098   5098       /*
  5099   5099        * TIP #280. Release the local CmdFrame, and its contents.
  5100   5100        */
................................................................................
  5250   5250   	hPtr = Tcl_CreateHashEntry(iPtr->lineLAPtr, objv[i], &new);
  5251   5251   	if (new) {
  5252   5252   	    /*
  5253   5253   	     * The word is not on the stack yet, remember the current location
  5254   5254   	     * and initialize references.
  5255   5255   	     */
  5256   5256   
  5257         -	    cfwPtr = ckalloc(sizeof(CFWord));
         5257  +	    cfwPtr = Tcl_Alloc(sizeof(CFWord));
  5258   5258   	    cfwPtr->framePtr = cfPtr;
  5259   5259   	    cfwPtr->word = i;
  5260   5260   	    cfwPtr->refCount = 1;
  5261   5261   	    Tcl_SetHashValue(hPtr, cfwPtr);
  5262   5262   	} else {
  5263   5263   	    /*
  5264   5264   	     * The word is already on the stack, its current location is not
................................................................................
  5310   5310   	}
  5311   5311   	cfwPtr = Tcl_GetHashValue(hPtr);
  5312   5312   
  5313   5313   	if (cfwPtr->refCount-- > 1) {
  5314   5314   	    continue;
  5315   5315   	}
  5316   5316   
  5317         -	ckfree(cfwPtr);
         5317  +	Tcl_Free(cfwPtr);
  5318   5318   	Tcl_DeleteHashEntry(hPtr);
  5319   5319       }
  5320   5320   }
  5321   5321   
  5322   5322   /*
  5323   5323    *----------------------------------------------------------------------
  5324   5324    *
................................................................................
  5343   5343   TclArgumentBCEnter(
  5344   5344       Tcl_Interp *interp,
  5345   5345       Tcl_Obj *objv[],
  5346   5346       int objc,
  5347   5347       void *codePtr,
  5348   5348       CmdFrame *cfPtr,
  5349   5349       int cmd,
  5350         -    int pc)
         5350  +    size_t pc)
  5351   5351   {
  5352   5352       ExtCmdLoc *eclPtr;
  5353   5353       int word;
  5354   5354       ECL *ePtr;
  5355   5355       CFWordBC *lastPtr = NULL;
  5356   5356       Interp *iPtr = (Interp *) interp;
  5357   5357       Tcl_HashEntry *hePtr =
................................................................................
  5392   5392        */
  5393   5393   
  5394   5394       for (word = 1; word < objc; word++) {
  5395   5395   	if (ePtr->line[word] >= 0) {
  5396   5396   	    int isnew;
  5397   5397   	    Tcl_HashEntry *hPtr = Tcl_CreateHashEntry(iPtr->lineLABCPtr,
  5398   5398   		objv[word], &isnew);
  5399         -	    CFWordBC *cfwPtr = ckalloc(sizeof(CFWordBC));
         5399  +	    CFWordBC *cfwPtr = Tcl_Alloc(sizeof(CFWordBC));
  5400   5400   
  5401   5401   	    cfwPtr->framePtr = cfPtr;
  5402   5402   	    cfwPtr->obj = objv[word];
  5403   5403   	    cfwPtr->pc = pc;
  5404   5404   	    cfwPtr->word = word;
  5405   5405   	    cfwPtr->nextPtr = lastPtr;
  5406   5406   	    lastPtr = cfwPtr;
................................................................................
  5470   5470   
  5471   5471   	if (cfwPtr->prevPtr) {
  5472   5472   	    Tcl_SetHashValue(hPtr, cfwPtr->prevPtr);
  5473   5473   	} else {
  5474   5474   	    Tcl_DeleteHashEntry(hPtr);
  5475   5475   	}
  5476   5476   
  5477         -	ckfree(cfwPtr);
         5477  +	Tcl_Free(cfwPtr);
  5478   5478   	cfwPtr = nextPtr;
  5479   5479       }
  5480   5480   
  5481   5481       cfPtr->litarg = NULL;
  5482   5482   }
  5483   5483   
  5484   5484   /*
................................................................................
  5742   5742   	/*
  5743   5743   	 * We're not supposed to use the compiler or byte-code
  5744   5744   	 * interpreter. Let Tcl_EvalEx evaluate the command directly (and
  5745   5745   	 * probably more slowly).
  5746   5746   	 */
  5747   5747   
  5748   5748   	const char *script;
  5749         -	int numSrcBytes;
         5749  +	size_t numSrcBytes;
  5750   5750   
  5751   5751   	/*
  5752   5752   	 * Now we check if we have data about invisible continuation lines for
  5753   5753   	 * the script, and make it available to the direct script parser and
  5754   5754   	 * evaluator we are about to call, if so.
  5755   5755   	 *
  5756   5756   	 * It may be possible that the script Tcl_Obj* can be free'd while the
................................................................................
  5796   5796   
  5797   5797       if (iPtr->numLevels == 0) {
  5798   5798   	if (result == TCL_RETURN) {
  5799   5799   	    result = TclUpdateReturnInfo(iPtr);
  5800   5800   	}
  5801   5801   	if ((result != TCL_OK) && (result != TCL_ERROR) && !allowExceptions) {
  5802   5802   	    const char *script;
  5803         -	    int numSrcBytes;
         5803  +	    size_t numSrcBytes;
  5804   5804   
  5805   5805   	    ProcessUnexpectedResult(interp, result);
  5806   5806   	    result = TCL_ERROR;
  5807   5807   	    script = TclGetStringFromObj(objPtr, &numSrcBytes);
  5808   5808   	    Tcl_LogCommandInfo(interp, script, script, numSrcBytes);
  5809   5809   	}
  5810   5810   
................................................................................
  6326   6326   
  6327   6327   void
  6328   6328   Tcl_AppendObjToErrorInfo(
  6329   6329       Tcl_Interp *interp,		/* Interpreter to which error information
  6330   6330   				 * pertains. */
  6331   6331       Tcl_Obj *objPtr)		/* Message to record. */
  6332   6332   {
  6333         -    const char *message = TclGetString(objPtr);
         6333  +    size_t length;
         6334  +    const char *message = TclGetStringFromObj(objPtr, &length);
  6334   6335       register Interp *iPtr = (Interp *) interp;
  6335   6336   
  6336   6337       Tcl_IncrRefCount(objPtr);
  6337   6338   
  6338   6339       /*
  6339   6340        * If we are just starting to log an error, errorInfo is initialized from
  6340   6341        * the error message in the interpreter's result.
................................................................................
  6349   6350   	}
  6350   6351       }
  6351   6352   
  6352   6353       /*
  6353   6354        * Now append "message" to the end of errorInfo.
  6354   6355        */
  6355   6356   
  6356         -    if (objPtr->length != 0) {
         6357  +    if (length != 0) {
  6357   6358   	if (Tcl_IsShared(iPtr->errorInfo)) {
  6358   6359   	    Tcl_DecrRefCount(iPtr->errorInfo);
  6359   6360   	    iPtr->errorInfo = Tcl_DuplicateObj(iPtr->errorInfo);
  6360   6361   	    Tcl_IncrRefCount(iPtr->errorInfo);
  6361   6362   	}
  6362         -	Tcl_AppendToObj(iPtr->errorInfo, message, objPtr->length);
         6363  +	Tcl_AppendToObj(iPtr->errorInfo, message, length);
  6363   6364       }
  6364   6365       Tcl_DecrRefCount(objPtr);
  6365   6366   }
  6366   6367   
  6367   6368   /*
  6368   6369    *----------------------------------------------------------------------
  6369   6370    *
................................................................................
  6392   6393       Tcl_DString buf;
  6393   6394       char *string;
  6394   6395   
  6395   6396       va_start(argList, interp);
  6396   6397       /*
  6397   6398        * Copy the strings one after the other into a single larger string. Use
  6398   6399        * stack-allocated space for small commands, but if the command gets too
  6399         -     * large than call ckalloc to create the space.
         6400  +     * large than call Tcl_Alloc to create the space.
  6400   6401        */
  6401   6402   
  6402   6403       Tcl_DStringInit(&buf);
  6403   6404       while (1) {
  6404   6405   	string = va_arg(argList, char *);
  6405   6406   	if (string == NULL) {
  6406   6407   	    break;
................................................................................
  8095   8096   	 * The execEnv was wound down but not deleted for our sake. We finish
  8096   8097   	 * the job here. The caller context has already been restored.
  8097   8098   	 */
  8098   8099   
  8099   8100   	NRE_ASSERT(iPtr->varFramePtr == corPtr->caller.varFramePtr);
  8100   8101   	NRE_ASSERT(iPtr->framePtr == corPtr->caller.framePtr);
  8101   8102   	NRE_ASSERT(iPtr->cmdFramePtr == corPtr->caller.cmdFramePtr);
  8102         -	ckfree(corPtr);
         8103  +	Tcl_Free(corPtr);
  8103   8104   	return result;
  8104   8105       }
  8105   8106   
  8106   8107       NRE_ASSERT(COR_IS_SUSPENDED(corPtr));
  8107   8108       SAVE_CONTEXT(corPtr->running);
  8108   8109       RESTORE_CONTEXT(corPtr->caller);
  8109   8110   
................................................................................
  8154   8155       /*
  8155   8156        * #280.
  8156   8157        * Drop the coroutine-owned copy of the lineLABCPtr hashtable for literal
  8157   8158        * command arguments in bytecode.
  8158   8159        */
  8159   8160   
  8160   8161       Tcl_DeleteHashTable(corPtr->lineLABCPtr);
  8161         -    ckfree(corPtr->lineLABCPtr);
         8162  +    Tcl_Free(corPtr->lineLABCPtr);
  8162   8163       corPtr->lineLABCPtr = NULL;
  8163   8164   
  8164   8165       RESTORE_CONTEXT(corPtr->caller);
  8165   8166       iPtr->execEnvPtr = corPtr->callerEEPtr;
  8166   8167       iPtr->numLevels++;
  8167   8168   
  8168   8169       return result;
................................................................................
  8446   8447       }
  8447   8448   
  8448   8449       /*
  8449   8450        * We ARE creating the coroutine command: allocate the corresponding
  8450   8451        * struct and create the corresponding command.
  8451   8452        */
  8452   8453   
  8453         -    corPtr = ckalloc(sizeof(CoroutineData));
         8454  +    corPtr = Tcl_Alloc(sizeof(CoroutineData));
  8454   8455   
  8455   8456       cmdPtr = (Command *) TclNRCreateCommandInNs(interp, simpleName,
  8456   8457   	    (Tcl_Namespace *)nsPtr, /*objProc*/ NULL, TclNRInterpCoroutine,
  8457   8458   	    corPtr, DeleteCoroutine);
  8458   8459   
  8459   8460       corPtr->cmdPtr = cmdPtr;
  8460   8461       cmdPtr->refCount++;
................................................................................
  8468   8469        * tree. Like the chain -> tree conversion of the CmdFrame stack.
  8469   8470        */
  8470   8471   
  8471   8472       {
  8472   8473   	Tcl_HashSearch hSearch;
  8473   8474   	Tcl_HashEntry *hePtr;
  8474   8475   
  8475         -	corPtr->lineLABCPtr = ckalloc(sizeof(Tcl_HashTable));
         8476  +	corPtr->lineLABCPtr = Tcl_Alloc(sizeof(Tcl_HashTable));
  8476   8477   	Tcl_InitHashTable(corPtr->lineLABCPtr, TCL_ONE_WORD_KEYS);
  8477   8478   
  8478   8479   	for (hePtr = Tcl_FirstHashEntry(iPtr->lineLABCPtr,&hSearch);
  8479   8480   		hePtr; hePtr = Tcl_NextHashEntry(&hSearch)) {
  8480   8481   	    int isNew;
  8481   8482   	    Tcl_HashEntry *newPtr =
  8482   8483   		    Tcl_CreateHashEntry(corPtr->lineLABCPtr,

Changes to generic/tclBinary.c.

   264    264    * The following structure is the internal rep for a ByteArray object. Keeps
   265    265    * track of how much memory has been used and how much has been allocated for
   266    266    * the byte array to enable growing and shrinking of the ByteArray object with
   267    267    * fewer mallocs.
   268    268    */
   269    269   
   270    270   typedef struct {
   271         -    int used;			/* The number of bytes used in the byte
          271  +    size_t used;		/* The number of bytes used in the byte
   272    272   				 * array. */
   273         -    int allocated;		/* The amount of space actually allocated
          273  +    size_t allocated;		/* The amount of space actually allocated
   274    274   				 * minus 1 byte. */
   275    275       unsigned char bytes[1];	/* The array of bytes. The actual size of this
   276    276   				 * field depends on the 'allocated' field
   277    277   				 * above. */
   278    278   } ByteArray;
   279    279   
   280    280   #define BYTEARRAY_SIZE(len) \
   281         -		((unsigned) (TclOffset(ByteArray, bytes) + (len)))
          281  +		((TclOffset(ByteArray, bytes) + (len)))
   282    282   #define GET_BYTEARRAY(objPtr) \
   283    283   		((ByteArray *) (objPtr)->internalRep.twoPtrValue.ptr1)
   284    284   #define SET_BYTEARRAY(objPtr, baPtr) \
   285    285   		(objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (baPtr)
   286    286   
   287    287   int
   288    288   TclIsPureByteArray(
................................................................................
   311    311   
   312    312   #undef Tcl_NewByteArrayObj
   313    313   
   314    314   Tcl_Obj *
   315    315   Tcl_NewByteArrayObj(
   316    316       const unsigned char *bytes,	/* The array of bytes used to initialize the
   317    317   				 * new object. */
   318         -    int length)			/* Length of the array of bytes, which must be
   319         -				 * >= 0. */
          318  +    size_t length)		/* Length of the array of bytes */
   320    319   {
   321    320   #ifdef TCL_MEM_DEBUG
   322    321       return Tcl_DbNewByteArrayObj(bytes, length, "unknown", 0);
   323    322   #else /* if not TCL_MEM_DEBUG */
   324    323       Tcl_Obj *objPtr;
   325    324   
   326    325       TclNewObj(objPtr);
................................................................................
   354    353    *----------------------------------------------------------------------
   355    354    */
   356    355   
   357    356   Tcl_Obj *
   358    357   Tcl_DbNewByteArrayObj(
   359    358       const unsigned char *bytes,	/* The array of bytes used to initialize the
   360    359   				 * new object. */
   361         -    int length,			/* Length of the array of bytes, which must be
   362         -				 * >= 0. */
          360  +    size_t length,		/* Length of the array of bytes. */
   363    361       const char *file,		/* The name of the source file calling this
   364    362   				 * procedure; used for debugging. */
   365    363       int line)			/* Line number in the source file; used for
   366    364   				 * debugging. */
   367    365   {
   368    366   #ifdef TCL_MEM_DEBUG
   369    367       Tcl_Obj *objPtr;
................................................................................
   395    393    */
   396    394   
   397    395   void
   398    396   Tcl_SetByteArrayObj(
   399    397       Tcl_Obj *objPtr,		/* Object to initialize as a ByteArray. */
   400    398       const unsigned char *bytes,	/* The array of bytes to use as the new
   401    399   				   value. May be NULL even if length > 0. */
   402         -    int length)			/* Length of the array of bytes, which must
          400  +    size_t length)			/* Length of the array of bytes, which must
   403    401   				   be >= 0. */
   404    402   {
   405    403       ByteArray *byteArrayPtr;
   406    404   
   407    405       if (Tcl_IsShared(objPtr)) {
   408    406   	Tcl_Panic("%s called with shared object", "Tcl_SetByteArrayObj");
   409    407       }
   410    408       TclFreeIntRep(objPtr);
   411    409       TclInvalidateStringRep(objPtr);
   412    410   
   413         -    if (length < 0) {
   414         -	length = 0;
   415         -    }
   416         -    byteArrayPtr = ckalloc(BYTEARRAY_SIZE(length));
          411  +    byteArrayPtr = Tcl_Alloc(BYTEARRAY_SIZE(length));
   417    412       byteArrayPtr->used = length;
   418    413       byteArrayPtr->allocated = length;
   419    414   
   420    415       if ((bytes != NULL) && (length > 0)) {
   421         -	memcpy(byteArrayPtr->bytes, bytes, (size_t) length);
          416  +	memcpy(byteArrayPtr->bytes, bytes, length);
   422    417       }
   423    418       objPtr->typePtr = &properByteArrayType;
   424    419       SET_BYTEARRAY(objPtr, byteArrayPtr);
   425    420   }
   426    421   
   427    422   /*
   428    423    *----------------------------------------------------------------------
................................................................................
   483    478    *
   484    479    *----------------------------------------------------------------------
   485    480    */
   486    481   
   487    482   unsigned char *
   488    483   Tcl_SetByteArrayLength(
   489    484       Tcl_Obj *objPtr,		/* The ByteArray object. */
   490         -    int length)			/* New length for internal byte array. */
          485  +    size_t length)			/* New length for internal byte array. */
   491    486   {
   492    487       ByteArray *byteArrayPtr;
   493    488   
   494    489       if (Tcl_IsShared(objPtr)) {
   495    490   	Tcl_Panic("%s called with shared object", "Tcl_SetByteArrayLength");
   496    491       }
   497    492       if ((objPtr->typePtr != &properByteArrayType)
   498    493   	    && (objPtr->typePtr != &tclByteArrayType)) {
   499    494   	SetByteArrayFromAny(NULL, objPtr);
   500    495       }
   501    496   
   502    497       byteArrayPtr = GET_BYTEARRAY(objPtr);
   503    498       if (length > byteArrayPtr->allocated) {
   504         -	byteArrayPtr = ckrealloc(byteArrayPtr, BYTEARRAY_SIZE(length));
          499  +	byteArrayPtr = Tcl_Realloc(byteArrayPtr, BYTEARRAY_SIZE(length));
   505    500   	byteArrayPtr->allocated = length;
   506    501   	SET_BYTEARRAY(objPtr, byteArrayPtr);
   507    502       }
   508    503       TclInvalidateStringRep(objPtr);
   509    504       byteArrayPtr->used = length;
   510    505       return byteArrayPtr->bytes;
   511    506   }
................................................................................
   545    540   	return TCL_OK;
   546    541       }
   547    542   
   548    543       src = TclGetString(objPtr);
   549    544       length = objPtr->length;
   550    545       srcEnd = src + length;
   551    546   
   552         -    byteArrayPtr = ckalloc(BYTEARRAY_SIZE(length));
          547  +    byteArrayPtr = Tcl_Alloc(BYTEARRAY_SIZE(length));
   553    548       for (dst = byteArrayPtr->bytes; src < srcEnd; ) {
   554    549   	src += TclUtfToUniChar(src, &ch);
   555    550   	improper = improper || (ch > 255);
   556    551   	*dst++ = UCHAR(ch);
   557    552       }
   558    553   
   559    554       byteArrayPtr->used = dst - byteArrayPtr->bytes;
................................................................................
   582    577    *----------------------------------------------------------------------
   583    578    */
   584    579   
   585    580   static void
   586    581   FreeByteArrayInternalRep(
   587    582       Tcl_Obj *objPtr)		/* Object with internal rep to free. */
   588    583   {
   589         -    ckfree(GET_BYTEARRAY(objPtr));
          584  +    Tcl_Free(GET_BYTEARRAY(objPtr));
   590    585       objPtr->typePtr = NULL;
   591    586   }
   592    587   
   593    588   /*
   594    589    *----------------------------------------------------------------------
   595    590    *
   596    591    * DupByteArrayInternalRep --
................................................................................
   608    603    */
   609    604   
   610    605   static void
   611    606   DupByteArrayInternalRep(
   612    607       Tcl_Obj *srcPtr,		/* Object with internal rep to copy. */
   613    608       Tcl_Obj *copyPtr)		/* Object with internal rep to set. */
   614    609   {
   615         -    int length;
          610  +    size_t length;
   616    611       ByteArray *srcArrayPtr, *copyArrayPtr;
   617    612   
   618    613       srcArrayPtr = GET_BYTEARRAY(srcPtr);
   619    614       length = srcArrayPtr->used;
   620    615   
   621         -    copyArrayPtr = ckalloc(BYTEARRAY_SIZE(length));
          616  +    copyArrayPtr = Tcl_Alloc(BYTEARRAY_SIZE(length));
   622    617       copyArrayPtr->used = length;
   623    618       copyArrayPtr->allocated = length;
   624         -    memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, (size_t) length);
          619  +    memcpy(copyArrayPtr->bytes, srcArrayPtr->bytes, length);
   625    620       SET_BYTEARRAY(copyPtr, copyArrayPtr);
   626    621   
   627    622       copyPtr->typePtr = srcPtr->typePtr;
   628    623   }
   629    624   
   630    625   /*
   631    626    *----------------------------------------------------------------------
................................................................................
   650    645    */
   651    646   
   652    647   static void
   653    648   UpdateStringOfByteArray(
   654    649       Tcl_Obj *objPtr)		/* ByteArray object whose string rep to
   655    650   				 * update. */
   656    651   {
   657         -    int i, length, size;
          652  +    size_t i, length, size;
   658    653       unsigned char *src;
   659    654       char *dst;
   660    655       ByteArray *byteArrayPtr;
   661    656   
   662    657       byteArrayPtr = GET_BYTEARRAY(objPtr);
   663    658       src = byteArrayPtr->bytes;
   664    659       length = byteArrayPtr->used;
   665    660   
   666    661       /*
   667    662        * How much space will string rep need?
   668    663        */
   669    664   
   670    665       size = length;
   671         -    for (i = 0; i < length && size >= 0; i++) {
          666  +    for (i = 0; (i < length) && (size != TCL_AUTO_LENGTH); i++) {
   672    667   	if ((src[i] == 0) || (src[i] > 127)) {
   673    668   	    size++;
   674    669   	}
   675    670       }
   676         -    if (size < 0) {
   677         -	Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
          671  +    if (size == TCL_AUTO_LENGTH) {
          672  +	Tcl_Panic("max size for a Tcl value exceeded");
   678    673       }
   679    674   
   680         -    dst = ckalloc(size + 1);
          675  +    dst = Tcl_Alloc(size + 1);
   681    676       objPtr->bytes = dst;
   682    677       objPtr->length = size;
   683    678   
   684    679       if (size == length) {
   685         -	memcpy(dst, src, (size_t) size);
          680  +	memcpy(dst, src, size);
   686    681   	dst[size] = '\0';
   687    682       } else {
   688    683   	for (i = 0; i < length; i++) {
   689    684   	    dst += Tcl_UniCharToUtf(src[i], dst);
   690    685   	}
   691    686   	*dst = '\0';
   692    687       }
................................................................................
   711    706    *----------------------------------------------------------------------
   712    707    */
   713    708   
   714    709   void
   715    710   TclAppendBytesToByteArray(
   716    711       Tcl_Obj *objPtr,
   717    712       const unsigned char *bytes,
   718         -    int len)
          713  +    size_t len)
   719    714   {
   720    715       ByteArray *byteArrayPtr;
   721         -    int needed;
          716  +    size_t needed;
   722    717   
   723    718       if (Tcl_IsShared(objPtr)) {
   724    719   	Tcl_Panic("%s called with shared object","TclAppendBytesToByteArray");
   725    720       }
   726         -    if (len < 0) {
          721  +    if (len == TCL_AUTO_LENGTH) {
   727    722   	Tcl_Panic("%s must be called with definite number of bytes to append",
   728    723   		"TclAppendBytesToByteArray");
   729    724       }
   730    725       if (len == 0) {
   731    726   	/* Append zero bytes is a no-op. */
   732    727   	return;
   733    728       }
   734    729       if ((objPtr->typePtr != &properByteArrayType)
   735    730   	    && (objPtr->typePtr != &tclByteArrayType)) {
   736    731   	SetByteArrayFromAny(NULL, objPtr);
   737    732       }
   738    733       byteArrayPtr = GET_BYTEARRAY(objPtr);
   739    734   
   740         -    if (len > INT_MAX - byteArrayPtr->used) {
   741         -	Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
          735  +    if (len + byteArrayPtr->used > UINT_MAX) {
          736  +	Tcl_Panic("max size for a Tcl value (%u bytes) exceeded", UINT_MAX);
   742    737       }
   743    738   
   744    739       needed = byteArrayPtr->used + len;
   745    740       /*
   746    741        * If we need to, resize the allocated space in the byte array.
   747    742        */
   748    743   
   749    744       if (needed > byteArrayPtr->allocated) {
   750    745   	ByteArray *ptr = NULL;
   751         -	int attempt;
          746  +	size_t attempt;
   752    747   
   753    748   	if (needed <= INT_MAX/2) {
   754    749   	    /* Try to allocate double the total space that is needed. */
   755    750   	    attempt = 2 * needed;
   756         -	    ptr = attemptckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
          751  +	    ptr = Tcl_AttemptRealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
   757    752   	}
   758    753   	if (ptr == NULL) {
   759    754   	    /* Try to allocate double the increment that is needed (plus). */
   760         -	    unsigned int limit = INT_MAX - needed;
   761         -	    unsigned int extra = len + TCL_MIN_GROWTH;
   762         -	    int growth = (int) ((extra > limit) ? limit : extra);
          755  +	    size_t limit = INT_MAX - needed;
          756  +	    size_t extra = len + TCL_MIN_GROWTH;
          757  +	    size_t growth = (extra > limit) ? limit : extra;
   763    758   
   764    759   	    attempt = needed + growth;
   765         -	    ptr = attemptckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
          760  +	    ptr = Tcl_AttemptRealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
   766    761   	}
   767    762   	if (ptr == NULL) {
   768    763   	    /* Last chance: Try to allocate exactly what is needed. */
   769    764   	    attempt = needed;
   770         -	    ptr = ckrealloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
          765  +	    ptr = Tcl_Realloc(byteArrayPtr, BYTEARRAY_SIZE(attempt));
   771    766   	}
   772    767   	byteArrayPtr = ptr;
   773    768   	byteArrayPtr->allocated = attempt;
   774    769   	SET_BYTEARRAY(objPtr, byteArrayPtr);
   775    770       }
   776    771   
   777    772       if (bytes) {
................................................................................
  2479   2474   	for (i=0 ; i<2 ; i++) {
  2480   2475   	    if (data >= dataend) {
  2481   2476   		value <<= 4;
  2482   2477   		break;
  2483   2478   	    }
  2484   2479   
  2485   2480   	    c = *data++;
  2486         -	    if (!isxdigit((int) c)) {
         2481  +	    if (!isxdigit(c)) {
  2487   2482   		if (strict || !isspace(c)) {
  2488   2483   		    goto badChar;
  2489   2484   		}
  2490   2485   		i--;
  2491   2486   		continue;
  2492   2487   	    }
  2493   2488   
................................................................................
  2513   2508       Tcl_SetByteArrayLength(resultObj, cursor - begin - cut);
  2514   2509       Tcl_SetObjResult(interp, resultObj);
  2515   2510       return TCL_OK;
  2516   2511   
  2517   2512     badChar:
  2518   2513       TclDecrRefCount(resultObj);
  2519   2514       Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  2520         -	    "invalid hexadecimal digit \"%c\" at position %d",
  2521         -	    c, (int) (data - datastart - 1)));
         2515  +	    "invalid hexadecimal digit \"%c\" at position %" TCL_Z_MODIFIER "u",
         2516  +	    c, data - datastart - 1));
  2522   2517       return TCL_ERROR;
  2523   2518   }
  2524   2519   
  2525   2520   /*
  2526   2521    *----------------------------------------------------------------------
  2527   2522    *
  2528   2523    * BinaryEncode64 --
................................................................................
  2915   2910       Tcl_SetObjResult(interp, Tcl_ObjPrintf("short uuencode data"));
  2916   2911       Tcl_SetErrorCode(interp, "TCL", "BINARY", "DECODE", "SHORT", NULL);
  2917   2912       TclDecrRefCount(resultObj);
  2918   2913       return TCL_ERROR;
  2919   2914   
  2920   2915     badUu:
  2921   2916       Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  2922         -	    "invalid uuencode character \"%c\" at position %d",
  2923         -	    c, (int) (data - datastart - 1)));
         2917  +	    "invalid uuencode character \"%c\" at position %" TCL_Z_MODIFIER "u",
         2918  +	    c, data - datastart - 1));
  2924   2919       Tcl_SetErrorCode(interp, "TCL", "BINARY", "DECODE", "INVALID", NULL);
  2925   2920       TclDecrRefCount(resultObj);
  2926   2921       return TCL_ERROR;
  2927   2922   }
  2928   2923   
  2929   2924   /*
  2930   2925    *----------------------------------------------------------------------
................................................................................
  3065   3060       }
  3066   3061       Tcl_SetByteArrayLength(resultObj, cursor - begin - cut);
  3067   3062       Tcl_SetObjResult(interp, resultObj);
  3068   3063       return TCL_OK;
  3069   3064   
  3070   3065     bad64:
  3071   3066       Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  3072         -	    "invalid base64 character \"%c\" at position %d",
  3073         -	    (char) c, (int) (data - datastart - 1)));
         3067  +	    "invalid base64 character \"%c\" at position %" TCL_Z_MODIFIER "u",
         3068  +	    (char) c, data - datastart - 1));
  3074   3069       TclDecrRefCount(resultObj);
  3075   3070       return TCL_ERROR;
  3076   3071   }
  3077   3072   
  3078   3073   /*
  3079   3074    * Local Variables:
  3080   3075    * mode: c
  3081   3076    * c-basic-offset: 4
  3082   3077    * fill-column: 78
  3083   3078    * End:
  3084   3079    */
  3085   3080   

Changes to generic/tclCkalloc.c.

    16     16    */
    17     17   
    18     18   #include "tclInt.h"
    19     19   
    20     20   #define FALSE	0
    21     21   #define TRUE	1
    22     22   
    23         -#undef Tcl_Alloc
    24     23   #undef Tcl_Free
    25         -#undef Tcl_Realloc
    26     24   #undef Tcl_AttemptAlloc
    27     25   #undef Tcl_AttemptRealloc
    28     26   
    29     27   #ifdef TCL_MEM_DEBUG
    30     28   
    31     29   /*
    32     30    * One of the following structures is allocated each time the
................................................................................
   117    115   static char *onExitMemDumpFileName = NULL;
   118    116   static char dumpFile[100];	/* Records where to dump memory allocation
   119    117   				 * information. */
   120    118   
   121    119   /*
   122    120    * Mutex to serialize allocations. This is a low-level mutex that must be
   123    121    * explicitly initialized. This is necessary because the self initializing
   124         - * mutexes use ckalloc...
          122  + * mutexes use Tcl_Alloc...
   125    123    */
   126    124   
   127    125   static Tcl_Mutex *ckallocMutexPtr;
   128    126   static int ckallocInit = 0;
   129    127   
   130    128   /*
   131    129    * Prototypes for procedures defined in this file:
................................................................................
   241    239   
   242    240       for (idx = 0; idx < LOW_GUARD_SIZE; idx++) {
   243    241   	byte = *(memHeaderP->low_guard + idx);
   244    242   	if (byte != GUARD_VALUE) {
   245    243   	    guard_failed = TRUE;
   246    244   	    fflush(stdout);
   247    245   	    byte &= 0xff;
   248         -	    fprintf(stderr, "low guard byte %d is 0x%x  \t%c\n", (int)idx, byte,
          246  +	    fprintf(stderr, "low guard byte %" TCL_Z_MODIFIER "u is 0x%x  \t%c\n", idx, byte,
   249    247   		    (isprint(UCHAR(byte)) ? byte : ' ')); /* INTL: bytes */
   250    248   	}
   251    249       }
   252    250       if (guard_failed) {
   253    251   	TclDumpMemoryInfo((ClientData) stderr, 0);
   254    252   	fprintf(stderr, "low guard failed at %p, %s %d\n",
   255    253   		memHeaderP->body, file, line);
................................................................................
   262    260       hiPtr = (unsigned char *)memHeaderP->body + memHeaderP->length;
   263    261       for (idx = 0; idx < HIGH_GUARD_SIZE; idx++) {
   264    262   	byte = *(hiPtr + idx);
   265    263   	if (byte != GUARD_VALUE) {
   266    264   	    guard_failed = TRUE;
   267    265   	    fflush(stdout);
   268    266   	    byte &= 0xff;
   269         -	    fprintf(stderr, "hi guard byte %d is 0x%x  \t%c\n", (int)idx, byte,
          267  +	    fprintf(stderr, "hi guard byte %" TCL_Z_MODIFIER "u is 0x%x  \t%c\n", idx, byte,
   270    268   		    (isprint(UCHAR(byte)) ? byte : ' ')); /* INTL: bytes */
   271    269   	}
   272    270       }
   273    271   
   274    272       if (guard_failed) {
   275    273   	TclDumpMemoryInfo((ClientData) stderr, 0);
   276    274   	fprintf(stderr, "high guard failed at %p, %s %d\n",
................................................................................
   372    370       }
   373    371       return TCL_OK;
   374    372   }
   375    373   
   376    374   /*
   377    375    *----------------------------------------------------------------------
   378    376    *
   379         - * Tcl_DbCkalloc - debugging ckalloc
          377  + * Tcl_DbCkalloc - debugging Tcl_Alloc
   380    378    *
   381    379    *	Allocate the requested amount of space plus some extra for guard bands
   382    380    *	at both ends of the request, plus a size, panicing if there isn't
   383    381    *	enough space, then write in the guard bands and return the address of
   384    382    *	the space in the middle that the user asked for.
   385    383    *
   386    384    *	The second and third arguments are file and line, these contain the
   387    385    *	filename and line number corresponding to the caller. These are sent
   388         - *	by the ckalloc macro; it uses the preprocessor autodefines __FILE__
          386  + *	by the Tcl_Alloc macro; it uses the preprocessor autodefines __FILE__
   389    387    *	and __LINE__.
   390    388    *
   391    389    *----------------------------------------------------------------------
   392    390    */
   393    391   
   394         -char *
          392  +void *
   395    393   Tcl_DbCkalloc(
   396         -    unsigned int size,
          394  +    size_t size,
   397    395       const char *file,
   398    396       int line)
   399    397   {
   400    398       struct mem_header *result = NULL;
   401    399   
   402    400       if (validate_memory) {
   403    401   	Tcl_ValidateAllMemory(file, line);
................................................................................
   407    405       if (size <= UINT_MAX - HIGH_GUARD_SIZE -sizeof(struct mem_header)) {
   408    406   	result = (struct mem_header *) TclpAlloc((unsigned)size +
   409    407   		sizeof(struct mem_header) + HIGH_GUARD_SIZE);
   410    408       }
   411    409       if (result == NULL) {
   412    410   	fflush(stdout);
   413    411   	TclDumpMemoryInfo((ClientData) stderr, 0);
   414         -	Tcl_Panic("unable to alloc %u bytes, %s line %d", size, file, line);
          412  +	Tcl_Panic("unable to alloc %" TCL_Z_MODIFIER "u bytes, %s line %d", size, file, line);
   415    413       }
   416    414   
   417    415       /*
   418    416        * Fill in guard zones and size. Also initialize the contents of the block
   419    417        * with bogus bytes to detect uses of initialized data. Link into
   420    418        * allocated list.
   421    419        */
................................................................................
   453    451   		total_mallocs);
   454    452   	fflush(stderr);
   455    453   	alloc_tracing = TRUE;
   456    454   	trace_on_at_malloc = 0;
   457    455       }
   458    456   
   459    457       if (alloc_tracing) {
   460         -	fprintf(stderr,"ckalloc %p %u %s %d\n",
          458  +	fprintf(stderr,"Tcl_Alloc %p %" TCL_Z_MODIFIER "u %s %d\n",
   461    459   		result->body, size, file, line);
   462    460       }
   463    461   
   464    462       if (break_on_malloc && (total_mallocs >= break_on_malloc)) {
   465    463   	break_on_malloc = 0;
   466    464   	(void) fflush(stdout);
   467    465   	Tcl_Panic("reached malloc break limit (%u)", total_mallocs);
................................................................................
   477    475       }
   478    476   
   479    477       Tcl_MutexUnlock(ckallocMutexPtr);
   480    478   
   481    479       return result->body;
   482    480   }
   483    481   
   484         -char *
          482  +void *
   485    483   Tcl_AttemptDbCkalloc(
   486         -    unsigned int size,
          484  +    size_t size,
   487    485       const char *file,
   488    486       int line)
   489    487   {
   490    488       struct mem_header *result = NULL;
   491    489   
   492    490       if (validate_memory) {
   493    491   	Tcl_ValidateAllMemory(file, line);
................................................................................
   542    540   		total_mallocs);
   543    541   	fflush(stderr);
   544    542   	alloc_tracing = TRUE;
   545    543   	trace_on_at_malloc = 0;
   546    544       }
   547    545   
   548    546       if (alloc_tracing) {
   549         -	fprintf(stderr,"ckalloc %p %u %s %d\n",
          547  +	fprintf(stderr,"Tcl_Alloc %p %" TCL_Z_MODIFIER "u %s %d\n",
   550    548   		result->body, size, file, line);
   551    549       }
   552    550   
   553    551       if (break_on_malloc && (total_mallocs >= break_on_malloc)) {
   554    552   	break_on_malloc = 0;
   555    553   	(void) fflush(stdout);
   556    554   	Tcl_Panic("reached malloc break limit (%d)", total_mallocs);
................................................................................
   569    567   
   570    568       return result->body;
   571    569   }
   572    570   
   573    571   /*
   574    572    *----------------------------------------------------------------------
   575    573    *
   576         - * Tcl_DbCkfree - debugging ckfree
          574  + * Tcl_DbCkfree - debugging Tcl_Free
   577    575    *
   578    576    *	Verify that the low and high guards are intact, and if so then free
   579    577    *	the buffer else Tcl_Panic.
   580    578    *
   581    579    *	The guards are erased after being checked to catch duplicate frees.
   582    580    *
   583    581    *	The second and third arguments are file and line, these contain the
   584    582    *	filename and line number corresponding to the caller. These are sent
   585         - *	by the ckfree macro; it uses the preprocessor autodefines __FILE__ and
          583  + *	by the Tcl_Free macro; it uses the preprocessor autodefines __FILE__ and
   586    584    *	__LINE__.
   587    585    *
   588    586    *----------------------------------------------------------------------
   589    587    */
   590    588   
   591    589   void
   592    590   Tcl_DbCkfree(
   593         -    char *ptr,
          591  +    void *ptr,
   594    592       const char *file,
   595    593       int line)
   596    594   {
   597    595       struct mem_header *memp;
   598    596   
   599    597       if (ptr == NULL) {
   600    598   	return;
................................................................................
   607    605        * such as Crays (will subtract only bytes, even though BODY_OFFSET is in
   608    606        * words on these machines).
   609    607        */
   610    608   
   611    609       memp = (struct mem_header *) (((size_t) ptr) - BODY_OFFSET);
   612    610   
   613    611       if (alloc_tracing) {
   614         -	fprintf(stderr, "ckfree %p %" TCL_Z_MODIFIER "u %s %d\n",
          612  +	fprintf(stderr, "Tcl_Free %p %" TCL_Z_MODIFIER "u %s %d\n",
   615    613   		memp->body, memp->length, file, line);
   616    614       }
   617    615   
   618    616       if (validate_memory) {
   619    617   	Tcl_ValidateAllMemory(file, line);
   620    618       }
   621    619   
................................................................................
   651    649       TclpFree((char *) memp);
   652    650       Tcl_MutexUnlock(ckallocMutexPtr);
   653    651   }
   654    652   
   655    653   /*
   656    654    *--------------------------------------------------------------------
   657    655    *
   658         - * Tcl_DbCkrealloc - debugging ckrealloc
          656  + * Tcl_DbCkrealloc - debugging Tcl_Realloc
   659    657    *
   660    658    *	Reallocate a chunk of memory by allocating a new one of the right
   661    659    *	size, copying the old data to the new location, and then freeing the
   662    660    *	old memory space, using all the memory checking features of this
   663    661    *	package.
   664    662    *
   665    663    *--------------------------------------------------------------------
   666    664    */
   667    665   
   668         -char *
          666  +void *
   669    667   Tcl_DbCkrealloc(
   670         -    char *ptr,
   671         -    unsigned int size,
          668  +    void *ptr,
          669  +    size_t size,
   672    670       const char *file,
   673    671       int line)
   674    672   {
   675    673       char *newPtr;
   676    674       size_t copySize;
   677    675       struct mem_header *memp;
   678    676   
................................................................................
   692    690       }
   693    691       newPtr = Tcl_DbCkalloc(size, file, line);
   694    692       memcpy(newPtr, ptr, (size_t) copySize);
   695    693       Tcl_DbCkfree(ptr, file, line);
   696    694       return newPtr;
   697    695   }
   698    696   
   699         -char *
          697  +void *
   700    698   Tcl_AttemptDbCkrealloc(
   701         -    char *ptr,
   702         -    unsigned int size,
          699  +    void *ptr,
          700  +    size_t size,
   703    701       const char *file,
   704    702       int line)
   705    703   {
   706    704       char *newPtr;
   707    705       size_t copySize;
   708    706       struct mem_header *memp;
   709    707   
................................................................................
   726    724   	return NULL;
   727    725       }
   728    726       memcpy(newPtr, ptr, (size_t) copySize);
   729    727       Tcl_DbCkfree(ptr, file, line);
   730    728       return newPtr;
   731    729   }
   732    730   
   733         -
   734         -/*
   735         - *----------------------------------------------------------------------
   736         - *
   737         - * Tcl_Alloc, et al. --
   738         - *
   739         - *	These functions are defined in terms of the debugging versions when
   740         - *	TCL_MEM_DEBUG is set.
   741         - *
   742         - * Results:
   743         - *	Same as the debug versions.
   744         - *
   745         - * Side effects:
   746         - *	Same as the debug versions.
   747         - *
   748         - *----------------------------------------------------------------------
   749         - */
   750         -
   751         -char *
   752         -Tcl_Alloc(
   753         -    unsigned int size)
   754         -{
   755         -    return Tcl_DbCkalloc(size, "unknown", 0);
   756         -}
   757         -
   758         -char *
   759         -Tcl_AttemptAlloc(
   760         -    unsigned int size)
   761         -{
   762         -    return Tcl_AttemptDbCkalloc(size, "unknown", 0);
   763         -}
   764         -
   765         -void
   766         -Tcl_Free(
   767         -    char *ptr)
   768         -{
   769         -    Tcl_DbCkfree(ptr, "unknown", 0);
   770         -}
   771         -
   772         -char *
   773         -Tcl_Realloc(
   774         -    char *ptr,
   775         -    unsigned int size)
   776         -{
   777         -    return Tcl_DbCkrealloc(ptr, size, "unknown", 0);
   778         -}
   779         -char *
   780         -Tcl_AttemptRealloc(
   781         -    char *ptr,
   782         -    unsigned int size)
   783         -{
   784         -    return Tcl_AttemptDbCkrealloc(ptr, size, "unknown", 0);
   785         -}
   786    731   
   787    732   /*
   788    733    *----------------------------------------------------------------------
   789    734    *
   790    735    * MemoryCmd --
   791    736    *
   792    737    *	Implements the Tcl "memory" command, which provides Tcl-level control
................................................................................
  1048    993    *
  1049    994    *	Interface to TclpAlloc when TCL_MEM_DEBUG is disabled. It does check
  1050    995    *	that memory was actually allocated.
  1051    996    *
  1052    997    *----------------------------------------------------------------------
  1053    998    */
  1054    999   
  1055         -char *
         1000  +#undef Tcl_Alloc
         1001  +void *
  1056   1002   Tcl_Alloc(
  1057         -    unsigned int size)
         1003  +    size_t size)
  1058   1004   {
  1059         -    char *result;
         1005  +    void *result;
  1060   1006   
  1061   1007       result = TclpAlloc(size);
  1062   1008   
  1063   1009       /*
  1064   1010        * Most systems will not alloc(0), instead bumping it to one so that NULL
  1065   1011        * isn't returned. Some systems (AIX, Tru64) will alloc(0) by returning
  1066   1012        * NULL, so we have to check that the NULL we get is not in response to
................................................................................
  1067   1013        * alloc(0).
  1068   1014        *
  1069   1015        * The ANSI spec actually says that systems either return NULL *or* a
  1070   1016        * special pointer on failure, but we only check for NULL
  1071   1017        */
  1072   1018   
  1073   1019       if ((result == NULL) && size) {
  1074         -	Tcl_Panic("unable to alloc %u bytes", size);
         1020  +	Tcl_Panic("unable to alloc %" TCL_Z_MODIFIER "u bytes", size);
  1075   1021       }
  1076   1022       return result;
  1077   1023   }
  1078   1024   
  1079         -char *
         1025  +void *
  1080   1026   Tcl_DbCkalloc(
  1081         -    unsigned int size,
         1027  +    size_t size,
  1082   1028       const char *file,
  1083   1029       int line)
  1084   1030   {
  1085         -    char *result;
         1031  +    void *result;
  1086   1032   
  1087         -    result = (char *) TclpAlloc(size);
         1033  +    result = TclpAlloc(size);
  1088   1034   
  1089   1035       if ((result == NULL) && size) {
  1090   1036   	fflush(stdout);
  1091         -	Tcl_Panic("unable to alloc %u bytes, %s line %d", size, file, line);
         1037  +	Tcl_Panic("unable to alloc %" TCL_Z_MODIFIER "u bytes, %s line %d",
         1038  +		size, file, line);
  1092   1039       }
  1093   1040       return result;
  1094   1041   }
  1095   1042   
  1096   1043   /*
  1097   1044    *----------------------------------------------------------------------
  1098   1045    *
................................................................................
  1100   1047    *
  1101   1048    *	Interface to TclpAlloc when TCL_MEM_DEBUG is disabled. It does not
  1102   1049    *	check that memory was actually allocated.
  1103   1050    *
  1104   1051    *----------------------------------------------------------------------
  1105   1052    */
  1106   1053   
  1107         -char *
         1054  +void *
  1108   1055   Tcl_AttemptAlloc(
  1109         -    unsigned int size)
         1056  +    size_t size)
  1110   1057   {
  1111         -    char *result;
         1058  +    void *result;
  1112   1059   
  1113   1060       result = TclpAlloc(size);
  1114   1061       return result;
  1115   1062   }
  1116   1063   
  1117         -char *
         1064  +void *
  1118   1065   Tcl_AttemptDbCkalloc(
  1119         -    unsigned int size,
         1066  +    size_t size,
  1120   1067       const char *file,
  1121   1068       int line)
  1122   1069   {
  1123         -    char *result;
         1070  +    void *result;
  1124   1071   
  1125         -    result = (char *) TclpAlloc(size);
         1072  +    result = TclpAlloc(size);
  1126   1073       return result;
  1127   1074   }
  1128   1075   
  1129   1076   /*
  1130   1077    *----------------------------------------------------------------------
  1131   1078    *
  1132   1079    * Tcl_Realloc --
................................................................................
  1133   1080    *
  1134   1081    *	Interface to TclpRealloc when TCL_MEM_DEBUG is disabled. It does check
  1135   1082    *	that memory was actually allocated.
  1136   1083    *
  1137   1084    *----------------------------------------------------------------------
  1138   1085    */
  1139   1086   
  1140         -char *
         1087  +#undef Tcl_Realloc
         1088  +void *
  1141   1089   Tcl_Realloc(
  1142         -    char *ptr,
  1143         -    unsigned int size)
         1090  +    void *ptr,
         1091  +    size_t size)
  1144   1092   {
  1145   1093       char *result;
  1146   1094   
  1147   1095       result = TclpRealloc(ptr, size);
  1148   1096   
  1149   1097       if ((result == NULL) && size) {
  1150         -	Tcl_Panic("unable to realloc %u bytes", size);
         1098  +	Tcl_Panic("unable to realloc %" TCL_Z_MODIFIER "u bytes", size);
  1151   1099       }
  1152   1100       return result;
  1153   1101   }
  1154   1102   
  1155         -char *
         1103  +void *
  1156   1104   Tcl_DbCkrealloc(
  1157         -    char *ptr,
  1158         -    unsigned int size,
         1105  +    void *ptr,
         1106  +    size_t size,
  1159   1107       const char *file,
  1160   1108       int line)
  1161   1109   {
  1162         -    char *result;
         1110  +    void *result;
  1163   1111   
  1164         -    result = (char *) TclpRealloc(ptr, size);
         1112  +    result = TclpRealloc(ptr, size);
  1165   1113   
  1166   1114       if ((result == NULL) && size) {
  1167   1115   	fflush(stdout);
  1168         -	Tcl_Panic("unable to realloc %u bytes, %s line %d", size, file, line);
         1116  +	Tcl_Panic("unable to realloc %" TCL_Z_MODIFIER "u bytes, %s line %d",
         1117  +		size, file, line);
  1169   1118       }
  1170   1119       return result;
  1171   1120   }
  1172   1121   
  1173   1122   /*
  1174   1123    *----------------------------------------------------------------------
  1175   1124    *
................................................................................
  1177   1126    *
  1178   1127    *	Interface to TclpRealloc when TCL_MEM_DEBUG is disabled. It does not
  1179   1128    *	check that memory was actually allocated.
  1180   1129    *
  1181   1130    *----------------------------------------------------------------------
  1182   1131    */
  1183   1132   
  1184         -char *
         1133  +void *
  1185   1134   Tcl_AttemptRealloc(
  1186         -    char *ptr,
  1187         -    unsigned int size)
         1135  +    void *ptr,
         1136  +    size_t size)
  1188   1137   {
  1189         -    char *result;
         1138  +    void *result;
  1190   1139   
  1191   1140       result = TclpRealloc(ptr, size);
  1192   1141       return result;
  1193   1142   }
  1194   1143   
  1195         -char *
         1144  +void *
  1196   1145   Tcl_AttemptDbCkrealloc(
  1197         -    char *ptr,
  1198         -    unsigned int size,
         1146  +    void *ptr,
         1147  +    size_t size,
  1199   1148       const char *file,
  1200   1149       int line)
  1201   1150   {
  1202         -    char *result;
         1151  +    void *result;
  1203   1152   
  1204         -    result = (char *) TclpRealloc(ptr, size);
         1153  +    result = TclpRealloc(ptr, size);
  1205   1154       return result;
  1206   1155   }
  1207   1156   
  1208   1157   /*
  1209   1158    *----------------------------------------------------------------------
  1210   1159    *
  1211   1160    * Tcl_Free --
................................................................................
  1213   1162    *	Interface to TclpFree when TCL_MEM_DEBUG is disabled. Done here rather
  1214   1163    *	in the macro to keep some modules from being compiled with
  1215   1164    *	TCL_MEM_DEBUG enabled and some with it disabled.
  1216   1165    *
  1217   1166    *----------------------------------------------------------------------
  1218   1167    */
  1219   1168   
         1169  +#undef Tcl_Free
  1220   1170   void
  1221   1171   Tcl_Free(
  1222         -    char *ptr)
         1172  +    void *ptr)
  1223   1173   {
  1224   1174       TclpFree(ptr);
  1225   1175   }
  1226   1176   
  1227   1177   void
  1228   1178   Tcl_DbCkfree(
  1229         -    char *ptr,
         1179  +    void *ptr,
  1230   1180       const char *file,
  1231   1181       int line)
  1232   1182   {
  1233   1183       TclpFree(ptr);
  1234   1184   }
  1235   1185   
  1236   1186   /*

Changes to generic/tclClock.c.

   271    271   	return;
   272    272       }
   273    273   
   274    274       /*
   275    275        * Create the client data, which is a refcounted literal pool.
   276    276        */
   277    277   
   278         -    data = ckalloc(sizeof(ClockClientData));
          278  +    data = Tcl_Alloc(sizeof(ClockClientData));
   279    279       data->refCount = 0;
   280         -    data->literals = ckalloc(LIT__END * sizeof(Tcl_Obj*));
          280  +    data->literals = Tcl_Alloc(LIT__END * sizeof(Tcl_Obj*));
   281    281       for (i = 0; i < LIT__END; ++i) {
   282    282   	data->literals[i] = Tcl_NewStringObj(literals[i], -1);
   283    283   	Tcl_IncrRefCount(data->literals[i]);
   284    284       }
   285    285   
   286    286       /*
   287    287        * Install the commands.
................................................................................
  2035   2035   
  2036   2036       Tcl_MutexLock(&clockMutex);
  2037   2037       tzIsNow = getenv("TZ");
  2038   2038       if (tzIsNow != NULL && (tzWas == NULL || tzWas == INT2PTR(-1)
  2039   2039   	    || strcmp(tzIsNow, tzWas) != 0)) {
  2040   2040   	tzset();
  2041   2041   	if (tzWas != NULL && tzWas != INT2PTR(-1)) {
  2042         -	    ckfree(tzWas);
         2042  +	    Tcl_Free(tzWas);
  2043   2043   	}
  2044         -	tzWas = ckalloc(strlen(tzIsNow) + 1);
         2044  +	tzWas = Tcl_Alloc(strlen(tzIsNow) + 1);
  2045   2045   	strcpy(tzWas, tzIsNow);
  2046   2046       } else if (tzIsNow == NULL && tzWas != NULL) {
  2047   2047   	tzset();
  2048         -	if (tzWas != INT2PTR(-1)) ckfree(tzWas);
         2048  +	if (tzWas != INT2PTR(-1)) Tcl_Free(tzWas);
  2049   2049   	tzWas = NULL;
  2050   2050       }
  2051   2051       Tcl_MutexUnlock(&clockMutex);
  2052   2052   }
  2053   2053   
  2054   2054   /*
  2055   2055    *----------------------------------------------------------------------
................................................................................
  2072   2072       ClockClientData *data = clientData;
  2073   2073       int i;
  2074   2074   
  2075   2075       if (data->refCount-- <= 1) {
  2076   2076   	for (i = 0; i < LIT__END; ++i) {
  2077   2077   	    Tcl_DecrRefCount(data->literals[i]);
  2078   2078   	}
  2079         -	ckfree(data->literals);
  2080         -	ckfree(data);
         2079  +	Tcl_Free(data->literals);
         2080  +	Tcl_Free(data);
  2081   2081       }
  2082   2082   }
  2083   2083   
  2084   2084   /*
  2085   2085    * Local Variables:
  2086   2086    * mode: c
  2087   2087    * c-basic-offset: 4
  2088   2088    * fill-column: 78
  2089   2089    * End:
  2090   2090    */

Changes to generic/tclCmdAH.c.

   535    535       Tcl_Interp *interp,		/* Current interpreter. */
   536    536       int objc,			/* Number of arguments. */
   537    537       Tcl_Obj *const objv[])	/* Argument objects. */
   538    538   {
   539    539       Tcl_Obj *data;		/* Byte array to convert */
   540    540       Tcl_DString ds;		/* Buffer to hold the string */
   541    541       Tcl_Encoding encoding;	/* Encoding to use */
   542         -    int length;			/* Length of the byte array being converted */
          542  +    size_t length;			/* Length of the byte array being converted */
   543    543       const char *bytesPtr;	/* Pointer to the first byte of the array */
   544    544   
   545    545       if (objc == 2) {
   546    546   	encoding = Tcl_GetEncoding(interp, NULL);
   547    547   	data = objv[1];
   548    548       } else if (objc == 3) {
   549    549   	if (Tcl_GetEncodingFromObj(interp, objv[1], &encoding) != TCL_OK) {
................................................................................
   554    554   	Tcl_WrongNumArgs(interp, 1, objv, "?encoding? data");
   555    555   	return TCL_ERROR;
   556    556       }
   557    557   
   558    558       /*
   559    559        * Convert the string into a byte array in 'ds'
   560    560        */
   561         -    bytesPtr = (char *) Tcl_GetByteArrayFromObj(data, &length);
          561  +    bytesPtr = (char *) TclGetByteArrayFromObj(data, &length);
   562    562       Tcl_ExternalToUtfDString(encoding, bytesPtr, length, &ds);
   563    563   
   564    564       /*
   565    565        * Note that we cannot use Tcl_DStringResult here because it will
   566    566        * truncate the string at the first null byte.
   567    567        */
   568    568   
................................................................................
   597    597       Tcl_Interp *interp,		/* Current interpreter. */
   598    598       int objc,			/* Number of arguments. */
   599    599       Tcl_Obj *const objv[])	/* Argument objects. */
   600    600   {
   601    601       Tcl_Obj *data;		/* String to convert */
   602    602       Tcl_DString ds;		/* Buffer to hold the byte array */
   603    603       Tcl_Encoding encoding;	/* Encoding to use */
   604         -    int length;			/* Length of the string being converted */
          604  +    size_t length;			/* Length of the string being converted */
   605    605       const char *stringPtr;	/* Pointer to the first byte of the string */
   606    606   
   607    607       /* TODO - ADJUST OBJ INDICES WHEN ENSEMBLIFYING THIS */
   608    608   
   609    609       if (objc == 2) {
   610    610   	encoding = Tcl_GetEncoding(interp, NULL);
   611    611   	data = objv[1];

Changes to generic/tclCmdIL.c.

   657    657       Tcl_HashSearch search;
   658    658       Namespace *nsPtr;
   659    659       Namespace *globalNsPtr = (Namespace *) Tcl_GetGlobalNamespace(interp);
   660    660       Namespace *currNsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp);
   661    661       Tcl_Obj *listPtr, *elemObjPtr;
   662    662       int specificNsInPattern = 0;/* Init. to avoid compiler warning. */
   663    663       Tcl_Command cmd;
   664         -    int i;
          664  +    size_t i;
   665    665   
   666    666       /*
   667    667        * Get the pattern and find the "effective namespace" in which to list
   668    668        * commands.
   669    669        */
   670    670   
   671    671       if (objc == 1) {
................................................................................
  1402   1402   
  1403   1403   	    TclNewObj(procNameObj);
  1404   1404   	    Tcl_GetCommandFullName(interp, (Tcl_Command) procPtr->cmdPtr,
  1405   1405   		    procNameObj);
  1406   1406   	    ADD_PAIR("proc", procNameObj);
  1407   1407   	} else if (procPtr->cmdPtr->clientData) {
  1408   1408   	    ExtraFrameInfo *efiPtr = procPtr->cmdPtr->clientData;
  1409         -	    int i;
         1409  +	    size_t i;
  1410   1410   
  1411   1411   	    /*
  1412   1412   	     * This is a non-standard command. Luckily, it's told us how to
  1413   1413   	     * render extra information about its frame.
  1414   1414   	     */
  1415   1415   
  1416   1416   	    for (i=0 ; i<efiPtr->length ; i++) {
................................................................................
  2206   2206   int
  2207   2207   Tcl_JoinObjCmd(
  2208   2208       ClientData dummy,		/* Not used. */
  2209   2209       Tcl_Interp *interp,		/* Current interpreter. */
  2210   2210       int objc,			/* Number of arguments. */
  2211   2211       Tcl_Obj *const objv[])	/* The argument objects. */
  2212   2212   {
  2213         -    int length, listLen;
         2213  +    size_t length;
         2214  +    int listLen;
  2214   2215       Tcl_Obj *resObjPtr = NULL, *joinObjPtr, **elemPtrs;
  2215   2216   
  2216   2217       if ((objc < 2) || (objc > 3)) {
  2217   2218   	Tcl_WrongNumArgs(interp, 1, objv, "list ?joinString?");
  2218   2219   	return TCL_ERROR;
  2219   2220       }
  2220   2221   
................................................................................
  2237   2238   	Tcl_SetObjResult(interp, elemPtrs[0]);
  2238   2239   	return TCL_OK;
  2239   2240       }
  2240   2241   
  2241   2242       joinObjPtr = (objc == 2) ? Tcl_NewStringObj(" ", 1) : objv[2];
  2242   2243       Tcl_IncrRefCount(joinObjPtr);
  2243   2244   
  2244         -    (void) Tcl_GetStringFromObj(joinObjPtr, &length);
         2245  +    (void) TclGetStringFromObj(joinObjPtr, &length);
  2245   2246       if (length == 0) {
  2246   2247   	resObjPtr = TclStringCat(interp, listLen, elemPtrs, 0);
  2247   2248       } else {
  2248   2249   	int i;
  2249   2250   
  2250   2251   	resObjPtr = Tcl_NewObj();
  2251   2252   	for (i = 0;  i < listLen;  i++) {
................................................................................
  2931   2932   Tcl_LsearchObjCmd(
  2932   2933       ClientData clientData,	/* Not used. */
  2933   2934       Tcl_Interp *interp,		/* Current interpreter. */
  2934   2935       int objc,			/* Number of arguments. */
  2935   2936       Tcl_Obj *const objv[])	/* Argument values. */
  2936   2937   {
  2937   2938       const char *bytes, *patternBytes;
  2938         -    int i, match, index, result=TCL_OK, listc, length, elemLen, bisect;
         2939  +    int i, match, index, result=TCL_OK, listc, bisect;
         2940  +    size_t length = 0, elemLen;
  2939   2941       int allocatedIndexVector = 0;
  2940   2942       int dataType, isIncreasing, lower, upper, start, groupSize, groupOffset;
  2941   2943       Tcl_WideInt patWide, objWide;
  2942   2944       int allMatches, inlineReturn, negatedMatch, returnSubindices, noCase;
  2943   2945       double patDouble, objDouble;
  2944   2946       SortInfo sortInfo;
  2945   2947       Tcl_Obj *patObj, **listv, *listPtr, *startPtr, *itemPtr;
................................................................................
  4097   4099       }
  4098   4100   
  4099   4101       /*
  4100   4102        * The following loop creates a SortElement for each list element and
  4101   4103        * begins sorting it into the sublists as it appears.
  4102   4104        */
  4103   4105   
  4104         -    elementArray = ckalloc(length * sizeof(SortElement));
         4106  +    elementArray = Tcl_Alloc(length * sizeof(SortElement));
  4105   4107   
  4106   4108       for (i=0; i < length; i++){
  4107   4109   	idx = groupSize * i + groupOffset;
  4108   4110   	if (indexc) {
  4109   4111   	    /*
  4110   4112   	     * If this is an indexed sort, retrieve the corresponding element
  4111   4113   	     */
................................................................................
  4230   4232   	TclDecrRefCount(listObj);
  4231   4233   	sortInfo.compareCmdPtr = NULL;
  4232   4234       }
  4233   4235       if (allocatedIndexVector) {
  4234   4236   	TclStackFree(interp, sortInfo.indexv);
  4235   4237       }
  4236   4238       if (elementArray) {
  4237         -	ckfree(elementArray);
         4239  +	Tcl_Free(elementArray);
  4238   4240       }
  4239   4241       return sortInfo.resultCode;
  4240   4242   }
  4241   4243   
  4242   4244   /*
  4243   4245    *----------------------------------------------------------------------
  4244   4246    *

Changes to generic/tclCmdMZ.c.

   482    482   int
   483    483   Tcl_RegsubObjCmd(
   484    484       ClientData dummy,		/* Not used. */
   485    485       Tcl_Interp *interp,		/* Current interpreter. */
   486    486       int objc,			/* Number of arguments. */
   487    487       Tcl_Obj *const objv[])	/* Argument objects. */
   488    488   {
   489         -    int idx, result, cflags, all, wlen, wsublen, numMatches, offset;
          489  +    int idx, result, cflags, all, numMatches, offset;
          490  +    size_t wlen, wsublen = 0;
   490    491       int start, end, subStart, subEnd, match, command, numParts;
   491    492       Tcl_RegExp regExpr;
   492    493       Tcl_RegExpInfo info;
   493    494       Tcl_Obj *resultPtr, *subPtr, *objPtr, *startIndex = NULL;
   494    495       Tcl_UniChar ch, *wsrc, *wfirstChar, *wstring, *wsubspec = 0, *wend;
   495    496   
   496    497       static const char *const options[] = {
................................................................................
   593    594   	    && (strpbrk(TclGetString(objv[2]), "&\\") == NULL)
   594    595   	    && (strpbrk(TclGetString(objv[0]), "*+?{}()[].\\|^$") == NULL)) {
   595    596   	/*
   596    597   	 * This is a simple one pair string map situation. We make use of a
   597    598   	 * slightly modified version of the one pair STR_MAP code.
   598    599   	 */
   599    600   
   600         -	int slen, nocase, wsrclc;
   601         -	int (*strCmpFn)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long);
          601  +	size_t slen;
          602  +	int nocase, wsrclc;
          603  +	int (*strCmpFn)(const Tcl_UniChar*,const Tcl_UniChar*,size_t);
   602    604   	Tcl_UniChar *p;
   603    605   
   604    606   	numMatches = 0;
   605    607   	nocase = (cflags & TCL_REG_NOCASE);
   606    608   	strCmpFn = nocase ? Tcl_UniCharNcasecmp : Tcl_UniCharNcmp;
   607    609   
   608         -	wsrc = Tcl_GetUnicodeFromObj(objv[0], &slen);
   609         -	wstring = Tcl_GetUnicodeFromObj(objv[1], &wlen);
   610         -	wsubspec = Tcl_GetUnicodeFromObj(objv[2], &wsublen);
          610  +	wsrc = TclGetUnicodeFromObj(objv[0], &slen);
          611  +	wstring = TclGetUnicodeFromObj(objv[1], &wlen);
          612  +	wsubspec = TclGetUnicodeFromObj(objv[2], &wsublen);
   611    613   	wend = wstring + wlen - (slen ? slen - 1 : 0);
   612    614   	result = TCL_OK;
   613    615   
   614    616   	if (slen == 0) {
   615    617   	    /*
   616    618   	     * regsub behavior for "" matches between each character. 'string
   617    619   	     * map' skips the "" case.
................................................................................
   629    631   	    }
   630    632   	} else {
   631    633   	    wsrclc = Tcl_UniCharToLower(*wsrc);
   632    634   	    for (p = wfirstChar = wstring; wstring < wend; wstring++) {
   633    635   		if ((*wstring == *wsrc ||
   634    636   			(nocase && Tcl_UniCharToLower(*wstring)==wsrclc)) &&
   635    637   			(slen==1 || (strCmpFn(wstring, wsrc,
   636         -				(unsigned long) slen) == 0))) {
          638  +				(size_t)slen) == 0))) {
   637    639   		    if (numMatches == 0) {
   638    640   			resultPtr = Tcl_NewUnicodeObj(wstring, 0);
   639    641   			Tcl_IncrRefCount(resultPtr);
   640    642   		    }
   641    643   		    if (p != wstring) {
   642    644   			Tcl_AppendUnicodeToObj(resultPtr, p, wstring - p);
   643    645   			p = wstring + slen;
................................................................................
   694    696        */
   695    697   
   696    698       if (objv[1] == objv[0]) {
   697    699   	objPtr = Tcl_DuplicateObj(objv[1]);
   698    700       } else {
   699    701   	objPtr = objv[1];
   700    702       }
   701         -    wstring = Tcl_GetUnicodeFromObj(objPtr, &wlen);
          703  +    wstring = TclGetUnicodeFromObj(objPtr, &wlen);
   702    704       if (objv[2] == objv[0]) {
   703    705   	subPtr = Tcl_DuplicateObj(objv[2]);
   704    706       } else {
   705    707   	subPtr = objv[2];
   706    708       }
   707    709       if (!command) {
   708         -	wsubspec = Tcl_GetUnicodeFromObj(subPtr, &wsublen);
          710  +	wsubspec = TclGetUnicodeFromObj(subPtr, &wsublen);
   709    711       }
   710    712   
   711    713       result = TCL_OK;
   712    714   
   713    715       /*
   714    716        * The following loop is to handle multiple matches within the same source
   715    717        * string; each iteration handles one match and its corresponding
................................................................................
   717    719        * gets executed once. We must use 'offset <= wlen' in particular for the
   718    720        * case where the regexp pattern can match the empty string - this is
   719    721        * useful when doing, say, 'regsub -- ^ $str ...' when $str might be
   720    722        * empty.
   721    723        */
   722    724   
   723    725       numMatches = 0;
   724         -    for ( ; offset <= wlen; ) {
          726  +    for ( ; (size_t)offset <= wlen; ) {
   725    727   
   726    728   	/*
   727    729   	 * The flags argument is set if string is part of a larger string, so
   728    730   	 * that "^" won't match.
   729    731   	 */
   730    732   
   731    733   	match = Tcl_RegExpExecObj(interp, regExpr, objPtr, offset,
................................................................................
   773    775   
   774    776   	if (command) {
   775    777   	    Tcl_Obj **args = NULL, **parts;
   776    778   	    int numArgs;
   777    779   
   778    780   	    Tcl_ListObjGetElements(interp, subPtr, &numParts, &parts);
   779    781   	    numArgs = numParts + info.nsubs + 1;
   780         -	    args = ckalloc(sizeof(Tcl_Obj*) * numArgs);
          782  +	    args = Tcl_Alloc(sizeof(Tcl_Obj*) * numArgs);
   781    783   	    memcpy(args, parts, sizeof(Tcl_Obj*) * numParts);
   782    784   
   783    785   	    for (idx = 0 ; idx <= info.nsubs ; idx++) {
   784    786   		subStart = info.matches[idx].start;
   785    787   		subEnd = info.matches[idx].end;
   786    788   		if ((subStart >= 0) && (subEnd >= 0)) {
   787    789   		    args[idx + numParts] = Tcl_NewUnicodeObj(
................................................................................
   803    805   	     * afterwards; subPtr is handled in the main exit stanza.
   804    806   	     */
   805    807   
   806    808   	    result = Tcl_EvalObjv(interp, numArgs, args, 0);
   807    809   	    for (idx = 0 ; idx <= info.nsubs ; idx++) {
   808    810   		TclDecrRefCount(args[idx + numParts]);
   809    811   	    }
   810         -	    ckfree(args);
          812  +	    Tcl_Free(args);
   811    813   	    if (result != TCL_OK) {
   812    814   		if (result == TCL_ERROR) {
   813    815   		    Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
   814    816   			    "\n    (%s substitution computation script)",
   815    817   			    options[REGSUB_COMMAND]));
   816    818   		}
   817    819   		goto done;
................................................................................
   821    823   	    Tcl_ResetResult(interp);
   822    824   
   823    825   	    /*
   824    826   	     * Refetch the unicode, in case the representation was smashed by
   825    827   	     * the user code.
   826    828   	     */
   827    829   
   828         -	    wstring = Tcl_GetUnicodeFromObj(objPtr, &wlen);
          830  +	    wstring = TclGetUnicodeFromObj(objPtr, &wlen);
   829    831   
   830    832   	    offset += end;
   831    833   	    if (end == 0 || start == end) {
   832    834   		/*
   833    835   		 * Always consume at least one character of the input string
   834    836   		 * in order to prevent infinite loops, even when we
   835    837   		 * technically matched the empty string; we must not match
   836    838   		 * again at the same spot.
   837    839   		 */
   838    840   
   839         -		if (offset < wlen) {
          841  +		if ((size_t)offset < wlen) {
   840    842   		    Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, 1);
   841    843   		}
   842    844   		offset++;
   843    845   	    }
   844    846   	    if (all) {
   845    847   		continue;
   846    848   	    } else {
................................................................................
   905    907   
   906    908   	if (end == 0) {
   907    909   	    /*
   908    910   	     * Always consume at least one character of the input string in
   909    911   	     * order to prevent infinite loops.
   910    912   	     */
   911    913   
   912         -	    if (offset < wlen) {
          914  +	    if ((size_t)offset < wlen) {
   913    915   		Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, 1);
   914    916   	    }
   915    917   	    offset++;
   916    918   	} else {
   917    919   	    offset += end;
   918    920   	    if (start == end) {
   919    921   		/*
   920    922   		 * We matched an empty string, which means we must go forward
   921    923   		 * one more step so we don't match again at the same spot.
   922    924   		 */
   923    925   
   924         -		if (offset < wlen) {
          926  +		if ((size_t)offset < wlen) {
   925    927   		    Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, 1);
   926    928   		}
   927    929   		offset++;
   928    930   	    }
   929    931   	}
   930    932   	if (!all) {
   931    933   	    break;
................................................................................
   942    944   	/*
   943    945   	 * On zero matches, just ignore the offset, since it shouldn't matter
   944    946   	 * to us in this case, and the user may have skewed it.
   945    947   	 */
   946    948   
   947    949   	resultPtr = objv[1];
   948    950   	Tcl_IncrRefCount(resultPtr);
   949         -    } else if (offset < wlen) {
          951  +    } else if ((size_t)offset < wlen) {
   950    952   	Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, wlen - offset);
   951    953       }
   952    954       if (objc == 4) {
   953    955   	if (Tcl_ObjSetVar2(interp, objv[3], NULL, resultPtr,
   954    956   		TCL_LEAVE_ERR_MSG) == NULL) {
   955    957   	    result = TCL_ERROR;
   956    958   	} else {
................................................................................
  1174   1176       Tcl_Obj *const objv[])	/* Argument objects. */
  1175   1177   {
  1176   1178       Tcl_UniChar ch = 0;
  1177   1179       int len;
  1178   1180       const char *splitChars;
  1179   1181       const char *stringPtr;
  1180   1182       const char *end;
  1181         -    int splitCharLen, stringLen;
         1183  +    size_t splitCharLen, stringLen;
  1182   1184       Tcl_Obj *listPtr, *objPtr;
  1183   1185   
  1184   1186       if (objc == 2) {
  1185   1187   	splitChars = " \n\t\r";
  1186   1188   	splitCharLen = 4;
  1187   1189       } else if (objc == 3) {
  1188   1190   	splitChars = TclGetStringFromObj(objv[2], &splitCharLen);
................................................................................
  1253   1255   
  1254   1256   	/*
  1255   1257   	 * Handle the special case of splitting on a single character. This is
  1256   1258   	 * only true for the one-char ASCII case, as one unicode char is > 1
  1257   1259   	 * byte in length.
  1258   1260   	 */
  1259   1261   
  1260         -	while (*stringPtr && (p=strchr(stringPtr,(int)*splitChars)) != NULL) {
         1262  +	while (*stringPtr && (p=strchr(stringPtr,*splitChars)) != NULL) {
  1261   1263   	    objPtr = Tcl_NewStringObj(stringPtr, p - stringPtr);
  1262   1264   	    Tcl_ListObjAppendElement(NULL, listPtr, objPtr);
  1263   1265   	    stringPtr = p + 1;
  1264   1266   	}
  1265   1267   	TclNewStringObj(objPtr, stringPtr, end - stringPtr);
  1266   1268   	Tcl_ListObjAppendElement(NULL, listPtr, objPtr);
  1267   1269       } else {
................................................................................
  1332   1334       if (objc == 4) {
  1333   1335   	int size = Tcl_GetCharLength(objv[2]);
  1334   1336   
  1335   1337   	if (TCL_OK != TclGetIntForIndexM(interp, objv[3], size - 1, &start)) {
  1336   1338   	    return TCL_ERROR;
  1337   1339   	}
  1338   1340       }
  1339         -    Tcl_SetObjResult(interp, Tcl_NewIntObj(TclStringFirst(objv[1],
         1341  +    Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclStringFirst(objv[1],
  1340   1342   	    objv[2], start)));
  1341   1343       return TCL_OK;
  1342   1344   }
  1343   1345   
  1344   1346   /*
  1345   1347    *----------------------------------------------------------------------
  1346   1348    *
................................................................................
  1480   1482       Tcl_Interp *interp,		/* Current interpreter. */
  1481   1483       int objc,			/* Number of arguments. */
  1482   1484       Tcl_Obj *const objv[])	/* Argument objects. */
  1483   1485   {
  1484   1486       const char *string1, *end, *stop;
  1485   1487       Tcl_UniChar ch = 0;
  1486   1488       int (*chcomp)(int) = NULL;	/* The UniChar comparison function. */
  1487         -    int i, failat = 0, result = 1, strict = 0, index, length1, length2;
         1489  +    int i, failat = 0, result = 1, strict = 0, index, length3;
         1490  +    size_t length1, length2;
  1488   1491       Tcl_Obj *objPtr, *failVarObj = NULL;
  1489   1492       Tcl_WideInt w;
  1490   1493   
  1491   1494       static const char *const isClasses[] = {
  1492   1495   	"alnum",	"alpha",	"ascii",	"control",
  1493   1496   	"boolean",	"digit",	"double",	"entier",
  1494   1497   	"false",	"graph",	"integer",	"list",
................................................................................
  1722   1725   	break;
  1723   1726       case STR_IS_LIST:
  1724   1727   	/*
  1725   1728   	 * We ignore the strictness here, since empty strings are always
  1726   1729   	 * well-formed lists.
  1727   1730   	 */
  1728   1731   
  1729         -	if (TCL_OK == TclListObjLength(NULL, objPtr, &length2)) {
         1732  +	if (TCL_OK == TclListObjLength(NULL, objPtr, &length3)) {
  1730   1733   	    break;
  1731   1734   	}
  1732   1735   
  1733   1736   	if (failVarObj != NULL) {
  1734   1737   	    /*
  1735   1738   	     * Need to figure out where the list parsing failed, which is
  1736   1739   	     * fairly expensive. This is adapted from the core of
  1737   1740   	     * SetListFromAny().
  1738   1741   	     */
  1739   1742   
  1740   1743   	    const char *elemStart, *nextElem;
  1741         -	    int lenRemain, elemSize;
         1744  +	    size_t lenRemain;
         1745  +	    size_t elemSize;
  1742   1746   	    register const char *p;
  1743   1747   
  1744   1748   	    string1 = TclGetStringFromObj(objPtr, &length1);
  1745   1749   	    end = string1 + length1;
  1746   1750   	    failat = -1;
  1747   1751   	    for (p=string1, lenRemain=length1; lenRemain > 0;
  1748   1752   		    p=nextElem, lenRemain=end-nextElem) {
................................................................................
  1871   1875   static int
  1872   1876   StringMapCmd(
  1873   1877       ClientData dummy,		/* Not used. */
  1874   1878       Tcl_Interp *interp,		/* Current interpreter. */
  1875   1879       int objc,			/* Number of arguments. */
  1876   1880       Tcl_Obj *const objv[])	/* Argument objects. */
  1877   1881   {
  1878         -    int length1, length2, mapElemc, index;
         1882  +    size_t length1, length2;
         1883  +    int mapElemc, index;
  1879   1884       int nocase = 0, mapWithDict = 0, copySource = 0;
  1880   1885       Tcl_Obj **mapElemv, *sourceObj, *resultPtr;
  1881   1886       Tcl_UniChar *ustring1, *ustring2, *p, *end;
  1882         -    int (*strCmpFn)(const Tcl_UniChar*, const Tcl_UniChar*, unsigned long);
         1887  +    int (*strCmpFn)(const Tcl_UniChar*, const Tcl_UniChar*, size_t);
  1883   1888   
  1884   1889       if (objc < 3 || objc > 4) {
  1885   1890   	Tcl_WrongNumArgs(interp, 1, objv, "?-nocase? charMap string");
  1886   1891   	return TCL_ERROR;
  1887   1892       }
  1888   1893   
  1889   1894       if (objc == 4) {
................................................................................
  1972   1977   
  1973   1978       if (objv[objc-2] == objv[objc-1]) {
  1974   1979   	sourceObj = Tcl_DuplicateObj(objv[objc-1]);
  1975   1980   	copySource = 1;
  1976   1981       } else {
  1977   1982   	sourceObj = objv[objc-1];
  1978   1983       }
  1979         -    ustring1 = Tcl_GetUnicodeFromObj(sourceObj, &length1);
         1984  +    ustring1 = TclGetUnicodeFromObj(sourceObj, &length1);
  1980   1985       if (length1 == 0) {
  1981   1986   	/*
  1982   1987   	 * Empty input string, just stop now.
  1983   1988   	 */
  1984   1989   
  1985   1990   	goto done;
  1986   1991       }
................................................................................
  1998   2003   	/*
  1999   2004   	 * Special case for one map pair which avoids the extra for loop and
  2000   2005   	 * extra calls to get Unicode data. The algorithm is otherwise
  2001   2006   	 * identical to the multi-pair case. This will be >30% faster on
  2002   2007   	 * larger strings.
  2003   2008   	 */
  2004   2009   
  2005         -	int mapLen, u2lc;
         2010  +	size_t mapLen;
         2011  +	int u2lc;
  2006   2012   	Tcl_UniChar *mapString;
  2007   2013   
  2008         -	ustring2 = Tcl_GetUnicodeFromObj(mapElemv[0], &length2);
         2014  +	ustring2 = TclGetUnicodeFromObj(mapElemv[0], &length2);
  2009   2015   	p = ustring1;
  2010   2016   	if ((length2 > length1) || (length2 == 0)) {
  2011   2017   	    /*
  2012   2018   	     * Match string is either longer than input or empty.
  2013   2019   	     */
  2014   2020   
  2015   2021   	    ustring1 = end;
  2016   2022   	} else {
  2017         -	    mapString = Tcl_GetUnicodeFromObj(mapElemv[1], &mapLen);
         2023  +	    mapString = TclGetUnicodeFromObj(mapElemv[1], &mapLen);
  2018   2024   	    u2lc = (nocase ? Tcl_UniCharToLower(*ustring2) : 0);
  2019   2025   	    for (; ustring1 < end; ustring1++) {
  2020   2026   		if (((*ustring1 == *ustring2) ||
  2021   2027   			(nocase&&Tcl_UniCharToLower(*ustring1)==u2lc)) &&
  2022   2028   			(length2==1 || strCmpFn(ustring1, ustring2,
  2023         -				(unsigned long) length2) == 0)) {
         2029  +				length2) == 0)) {
  2024   2030   		    if (p != ustring1) {
  2025   2031   			Tcl_AppendUnicodeToObj(resultPtr, p, ustring1-p);
  2026   2032   			p = ustring1 + length2;
  2027   2033   		    } else {
  2028   2034   			p += length2;
  2029   2035   		    }
  2030   2036   		    ustring1 = p - 1;
................................................................................
  2031   2037   
  2032   2038   		    Tcl_AppendUnicodeToObj(resultPtr, mapString, mapLen);
  2033   2039   		}
  2034   2040   	    }
  2035   2041   	}
  2036   2042       } else {
  2037   2043   	Tcl_UniChar **mapStrings;
  2038         -	int *mapLens, *u2lc = NULL;
         2044  +	size_t *mapLens;
         2045  +	int *u2lc = 0;
  2039   2046   
  2040   2047   	/*
  2041   2048   	 * Precompute pointers to the unicode string and length. This saves us
  2042   2049   	 * repeated function calls later, significantly speeding up the
  2043   2050   	 * algorithm. We only need the lowercase first char in the nocase
  2044   2051   	 * case.
  2045   2052   	 */
  2046   2053   
  2047         -	mapStrings = TclStackAlloc(interp, mapElemc*2*sizeof(Tcl_UniChar *));
  2048         -	mapLens = TclStackAlloc(interp, mapElemc * 2 * sizeof(int));
         2054  +	mapStrings = TclStackAlloc(interp, mapElemc*sizeof(Tcl_UniChar *)*2);
         2055  +	mapLens = TclStackAlloc(interp, mapElemc * sizeof(size_t) * 2);
  2049   2056   	if (nocase) {
  2050   2057   	    u2lc = TclStackAlloc(interp, mapElemc * sizeof(int));
  2051   2058   	}
  2052   2059   	for (index = 0; index < mapElemc; index++) {
  2053         -	    mapStrings[index] = Tcl_GetUnicodeFromObj(mapElemv[index],
         2060  +	    mapStrings[index] = TclGetUnicodeFromObj(mapElemv[index],
  2054   2061   		    mapLens+index);
  2055   2062   	    if (nocase && ((index % 2) == 0)) {
  2056   2063   		u2lc[index/2] = Tcl_UniCharToLower(*mapStrings[index]);
  2057   2064   	    }
  2058   2065   	}
  2059   2066   	for (p = ustring1; ustring1 < end; ustring1++) {
  2060   2067   	    for (index = 0; index < mapElemc; index += 2) {
................................................................................
  2063   2070   		 */
  2064   2071   
  2065   2072   		ustring2 = mapStrings[index];
  2066   2073   		length2 = mapLens[index];
  2067   2074   		if ((length2 > 0) && ((*ustring1 == *ustring2) || (nocase &&
  2068   2075   			(Tcl_UniCharToLower(*ustring1) == u2lc[index/2]))) &&
  2069   2076   			/* Restrict max compare length. */
  2070         -			(end-ustring1 >= length2) && ((length2 == 1) ||
  2071         -			!strCmpFn(ustring2, ustring1, (unsigned) length2))) {
         2077  +			((size_t)(end-ustring1) >= length2) && ((length2 == 1) ||
         2078  +			!strCmpFn(ustring2, ustring1, length2))) {
  2072   2079   		    if (p != ustring1) {
  2073   2080   			/*
  2074   2081   			 * Put the skipped chars onto the result first.
  2075   2082   			 */
  2076   2083   
  2077   2084   			Tcl_AppendUnicodeToObj(resultPtr, p, ustring1-p);
  2078   2085   			p = ustring1 + length2;
................................................................................
  2149   2156   
  2150   2157       if (objc < 3 || objc > 4) {
  2151   2158   	Tcl_WrongNumArgs(interp, 1, objv, "?-nocase? pattern string");
  2152   2159   	return TCL_ERROR;
  2153   2160       }
  2154   2161   
  2155   2162       if (objc == 4) {
  2156         -	int length;
         2163  +	size_t length;
  2157   2164   	const char *string = TclGetStringFromObj(objv[1], &length);
  2158   2165   
  2159   2166   	if ((length > 1) &&
  2160         -	    strncmp(string, "-nocase", (size_t) length) == 0) {
         2167  +	    strncmp(string, "-nocase", length) == 0) {
  2161   2168   	    nocase = TCL_MATCH_NOCASE;
  2162   2169   	} else {
  2163   2170   	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
  2164   2171   		    "bad option \"%s\": must be -nocase", string));
  2165   2172   	    Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "option",
  2166   2173   		    string, NULL);
  2167   2174   	    return TCL_ERROR;
................................................................................
  2193   2200   static int
  2194   2201   StringRangeCmd(
  2195   2202       ClientData dummy,		/* Not used. */
  2196   2203       Tcl_Interp *interp,		/* Current interpreter. */
  2197   2204       int objc,			/* Number of arguments. */
  2198   2205       Tcl_Obj *const objv[])	/* Argument objects. */
  2199   2206   {
  2200         -    int length, first, last;
         2207  +    size_t length;
         2208  +    int first, last;
  2201   2209   
  2202   2210       if (objc != 4) {
  2203   2211   	Tcl_WrongNumArgs(interp, 1, objv, "string first last");
  2204   2212   	return TCL_ERROR;
  2205   2213       }
  2206   2214   
  2207   2215       /*
................................................................................
  2215   2223   	    TclGetIntForIndexM(interp, objv[3], length, &last) != TCL_OK) {
  2216   2224   	return TCL_ERROR;
  2217   2225       }
  2218   2226   
  2219   2227       if (first < 0) {
  2220   2228   	first = 0;
  2221   2229       }
  2222         -    if (last >= length) {
         2230  +    if (last >= (int)length) {
  2223   2231   	last = length;
  2224   2232       }
  2225   2233       if (last >= first) {
  2226   2234   	Tcl_SetObjResult(interp, Tcl_GetRange(objv[1], first, last));
  2227   2235       }
  2228   2236       return TCL_OK;
  2229   2237   }
................................................................................
  2789   2797       Tcl_Obj *const objv[])	/* Argument objects. */
  2790   2798   {
  2791   2799       if (objc != 2) {
  2792   2800   	Tcl_WrongNumArgs(interp, 1, objv, "string");
  2793   2801   	return TCL_ERROR;
  2794   2802       }
  2795   2803   
  2796         -    Tcl_SetObjResult(interp, Tcl_NewIntObj(Tcl_GetCharLength(objv[1])));
         2804  +    Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tcl_GetCharLength(objv[1])));
  2797   2805       return TCL_OK;
  2798   2806   }
  2799   2807   
  2800   2808   /*
  2801   2809    *----------------------------------------------------------------------
  2802   2810    *
  2803   2811    * StringLowerCmd --
................................................................................
  3074   3082   StringTrimCmd(
  3075   3083       ClientData dummy,		/* Not used. */
  3076   3084       Tcl_Interp *interp,		/* Current interpreter. */
  3077   3085       int objc,			/* Number of arguments. */
  3078   3086       Tcl_Obj *const objv[])	/* Argument objects. */
  3079   3087   {
  3080   3088       const char *string1, *string2;
  3081         -    int triml, trimr, length1, length2;
         3089  +    size_t triml, trimr, length1, length2;
  3082   3090   
  3083   3091       if (objc == 3) {
  3084   3092   	string2 = TclGetStringFromObj(objv[2], &length2);
  3085   3093       } else if (objc == 2) {
  3086   3094   	string2 = tclDefaultTrimSet;
  3087   3095   	length2 = strlen(tclDefaultTrimSet);
  3088   3096       } else {
................................................................................
  3773   3781   	     * own.
  3774   3782   	     */
  3775   3783   	}
  3776   3784   
  3777   3785   	if (ctxPtr->type == TCL_LOCATION_SOURCE && ctxPtr->line[bidx] >= 0) {
  3778   3786   	    int bline = ctxPtr->line[bidx];
  3779   3787   
  3780         -	    ctxPtr->line = ckalloc(objc * sizeof(int));
         3788  +	    ctxPtr->line = Tcl_Alloc(objc * sizeof(int));
  3781   3789   	    ctxPtr->nline = objc;
  3782   3790   	    TclListLines(blist, bline, objc, ctxPtr->line, objv);
  3783   3791   	} else {
  3784   3792   	    /*
  3785   3793   	     * This is either a dynamic code word, when all elements are
  3786   3794   	     * relative to themselves, or something else less expected and
  3787   3795   	     * where we have no information. The result is the same in both
  3788   3796   	     * cases; tell the code to come that it doesn't know where it is,
  3789   3797   	     * which triggers reversion to the old behavior.
  3790   3798   	     */
  3791   3799   
  3792   3800   	    int k;
  3793   3801   
  3794         -	    ctxPtr->line = ckalloc(objc * sizeof(int));
         3802  +	    ctxPtr->line = Tcl_Alloc(objc * sizeof(int));
  3795   3803   	    ctxPtr->nline = objc;
  3796   3804   	    for (k=0; k < objc; k++) {
  3797   3805   		ctxPtr->line[k] = -1;
  3798   3806   	    }
  3799   3807   	}
  3800   3808       }
  3801   3809   
................................................................................
  3837   3845       int patternLength = strlen(pattern);
  3838   3846   
  3839   3847       /*
  3840   3848        * Clean up TIP 280 context information
  3841   3849        */
  3842   3850   
  3843   3851       if (splitObjs) {
  3844         -	ckfree(ctxPtr->line);
         3852  +	Tcl_Free(ctxPtr->line);
  3845   3853   	if (pc && (ctxPtr->type == TCL_LOCATION_SOURCE)) {
  3846   3854   	    /*
  3847   3855   	     * Death of SrcInfo reference.
  3848   3856   	     */
  3849   3857   
  3850   3858   	    Tcl_DecrRefCount(ctxPtr->data.eval.path);
  3851   3859   	}
................................................................................
  4001   4009   #endif
  4002   4010   
  4003   4011       if (count <= 1) {
  4004   4012   	/*
  4005   4013   	 * Use int obj since we know time is not fractional. [Bug 1202178]
  4006   4014   	 */
  4007   4015   
  4008         -	objs[0] = Tcl_NewIntObj((count <= 0) ? 0 : (int) totalMicroSec);
         4016  +	objs[0] = Tcl_NewLongObj((count <= 0) ? 0 : totalMicroSec);
  4009   4017       } else {
  4010   4018   	objs[0] = Tcl_NewDoubleObj(totalMicroSec/count);
  4011   4019       }
  4012   4020   
  4013   4021       /*
  4014   4022        * Construct the result as a list because many programs have always parsed
  4015   4023        * as such (extracting the first element, typically).

Changes to generic/tclCompCmds.c.

   399    399       /*
   400    400        * Prepare for the internal foreach.
   401    401        */
   402    402   
   403    403       keyVar = AnonymousLocal(envPtr);
   404    404       valVar = AnonymousLocal(envPtr);
   405    405   
   406         -    infoPtr = ckalloc(sizeof(ForeachInfo));
          406  +    infoPtr = Tcl_Alloc(sizeof(ForeachInfo));
   407    407       infoPtr->numLists = 1;
   408         -    infoPtr->varLists[0] = ckalloc(sizeof(ForeachVarList) + sizeof(int));
          408  +    infoPtr->varLists[0] = Tcl_Alloc(sizeof(ForeachVarList) + sizeof(int));
   409    409       infoPtr->varLists[0]->numVars = 2;
   410    410       infoPtr->varLists[0]->varIndexes[0] = keyVar;
   411    411       infoPtr->varLists[0]->varIndexes[1] = valVar;
   412    412       infoIndex = TclCreateAuxData(infoPtr, &newForeachInfoType, envPtr);
   413    413   
   414    414       /*
   415    415        * Start issuing instructions to write to the array.
................................................................................
   697    697       /* Stack at this point is empty */
   698    698       TclEmitOpcode(		INST_PUSH_RESULT,		envPtr);
   699    699       TclEmitOpcode(		INST_PUSH_RETURN_CODE,		envPtr);
   700    700   
   701    701       /* Stack at this point on both branches: result returnCode */
   702    702   
   703    703       if (TclFixupForwardJumpToHere(envPtr, &jumpFixup, 127)) {
   704         -	Tcl_Panic("TclCompileCatchCmd: bad jump distance %d",
   705         -		(int)(CurrentOffset(envPtr) - jumpFixup.codeOffset));
          704  +	Tcl_Panic("TclCompileCatchCmd: bad jump distance %" TCL_Z_MODIFIER "d",
          705  +		(CurrentOffset(envPtr) - jumpFixup.codeOffset));
   706    706       }
   707    707   
   708    708       /*
   709    709        * Push the return options if the caller wants them. This needs to happen
   710    710        * before INST_END_CATCH
   711    711        */
   712    712   
................................................................................
  1092   1092   
  1093   1093       /*
  1094   1094        * Parse the increment amount, if present.
  1095   1095        */
  1096   1096   
  1097   1097       if (parsePtr->numWords == 4) {
  1098   1098   	const char *word;
  1099         -	int numBytes, code;
         1099  +	size_t numBytes;
         1100  +	int code;
  1100   1101   	Tcl_Token *incrTokenPtr;
  1101   1102   	Tcl_Obj *intObj;
  1102   1103   
  1103   1104   	incrTokenPtr = TokenAfter(keyTokenPtr);
  1104   1105   	if (incrTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
  1105   1106   	    return TclCompileBasic2Or3ArgCmd(interp, parsePtr,cmdPtr, envPtr);
  1106   1107   	}
................................................................................
  1559   1560       if (Tcl_SplitList(NULL, Tcl_DStringValue(&buffer), &numVars,
  1560   1561   	    &argv) != TCL_OK) {
  1561   1562   	Tcl_DStringFree(&buffer);
  1562   1563   	return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr);
  1563   1564       }
  1564   1565       Tcl_DStringFree(&buffer);
  1565   1566       if (numVars != 2) {
  1566         -	ckfree(argv);
         1567  +	Tcl_Free(argv);
  1567   1568   	return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr);
  1568   1569       }
  1569   1570   
  1570   1571       nameChars = strlen(argv[0]);
  1571   1572       keyVarIndex = LocalScalar(argv[0], nameChars, envPtr);
  1572   1573       nameChars = strlen(argv[1]);
  1573   1574       valueVarIndex = LocalScalar(argv[1], nameChars, envPtr);
  1574         -    ckfree(argv);
         1575  +    Tcl_Free(argv);
  1575   1576   
  1576   1577       if ((keyVarIndex < 0) || (valueVarIndex < 0)) {
  1577   1578   	return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr);
  1578   1579       }
  1579   1580   
  1580   1581       /*
  1581   1582        * Allocate a temporary variable to store the iterator reference. The
................................................................................
  1775   1776   
  1776   1777       /*
  1777   1778        * Assemble the instruction metadata. This is complex enough that it is
  1778   1779        * represented as auxData; it holds an ordered list of variable indices
  1779   1780        * that are to be used.
  1780   1781        */
  1781   1782   
  1782         -    duiPtr = ckalloc(sizeof(DictUpdateInfo) + sizeof(int) * (numVars - 1));
         1783  +    duiPtr = Tcl_Alloc(sizeof(DictUpdateInfo) + sizeof(int) * (numVars - 1));
  1783   1784       duiPtr->length = numVars;
  1784   1785       keyTokenPtrs = TclStackAlloc(interp, sizeof(Tcl_Token *) * numVars);
  1785   1786       tokenPtr = TokenAfter(dictVarTokenPtr);
  1786   1787   
  1787   1788       for (i=0 ; i<numVars ; i++) {
  1788   1789   	/*
  1789   1790   	 * Put keys to one side for later compilation to bytecode.
................................................................................
  1858   1859       TclEmitInstInt4(	INST_REVERSE, 3,			envPtr);
  1859   1860   
  1860   1861       TclEmitInstInt4(	INST_DICT_UPDATE_END, dictIndex,	envPtr);
  1861   1862       TclEmitInt4(		infoIndex,			envPtr);
  1862   1863       TclEmitInvoke(envPtr,INST_RETURN_STK);
  1863   1864   
  1864   1865       if (TclFixupForwardJumpToHere(envPtr, &jumpFixup, 127)) {
  1865         -	Tcl_Panic("TclCompileDictCmd(update): bad jump distance %d",
  1866         -		(int) (CurrentOffset(envPtr) - jumpFixup.codeOffset));
         1866  +	Tcl_Panic("TclCompileDictCmd(update): bad jump distance %" TCL_Z_MODIFIER "d",
         1867  +		CurrentOffset(envPtr) - jumpFixup.codeOffset);
  1867   1868       }
  1868   1869       TclStackFree(interp, keyTokenPtrs);
  1869   1870       return TCL_OK;
  1870   1871   
  1871   1872       /*
  1872   1873        * Clean up after a failure to create the DictUpdateInfo structure.
  1873   1874        */
  1874   1875   
  1875   1876     failedUpdateInfoAssembly:
  1876         -    ckfree(duiPtr);
         1877  +    Tcl_Free(duiPtr);
  1877   1878       TclStackFree(interp, keyTokenPtrs);
  1878   1879     issueFallback:
  1879   1880       return TclCompileBasicMin2ArgCmd(interp, parsePtr, cmdPtr, envPtr);
  1880   1881   }
  1881   1882   
  1882   1883   int
  1883   1884   TclCompileDictAppendCmd(
................................................................................
  2220   2221       TclEmitInvoke(envPtr,	INST_RETURN_STK);
  2221   2222   
  2222   2223       /*
  2223   2224        * Prepare for the start of the next command.
  2224   2225        */
  2225   2226   
  2226   2227       if (TclFixupForwardJumpToHere(envPtr, &jumpFixup, 127)) {
  2227         -	Tcl_Panic("TclCompileDictCmd(update): bad jump distance %d",
  2228         -		(int) (CurrentOffset(envPtr) - jumpFixup.codeOffset));
         2228  +	Tcl_Panic("TclCompileDictCmd(update): bad jump distance %" TCL_Z_MODIFIER "d",
         2229  +		CurrentOffset(envPtr) - jumpFixup.codeOffset);
  2229   2230       }
  2230   2231       return TCL_OK;
  2231   2232   }
  2232   2233   
  2233   2234   /*
  2234   2235    *----------------------------------------------------------------------
  2235   2236    *
................................................................................
  2258   2259       ClientData clientData)
  2259   2260   {
  2260   2261       DictUpdateInfo *dui1Ptr, *dui2Ptr;
  2261   2262       unsigned len;
  2262   2263   
  2263   2264       dui1Ptr = clientData;
  2264   2265       len = sizeof(DictUpdateInfo) + sizeof(int) * (dui1Ptr->length - 1);
  2265         -    dui2Ptr = ckalloc(len);
         2266  +    dui2Ptr = Tcl_Alloc(len);
  2266   2267       memcpy(dui2Ptr, dui1Ptr, len);
  2267   2268       return dui2Ptr;
  2268   2269   }
  2269   2270   
  2270   2271   static void
  2271   2272   FreeDictUpdateInfo(
  2272   2273       ClientData clientData)
  2273   2274   {
  2274         -    ckfree(clientData);
         2275  +    Tcl_Free(clientData);
  2275   2276   }
  2276   2277   
  2277   2278   static void
  2278   2279   PrintDictUpdateInfo(
  2279   2280       ClientData clientData,
  2280   2281       Tcl_Obj *appendObj,
  2281   2282       ByteCode *codePtr,
  2282   2283       unsigned int pcOffset)
  2283   2284   {
  2284   2285       DictUpdateInfo *duiPtr = clientData;
  2285         -    int i;
         2286  +    size_t i;
  2286   2287   
  2287   2288       for (i=0 ; i<duiPtr->length ; i++) {
  2288   2289   	if (i) {
  2289   2290   	    Tcl_AppendToObj(appendObj, ", ", -1);
  2290   2291   	}
  2291   2292   	Tcl_AppendPrintfToObj(appendObj, "%%v%u", duiPtr->varIndices[i]);
  2292   2293       }
................................................................................
  2296   2297   DisassembleDictUpdateInfo(
  2297   2298       ClientData clientData,
  2298   2299       Tcl_Obj *dictObj,
  2299   2300       ByteCode *codePtr,
  2300   2301       unsigned int pcOffset)
  2301   2302   {
  2302   2303       DictUpdateInfo *duiPtr = clientData;
  2303         -    int i;
         2304  +    size_t i;
  2304   2305       Tcl_Obj *variables = Tcl_NewObj();
  2305   2306   
  2306   2307       for (i=0 ; i<duiPtr->length ; i++) {
  2307   2308   	Tcl_ListObjAppendElement(NULL, variables,
  2308   2309   		Tcl_NewIntObj(duiPtr->varIndices[i]));
  2309   2310       }
  2310   2311       Tcl_DictObjPut(NULL, dictObj, Tcl_NewStringObj("variables", -1),
................................................................................
  2711   2712       /*
  2712   2713        * Create and initialize the ForeachInfo and ForeachVarList data
  2713   2714        * structures describing this command. Then create a AuxData record
  2714   2715        * pointing to the ForeachInfo structure.
  2715   2716        */
  2716   2717   
  2717   2718       numLists = (numWords - 2)/2;
  2718         -    infoPtr = ckalloc(sizeof(ForeachInfo)
         2719  +    infoPtr = Tcl_Alloc(sizeof(ForeachInfo)
  2719   2720   	    + (numLists - 1) * sizeof(ForeachVarList *));
  2720   2721       infoPtr->numLists = 0;	/* Count this up as we go */
  2721   2722   
  2722   2723       /*
  2723   2724        * Parse each var list into sequence of var names.  Don't
  2724   2725        * compile the foreach inline if any var name needs substitutions or isn't
  2725   2726        * a scalar, or if any var list needs substitutions.
................................................................................
  2745   2746   	if (!TclWordKnownAtCompileTime(tokenPtr, varListObj) ||
  2746   2747   		TCL_OK != Tcl_ListObjLength(NULL, varListObj, &numVars) ||
  2747   2748   		numVars == 0) {
  2748   2749   	    code = TCL_ERROR;
  2749   2750   	    goto done;
  2750   2751   	}
  2751   2752   
  2752         -	varListPtr = ckalloc(sizeof(ForeachVarList)
         2753  +	varListPtr = Tcl_Alloc(sizeof(ForeachVarList)
  2753   2754   		+ (numVars - 1) * sizeof(int));
  2754   2755   	varListPtr->numVars = numVars;
  2755   2756   	infoPtr->varLists[i/2] = varListPtr;
  2756   2757   	infoPtr->numLists++;
  2757   2758   
  2758   2759   	for (j = 0;  j < numVars;  j++) {
  2759   2760   	    Tcl_Obj *varNameObj;
  2760   2761   	    const char *bytes;
  2761         -	    int numBytes, varIndex;
         2762  +	    int varIndex;
  2762   2763   
  2763   2764   	    Tcl_ListObjIndex(NULL, varListObj, j, &varNameObj);
  2764         -	    bytes = TclGetStringFromObj(varNameObj, &numBytes);
  2765         -	    varIndex = LocalScalar(bytes, numBytes, envPtr);
         2765  +	    bytes = TclGetString(varNameObj);
         2766  +	    varIndex = LocalScalar(bytes, varNameObj->length, envPtr);
  2766   2767   	    if (varIndex < 0) {
  2767   2768   		code = TCL_ERROR;
  2768   2769   		goto done;
  2769   2770   	    }
  2770   2771   	    varListPtr->varIndexes[j] = varIndex;
  2771   2772   	}
  2772   2773   	Tcl_SetObjLength(varListObj, 0);
................................................................................
  2881   2882   				 * data to duplicate. */
  2882   2883   {
  2883   2884       register ForeachInfo *srcPtr = clientData;
  2884   2885       ForeachInfo *dupPtr;
  2885   2886       register ForeachVarList *srcListPtr, *dupListPtr;
  2886   2887       int numVars, i, j, numLists = srcPtr->numLists;
  2887   2888   
  2888         -    dupPtr = ckalloc(sizeof(ForeachInfo)
         2889  +    dupPtr = Tcl_Alloc(sizeof(ForeachInfo)
  2889   2890   	    + numLists * sizeof(ForeachVarList *));
  2890   2891       dupPtr->numLists = numLists;
  2891   2892       dupPtr->firstValueTemp = srcPtr->firstValueTemp;
  2892   2893       dupPtr->loopCtTemp = srcPtr->loopCtTemp;
  2893   2894   
  2894   2895       for (i = 0;  i < numLists;  i++) {
  2895   2896   	srcListPtr = srcPtr->varLists[i];
  2896   2897   	numVars = srcListPtr->numVars;
  2897         -	dupListPtr = ckalloc(sizeof(ForeachVarList)
         2898  +	dupListPtr = Tcl_Alloc(sizeof(ForeachVarList)
  2898   2899   		+ numVars * sizeof(int));
  2899   2900   	dupListPtr->numVars = numVars;
  2900   2901   	for (j = 0;  j < numVars;  j++) {
  2901   2902   	    dupListPtr->varIndexes[j] =	srcListPtr->varIndexes[j];
  2902   2903   	}
  2903   2904   	dupPtr->varLists[i] = dupListPtr;
  2904   2905       }
................................................................................
  2932   2933       register ForeachInfo *infoPtr = clientData;
  2933   2934       register ForeachVarList *listPtr;
  2934   2935       int numLists = infoPtr->numLists;
  2935   2936       register int i;
  2936   2937   
  2937   2938       for (i = 0;  i < numLists;  i++) {
  2938   2939   	listPtr = infoPtr->varLists[i];
  2939         -	ckfree(listPtr);
         2940  +	Tcl_Free(listPtr);
  2940   2941       }
  2941         -    ckfree(infoPtr);
         2942  +    Tcl_Free(infoPtr);
  2942   2943   }
  2943   2944   
  2944   2945   /*
  2945   2946    *----------------------------------------------------------------------
  2946   2947    *
  2947   2948    * PrintForeachInfo, DisassembleForeachInfo --
  2948   2949    *
................................................................................
  3162   3163       Tcl_IncrRefCount(formatObj);
  3163   3164       tokenPtr = TokenAfter(tokenPtr);
  3164   3165       if (!TclWordKnownAtCompileTime(tokenPtr, formatObj)) {
  3165   3166   	Tcl_DecrRefCount(formatObj);
  3166   3167   	return TCL_ERROR;
  3167   3168       }
  3168   3169   
  3169         -    objv = ckalloc((parsePtr->numWords-2) * sizeof(Tcl_Obj *));
         3170  +    objv = Tcl_Alloc((parsePtr->numWords-2) * sizeof(Tcl_Obj *));
  3170   3171       for (i=0 ; i+2 < parsePtr->numWords ; i++) {
  3171   3172   	tokenPtr = TokenAfter(tokenPtr);
  3172   3173   	objv[i] = Tcl_NewObj();
  3173   3174   	Tcl_IncrRefCount(objv[i]);
  3174   3175   	if (!TclWordKnownAtCompileTime(tokenPtr, objv[i])) {
  3175   3176   	    goto checkForStringConcatCase;
  3176   3177   	}
................................................................................
  3182   3183        */
  3183   3184   
  3184   3185       tmpObj = Tcl_Format(interp, Tcl_GetString(formatObj),
  3185   3186   	    parsePtr->numWords-2, objv);
  3186   3187       for (; --i>=0 ;) {
  3187   3188   	Tcl_DecrRefCount(objv[i]);
  3188   3189       }
  3189         -    ckfree(objv);
         3190  +    Tcl_Free(objv);
  3190   3191       Tcl_DecrRefCount(formatObj);
  3191   3192       if (tmpObj == NULL) {
  3192   3193   	TclCompileSyntaxError(interp, envPtr);
  3193   3194   	return TCL_OK;
  3194   3195       }
  3195   3196   
  3196   3197       /*
................................................................................
  3212   3213        * First, get the state of the system relatively sensible (cleaning up
  3213   3214        * after our attempt to spot a literal).
  3214   3215        */
  3215   3216   
  3216   3217       for (; i>=0 ; i--) {
  3217   3218   	Tcl_DecrRefCount(objv[i]);
  3218   3219       }
  3219         -    ckfree(objv);
         3220  +    Tcl_Free(objv);
  3220   3221       tokenPtr = TokenAfter(parsePtr->tokenPtr);
  3221   3222       tokenPtr = TokenAfter(tokenPtr);
  3222   3223       i = 0;
  3223   3224   
  3224   3225       /*
  3225   3226        * Now scan through and check for non-%s and non-%% substitutions.
  3226   3227        */
................................................................................
  3354   3355       }
  3355   3356       return index;
  3356   3357   }
  3357   3358   
  3358   3359   int
  3359   3360   TclLocalScalar(
  3360   3361       const char *bytes,
  3361         -    int numBytes,
         3362  +    size_t numBytes,
  3362   3363       CompileEnv *envPtr)
  3363   3364   {
  3364   3365       Tcl_Token token[2] =        {{TCL_TOKEN_SIMPLE_WORD, NULL, 0, 1},
  3365   3366                                    {TCL_TOKEN_TEXT, NULL, 0, 0}};
  3366   3367   
  3367   3368       token[1].start = bytes;
  3368   3369       token[1].size = numBytes;
................................................................................
  3405   3406       CompileEnv *envPtr,		/* Holds resulting instructions. */
  3406   3407       int flags,			/* TCL_NO_LARGE_INDEX | TCL_NO_ELEMENT. */
  3407   3408       int *localIndexPtr,		/* Must not be NULL. */
  3408   3409       int *isScalarPtr)		/* Must not be NULL. */
  3409   3410   {
  3410   3411       register const char *p;
  3411   3412       const char *name, *elName;
  3412         -    register int i, n;
         3413  +    register size_t i, n;
  3413   3414       Tcl_Token *elemTokenPtr = NULL;
  3414         -    int nameChars, elNameChars, simpleVarName, localIndex;
         3415  +    size_t nameChars, elNameChars;
         3416  +    int simpleVarName, localIndex;
  3415   3417       int elemTokenCount = 0, allocedTokens = 0, removedParen = 0;
  3416   3418   
  3417   3419       /*
  3418   3420        * Decide if we can use a frame slot for the var/array name or if we need
  3419   3421        * to emit code to compute and push the name at runtime. We use a frame
  3420   3422        * slot (entry in the array of local vars) if we are compiling a procedure
  3421   3423        * body and if the name is simple text that does not include namespace
................................................................................
  3479   3481   		i < varTokenPtr[1].size; i++, p++) {
  3480   3482   	    if (*p == '(') {
  3481   3483   		simpleVarName = 1;
  3482   3484   		break;
  3483   3485   	    }
  3484   3486   	}
  3485   3487   	if (simpleVarName) {
  3486         -	    int remainingChars;
         3488  +	    size_t remainingChars;
  3487   3489   
  3488   3490   	    /*
  3489   3491   	     * Check the last token: if it is just ')', do not count it.
  3490   3492   	     * Otherwise, remove the ')' and flag so that it is restored at
  3491   3493   	     * the end.
  3492   3494   	     */
  3493   3495   

Changes to generic/tclCompCmdsGR.c.

   177    177   				 * test when its target PC is determined. */
   178    178       JumpFixupArray jumpEndFixupArray;
   179    179   				/* Used to fix the jump after each "then" body
   180    180   				 * to the end of the "if" when that PC is
   181    181   				 * determined. */
   182    182       Tcl_Token *tokenPtr, *testTokenPtr;
   183    183       int jumpIndex = 0;		/* Avoid compiler warning. */
   184         -    int jumpFalseDist, numWords, wordIdx, numBytes, j, code;
          184  +	size_t numBytes;
          185  +    int jumpFalseDist, numWords, wordIdx, j, code;
   185    186       const char *word;
   186    187       int realCond = 1;		/* Set to 0 for static conditions:
   187    188   				 * "if 0 {..}" */
   188    189       int boolVal;		/* Value of static condition. */
   189    190       int compileScripts = 1;
   190    191       DefineLineInformation;	/* TIP #280 */
   191    192   
................................................................................
   429    430   		jumpFalseDist += 3;
   430    431   		TclStoreInt1AtPtr(jumpFalseDist, (ifFalsePc + 1));
   431    432   	    } else if (opCode == INST_JUMP_FALSE4) {
   432    433   		jumpFalseDist = TclGetInt4AtPtr(ifFalsePc + 1);
   433    434   		jumpFalseDist += 3;
   434    435   		TclStoreInt4AtPtr(jumpFalseDist, (ifFalsePc + 1));
   435    436   	    } else {
   436         -		Tcl_Panic("TclCompileIfCmd: unexpected opcode \"%d\" updating ifFalse jump", (int) opCode);
          437  +		Tcl_Panic("TclCompileIfCmd: unexpected opcode \"%u\" updating ifFalse jump", opCode);
   437    438   	    }
   438    439   	}
   439    440       }
   440    441   
   441    442       /*
   442    443        * Free the jumpFixupArray array if malloc'ed storage was used.
   443    444        */
................................................................................
   495    496   
   496    497       haveImmValue = 0;
   497    498       immValue = 1;
   498    499       if (parsePtr->numWords == 3) {
   499    500   	incrTokenPtr = TokenAfter(varTokenPtr);
   500    501   	if (incrTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) {
   501    502   	    const char *word = incrTokenPtr[1].start;
   502         -	    int numBytes = incrTokenPtr[1].size;
          503  +	    size_t numBytes = incrTokenPtr[1].size;
   503    504   	    int code;
   504    505   	    Tcl_Obj *intObj = Tcl_NewStringObj(word, numBytes);
   505    506   
   506    507   	    Tcl_IncrRefCount(intObj);
   507    508   	    code = TclGetIntFromObj(NULL, intObj, &immValue);
   508    509   	    TclDecrRefCount(intObj);
   509    510   	    if ((code == TCL_OK) && (-127 <= immValue) && (immValue <= 127)) {
................................................................................
  2076   2077   				 * command. */
  2077   2078       Command *cmdPtr,		/* Points to defintion of command being
  2078   2079   				 * compiled. */
  2079   2080       CompileEnv *envPtr)		/* Holds the resulting instructions. */
  2080   2081   {
  2081   2082       Tcl_Token *varTokenPtr;	/* Pointer to the Tcl_Token representing the
  2082   2083   				 * parse of the RE or string. */
  2083         -    int i, len, nocase, exact, sawLast, simple;
         2084  +    size_t len;
         2085  +    int i, nocase, exact, sawLast, simple;
  2084   2086       const char *str;
  2085   2087       DefineLineInformation;	/* TIP #280 */
  2086   2088   
  2087   2089       /*
  2088   2090        * We are only interested in compiling simple regexp cases. Currently
  2089   2091        * supported compile cases are:
  2090   2092        *   regexp ?-nocase? ?--? staticString $var
................................................................................
  2629   2631   
  2630   2632   void
  2631   2633   TclCompileSyntaxError(
  2632   2634       Tcl_Interp *interp,
  2633   2635       CompileEnv *envPtr)
  2634   2636   {
  2635   2637       Tcl_Obj *msg = Tcl_GetObjResult(interp);
  2636         -    int numBytes;
  2637         -    const char *bytes = TclGetStringFromObj(msg, &numBytes);
         2638  +    const char *bytes = TclGetString(msg);
         2639  +    size_t numBytes = msg->length;
  2638   2640   
  2639   2641       TclErrorStackResetIf(interp, bytes, numBytes);
  2640   2642       TclEmitPush(TclRegisterLiteral(envPtr, bytes, numBytes, 0), envPtr);
  2641   2643       CompileReturnInternal(envPtr, INST_SYNTAX, TCL_ERROR, 0,
  2642   2644   	    TclNoErrorStack(interp, Tcl_GetReturnOptions(interp, TCL_ERROR)));
  2643   2645       Tcl_ResetResult(interp);
  2644   2646   }

Changes to generic/tclCompCmdsSZ.c.

   733    733   				 * created by Tcl_ParseCommand. */
   734    734       Command *cmdPtr,		/* Points to defintion of command being
   735    735   				 * compiled. */
   736    736       CompileEnv *envPtr)		/* Holds resulting instructions. */
   737    737   {
   738    738       DefineLineInformation;	/* TIP #280 */
   739    739       Tcl_Token *tokenPtr;
   740         -    int i, length, exactMatch = 0, nocase = 0;
          740  +	size_t length;
          741  +    int i, exactMatch = 0, nocase = 0;
   741    742       const char *str;
   742    743   
   743    744       if (parsePtr->numWords < 3 || parsePtr->numWords > 4) {
   744    745   	return TCL_ERROR;
   745    746       }
   746    747       tokenPtr = TokenAfter(parsePtr->tokenPtr);
   747    748   
................................................................................
  1460   1461       return TCL_OK;
  1461   1462   }
  1462   1463   
  1463   1464   void
  1464   1465   TclSubstCompile(
  1465   1466       Tcl_Interp *interp,
  1466   1467       const char *bytes,
  1467         -    int numBytes,
         1468  +    size_t numBytes,
  1468   1469       int flags,
  1469   1470       int line,
  1470   1471       CompileEnv *envPtr)
  1471   1472   {
  1472   1473       Tcl_Token *endTokenPtr, *tokenPtr;
  1473   1474       int breakOffset = 0, count = 0, bline = line;
  1474   1475       Tcl_Parse parse;
................................................................................
  1522   1523   	     * TCL_OK or TCL_ERROR from the substituted variable read; if so,
  1523   1524   	     * there is no need to generate elaborate exception-management
  1524   1525   	     * code. Note that the first component of TCL_TOKEN_VARIABLE is
  1525   1526   	     * always TCL_TOKEN_TEXT...
  1526   1527   	     */
  1527   1528   
  1528   1529   	    if (tokenPtr->numComponents > 1) {
  1529         -		int i, foundCommand = 0;
         1530  +		size_t i;	
         1531  +		int foundCommand = 0;
  1530   1532   
  1531   1533   		for (i=2 ; i<=tokenPtr->numComponents ; i++) {
  1532   1534   		    if (tokenPtr[i].type == TCL_TOKEN_COMMAND) {
  1533   1535   			foundCommand = 1;
  1534   1536   			break;
  1535   1537   		    }
  1536   1538   		}
................................................................................
  1561   1563   
  1562   1564   	    /* Jump to the end (all BREAKs land here) */
  1563   1565   	    breakOffset = CurrentOffset(envPtr);
  1564   1566   	    TclEmitInstInt4(INST_JUMP4, 0, envPtr);
  1565   1567   
  1566   1568   	    /* Start */
  1567   1569   	    if (TclFixupForwardJumpToHere(envPtr, &startFixup, 127)) {
  1568         -		Tcl_Panic("TclCompileSubstCmd: bad start jump distance %d",
  1569         -			(int) (CurrentOffset(envPtr) - startFixup.codeOffset));
         1570  +		Tcl_Panic("TclCompileSubstCmd: bad start jump distance %" TCL_Z_MODIFIER "d",
         1571  +			CurrentOffset(envPtr) - startFixup.codeOffset);
  1570   1572   	    }
  1571   1573   	}
  1572   1574   
  1573   1575   	envPtr->line = bline;
  1574   1576   	catchRange = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr);
  1575   1577   	OP4(	BEGIN_CATCH4, catchRange);
  1576   1578   	ExceptionRangeStarts(envPtr, catchRange);
................................................................................
  1620   1622   
  1621   1623   	/* OTHER */
  1622   1624   	TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, &otherFixup);
  1623   1625   
  1624   1626   	TclAdjustStackDepth(1, envPtr);
  1625   1627   	/* BREAK destination */
  1626   1628   	if (TclFixupForwardJumpToHere(envPtr, &breakFixup, 127)) {
  1627         -	    Tcl_Panic("TclCompileSubstCmd: bad break jump distance %d",
  1628         -		    (int) (CurrentOffset(envPtr) - breakFixup.codeOffset));
         1629  +	    Tcl_Panic("TclCompileSubstCmd: bad break jump distance %" TCL_Z_MODIFIER "d",
         1630  +		    CurrentOffset(envPtr) - breakFixup.codeOffset);
  1629   1631   	}
  1630   1632   	OP(	POP);
  1631   1633   	OP(	POP);
  1632   1634   
  1633   1635   	breakJump = CurrentOffset(envPtr) - breakOffset;
  1634   1636   	if (breakJump > 127) {
  1635   1637   	    OP4(JUMP4, -breakJump);
................................................................................
  1636   1638   	} else {
  1637   1639   	    OP1(JUMP1, -breakJump);
  1638   1640   	}
  1639   1641   
  1640   1642   	TclAdjustStackDepth(2, envPtr);
  1641   1643   	/* CONTINUE destination */
  1642   1644   	if (TclFixupForwardJumpToHere(envPtr, &continueFixup, 127)) {
  1643         -	    Tcl_Panic("TclCompileSubstCmd: bad continue jump distance %d",
  1644         -		    (int) (CurrentOffset(envPtr) - continueFixup.codeOffset));
         1645  +	    Tcl_Panic("TclCompileSubstCmd: bad continue jump distance %" TCL_Z_MODIFIER "d",
         1646  +		    CurrentOffset(envPtr) - continueFixup.codeOffset);
  1645   1647   	}
  1646   1648   	OP(	POP);
  1647   1649   	OP(	POP);
  1648   1650   	TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, &endFixup);
  1649   1651   
  1650   1652   	TclAdjustStackDepth(2, envPtr);
  1651   1653   	/* RETURN + other destination */
  1652   1654   	if (TclFixupForwardJumpToHere(envPtr, &returnFixup, 127)) {
  1653         -	    Tcl_Panic("TclCompileSubstCmd: bad return jump distance %d",
  1654         -		    (int) (CurrentOffset(envPtr) - returnFixup.codeOffset));
         1655  +	    Tcl_Panic("TclCompileSubstCmd: bad return jump distance %" TCL_Z_MODIFIER "d",
         1656  +		    CurrentOffset(envPtr) - returnFixup.codeOffset);
  1655   1657   	}
  1656   1658   	if (TclFixupForwardJumpToHere(envPtr, &otherFixup, 127)) {
  1657         -	    Tcl_Panic("TclCompileSubstCmd: bad other jump distance %d",
  1658         -		    (int) (CurrentOffset(envPtr) - otherFixup.codeOffset));
         1659  +	    Tcl_Panic("TclCompileSubstCmd: bad other jump distance %" TCL_Z_MODIFIER "d",
         1660  +		    CurrentOffset(envPtr) - otherFixup.codeOffset);
  1659   1661   	}
  1660   1662   
  1661   1663   	/*
  1662   1664   	 * Pull the result to top of stack, discard options dict.
  1663   1665   	 */
  1664   1666   
  1665   1667   	OP4(	REVERSE, 2);
  1666   1668   	OP(	POP);
  1667   1669   
  1668   1670   	/* OK destination */
  1669   1671   	if (TclFixupForwardJumpToHere(envPtr, &okFixup, 127)) {
  1670         -	    Tcl_Panic("TclCompileSubstCmd: bad ok jump distance %d",
  1671         -		    (int) (CurrentOffset(envPtr) - okFixup.codeOffset));
         1672  +	    Tcl_Panic("TclCompileSubstCmd: bad ok jump distance %" TCL_Z_MODIFIER "d",
         1673  +		    CurrentOffset(envPtr) - okFixup.codeOffset);
  1672   1674   	}
  1673   1675   	if (count > 1) {
  1674   1676   	    OP1(STR_CONCAT1, count);
  1675   1677   	    count = 1;
  1676   1678   	}
  1677   1679   
  1678   1680   	/* CONTINUE jump to here */
  1679   1681   	if (TclFixupForwardJumpToHere(envPtr, &endFixup, 127)) {
  1680         -	    Tcl_Panic("TclCompileSubstCmd: bad end jump distance %d",
  1681         -		    (int) (CurrentOffset(envPtr) - endFixup.codeOffset));
         1682  +	    Tcl_Panic("TclCompileSubstCmd: bad end jump distance %" TCL_Z_MODIFIER "d",
         1683  +		    CurrentOffset(envPtr) - endFixup.codeOffset);
  1682   1684   	}
  1683   1685   	bline = envPtr->line;
  1684   1686       }
  1685   1687   
  1686   1688       while (count > 255) {
  1687   1689   	OP1(	STR_CONCAT1, 255);
  1688   1690   	count -= 254;
................................................................................
  1795   1797        * way to statically avoid the problems you get from strings-to-be-matched
  1796   1798        * that start with a - (the interpreted code falls apart if it encounters
  1797   1799        * them, so we punt if we *might* encounter them as that is the easiest
  1798   1800        * way of emulating the behaviour).
  1799   1801        */
  1800   1802   
  1801   1803       for (; numWords>=3 ; tokenPtr=TokenAfter(tokenPtr),numWords--) {
  1802         -	register unsigned size = tokenPtr[1].size;
         1804  +	register size_t size = tokenPtr[1].size;
  1803   1805   	register const char *chrs = tokenPtr[1].start;
  1804   1806   
  1805   1807   	/*
  1806   1808   	 * We only process literal options, and we assume that -e, -g and -n
  1807   1809   	 * are unique prefixes of -exact, -glob and -nocase respectively (true
  1808   1810   	 * at time of writing). Note that -exact and -glob may only be given
  1809   1811   	 * at most once or we bail out (error case).
................................................................................
  1886   1888        * copies of the string from the input token for the generated tokens (it
  1887   1889        * causes a crash during exception handling). When multiple tokens are
  1888   1890        * available at this point, this is pretty easy.
  1889   1891        */
  1890   1892   
  1891   1893       if (numWords == 1) {
  1892   1894   	const char *bytes;
  1893         -	int maxLen, numBytes;
         1895  +	size_t maxLen, numBytes;
  1894   1896   	int bline;		/* TIP #280: line of the pattern/action list,
  1895   1897   				 * and start of list for when tracking the
  1896   1898   				 * location. This list comes immediately after
  1897   1899   				 * the value we switch on. */
  1898   1900   
  1899   1901   	if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
  1900   1902   	    return TCL_ERROR;
................................................................................
  1903   1905   	numBytes = tokenPtr[1].size;
  1904   1906   
  1905   1907   	/* Allocate enough space to work in. */
  1906   1908   	maxLen = TclMaxListLength(bytes, numBytes, NULL);
  1907   1909   	if (maxLen < 2)  {
  1908   1910   	    return TCL_ERROR;
  1909   1911   	}
  1910         -	bodyTokenArray = ckalloc(sizeof(Tcl_Token) * maxLen);
  1911         -	bodyToken = ckalloc(sizeof(Tcl_Token *) * maxLen);
  1912         -	bodyLines = ckalloc(sizeof(int) * maxLen);
  1913         -	bodyContLines = ckalloc(sizeof(int*) * maxLen);
         1912  +	bodyTokenArray = Tcl_Alloc(sizeof(Tcl_Token) * maxLen);
         1913  +	bodyToken = Tcl_Alloc(sizeof(Tcl_Token *) * maxLen);
         1914  +	bodyLines = Tcl_Alloc(sizeof(int) * maxLen);
         1915  +	bodyContLines = Tcl_Alloc(sizeof(int*) * maxLen);
  1914   1916   
  1915   1917   	bline = mapPtr->loc[eclIndex].line[valueIndex+1];
  1916   1918   	numWords = 0;
  1917   1919   
  1918   1920   	while (numBytes > 0) {
  1919   1921   	    const char *prevBytes = bytes;
  1920   1922   	    int literal;
................................................................................
  1944   1946   	    TclAdvanceContinuations(&bline, &clNext, bytes - envPtr->source);
  1945   1947   
  1946   1948   	    numBytes -= (bytes - prevBytes);
  1947   1949   	    numWords++;
  1948   1950   	}
  1949   1951   	if (numWords % 2) {
  1950   1952   	abort:
  1951         -	    ckfree(bodyToken);
  1952         -	    ckfree(bodyTokenArray);
  1953         -	    ckfree(bodyLines);
  1954         -	    ckfree(bodyContLines);
         1953  +	    Tcl_Free(bodyToken);
         1954  +	    Tcl_Free(bodyTokenArray);
         1955  +	    Tcl_Free(bodyLines);
         1956  +	    Tcl_Free(bodyContLines);
  1955   1957   	    return TCL_ERROR;
  1956   1958   	}
  1957   1959       } else if (numWords % 2 || numWords == 0) {
  1958   1960   	/*
  1959   1961   	 * Odd number of words (>1) available, or no words at all available.
  1960   1962   	 * Both are error cases, so punt and let the interpreted-version
  1961   1963   	 * generate the error message. Note that the second case probably
................................................................................
  1965   1967   
  1966   1968   	return TCL_ERROR;
  1967   1969       } else {
  1968   1970   	/*
  1969   1971   	 * Multi-word definition of patterns & actions.
  1970   1972   	 */
  1971   1973   
  1972         -	bodyToken = ckalloc(sizeof(Tcl_Token *) * numWords);
  1973         -	bodyLines = ckalloc(sizeof(int) * numWords);
  1974         -	bodyContLines = ckalloc(sizeof(int*) * numWords);
         1974  +	bodyToken = Tcl_Alloc(sizeof(Tcl_Token *) * numWords);
         1975  +	bodyLines = Tcl_Alloc(sizeof(int) * numWords);
         1976  +	bodyContLines = Tcl_Alloc(sizeof(int*) * numWords);
  1975   1977   	bodyTokenArray = NULL;
  1976   1978   	for (i=0 ; i<numWords ; i++) {
  1977   1979   	    /*
  1978   1980   	     * We only handle the very simplest case. Anything more complex is
  1979   1981   	     * a good reason to go to the interpreted case anyway due to
  1980   1982   	     * traces, etc.
  1981   1983   	     */
................................................................................
  2026   2028       result = TCL_OK;
  2027   2029   
  2028   2030       /*
  2029   2031        * Clean up all our temporary space and return.
  2030   2032        */
  2031   2033   
  2032   2034     freeTemporaries:
  2033         -    ckfree(bodyToken);
  2034         -    ckfree(bodyLines);
  2035         -    ckfree(bodyContLines);
         2035  +    Tcl_Free(bodyToken);
         2036  +    Tcl_Free(bodyLines);
         2037  +    Tcl_Free(bodyContLines);
  2036   2038       if (bodyTokenArray != NULL) {
  2037         -	ckfree(bodyTokenArray);
         2039  +	Tcl_Free(bodyTokenArray);
  2038   2040       }
  2039   2041       return result;
  2040   2042   }
  2041   2043   
  2042   2044   /*
  2043   2045    *----------------------------------------------------------------------
  2044   2046    *
................................................................................
  2331   2333        * (relative to the INST_JUMP_TABLE instruction) to jump to. The jump
  2332   2334        * table itself is independent of any invokation of the bytecode, and as
  2333   2335        * such is stored in an auxData block.
  2334   2336        *
  2335   2337        * Start by allocating the jump table itself, plus some workspace.
  2336   2338        */
  2337   2339   
  2338         -    jtPtr = ckalloc(sizeof(JumptableInfo));
         2340  +    jtPtr = Tcl_Alloc(sizeof(JumptableInfo));
  2339   2341       Tcl_InitHashTable(&jtPtr->hashTable, TCL_STRING_KEYS);
  2340   2342       infoIndex = TclCreateAuxData(jtPtr, &tclJumptableInfoType, envPtr);
  2341   2343       finalFixups = TclStackAlloc(interp, sizeof(int) * (numBodyTokens/2));
  2342   2344       foundDefault = 0;
  2343   2345       mustGenerate = 1;
  2344   2346   
  2345   2347       /*
................................................................................
  2503   2505    */
  2504   2506   
  2505   2507   static ClientData
  2506   2508   DupJumptableInfo(
  2507   2509       ClientData clientData)
  2508   2510   {
  2509   2511       JumptableInfo *jtPtr = clientData;
  2510         -    JumptableInfo *newJtPtr = ckalloc(sizeof(JumptableInfo));
         2512  +    JumptableInfo *newJtPtr = Tcl_Alloc(sizeof(JumptableInfo));
  2511   2513       Tcl_HashEntry *hPtr, *newHPtr;
  2512   2514       Tcl_HashSearch search;
  2513   2515       int isNew;
  2514   2516   
  2515   2517       Tcl_InitHashTable(&newJtPtr->hashTable, TCL_STRING_KEYS);
  2516   2518       hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search);
  2517   2519       while (hPtr != NULL) {
................................................................................
  2525   2527   static void
  2526   2528   FreeJumptableInfo(
  2527   2529       ClientData clientData)
  2528   2530   {
  2529   2531       JumptableInfo *jtPtr = clientData;
  2530   2532   
  2531   2533       Tcl_DeleteHashTable(&jtPtr->hashTable);
  2532         -    ckfree(jtPtr);
         2534  +    Tcl_Free(jtPtr);
  2533   2535   }
  2534   2536   
  2535   2537   static void
  2536   2538   PrintJumptableInfo(
  2537   2539       ClientData clientData,
  2538   2540       Tcl_Obj *appendObj,
  2539   2541       ByteCode *codePtr,

Changes to generic/tclCompExpr.c.

   497    497    * Declarations for local functions to this file:
   498    498    */
   499    499   
   500    500   static void		CompileExprTree(Tcl_Interp *interp, OpNode *nodes,
   501    501   			    int index, Tcl_Obj *const **litObjvPtr,
   502    502   			    Tcl_Obj *const *funcObjv, Tcl_Token *tokenPtr,
   503    503   			    CompileEnv *envPtr, int optimize);
   504         -static void		ConvertTreeToTokens(const char *start, int numBytes,
          504  +static void		ConvertTreeToTokens(const char *start, size_t numBytes,
   505    505   			    OpNode *nodes, Tcl_Token *tokenPtr,
   506    506   			    Tcl_Parse *parsePtr);
   507    507   static int		ExecConstantExprTree(Tcl_Interp *interp, OpNode *nodes,
   508    508   			    int index, Tcl_Obj * const **litObjvPtr);
   509    509   static int		ParseExpr(Tcl_Interp *interp, const char *start,
   510         -			    int numBytes, OpNode **opTreePtr,
          510  +			    size_t numBytes, OpNode **opTreePtr,
   511    511   			    Tcl_Obj *litList, Tcl_Obj *funcList,
   512    512   			    Tcl_Parse *parsePtr, int parseOnly);
   513         -static int		ParseLexeme(const char *start, int numBytes,
          513  +static size_t		ParseLexeme(const char *start, size_t numBytes,
   514    514   			    unsigned char *lexemePtr, Tcl_Obj **literalPtr);
   515    515   
   516    516   /*
   517    517    *----------------------------------------------------------------------
   518    518    *
   519    519    * ParseExpr --
   520    520    *
................................................................................
   532    532    *	last four arguments. If the string cannot be parsed as a valid Tcl
   533    533    *	expression, TCL_ERROR is returned, and if interp is non-NULL, an error
   534    534    *	message is written to interp.
   535    535    *
   536    536    * Side effects:
   537    537    *	Memory will be allocated. If TCL_OK is returned, the caller must clean
   538    538    *	up the returned data structures. The (OpNode *) value written to
   539         - *	opTreePtr should be passed to ckfree() and the parsePtr argument
          539  + *	opTreePtr should be passed to Tcl_Free() and the parsePtr argument
   540    540    *	should be passed to Tcl_FreeParse(). The elements appended to the
   541    541    *	litList and funcList will automatically be freed whenever the refcount
   542    542    *	on those lists indicates they can be freed.
   543    543    *
   544    544    *----------------------------------------------------------------------
   545    545    */
   546    546   
   547    547   static int
   548    548   ParseExpr(
   549    549       Tcl_Interp *interp,		/* Used for error reporting. */
   550    550       const char *start,		/* Start of source string to parse. */
   551         -    int numBytes,		/* Number of bytes in string. */
          551  +    size_t numBytes,		/* Number of bytes in string. */
   552    552       OpNode **opTreePtr,		/* Points to space where a pointer to the
   553    553   				 * allocated OpNode tree should go. */
   554    554       Tcl_Obj *litList,		/* List to append literals to. */
   555    555       Tcl_Obj *funcList,		/* List to append function names to. */
   556    556       Tcl_Parse *parsePtr,	/* Structure to fill with tokens representing
   557    557   				 * those operands that require run time
   558    558   				 * substitutions. */
................................................................................
   567    567       unsigned int nodesAvailable = 64; /* Initial size of the storage array. This
   568    568   				 * value establishes a minimum tree memory
   569    569   				 * cost of only about 1 kibyte, and is large
   570    570   				 * enough for most expressions to parse with
   571    571   				 * no need for array growth and
   572    572   				 * reallocation. */
   573    573       unsigned int nodesUsed = 0;	/* Number of OpNodes filled. */
   574         -    int scanned = 0;		/* Capture number of byte scanned by parsing
          574  +    size_t scanned = 0;		/* Capture number of byte scanned by parsing
   575    575   				 * routines. */
   576    576       int lastParsed;		/* Stores info about what the lexeme parsed
   577    577   				 * the previous pass through the parsing loop
   578    578   				 * was. If it was an operator, lastParsed is
   579    579   				 * the index of the OpNode for that operator.
   580    580   				 * If it was not an operator, lastParsed holds
   581    581   				 * an OperandTypes value encoding what we need
................................................................................
   611    611   				 * message where the error location is
   612    612   				 * reported, this "mark" substring is inserted
   613    613   				 * into the string being parsed to aid in
   614    614   				 * pinpointing the location of the syntax
   615    615   				 * error in the expression. */
   616    616       int insertMark = 0;		/* A boolean controlling whether the "mark"
   617    617   				 * should be inserted. */
   618         -    const int limit = 25;	/* Portions of the error message are
          618  +    const unsigned limit = 25;	/* Portions of the error message are
   619    619   				 * constructed out of substrings of the
   620    620   				 * original expression. In order to keep the
   621    621   				 * error message readable, we impose this
   622    622   				 * limit on the substring size we extract. */
   623    623   
   624    624       TclParseInit(interp, start, numBytes, parsePtr);
   625    625   
   626         -    nodes = attemptckalloc(nodesAvailable * sizeof(OpNode));
          626  +    nodes = Tcl_AttemptAlloc(nodesAvailable * sizeof(OpNode));
   627    627       if (nodes == NULL) {
   628    628   	TclNewLiteralStringObj(msg, "not enough memory to parse expression");
   629    629   	errCode = "NOMEM";
   630    630   	goto error;
   631    631       }
   632    632   
   633    633       /*
................................................................................
   663    663   
   664    664   	if (nodesUsed >= nodesAvailable) {
   665    665   	    unsigned int size = nodesUsed * 2;
   666    666   	    OpNode *newPtr = NULL;
   667    667   
   668    668   	    do {
   669    669   	      if (size <= UINT_MAX/sizeof(OpNode)) {
   670         -		newPtr = attemptckrealloc(nodes, size * sizeof(OpNode));
          670  +		newPtr = Tcl_AttemptRealloc(nodes, size * sizeof(OpNode));
   671    671   	      }
   672    672   	    } while ((newPtr == NULL)
   673    673   		    && ((size -= (size - nodesUsed) / 2) > nodesUsed));
   674    674   	    if (newPtr == NULL) {
   675    675   		TclNewLiteralStringObj(msg,
   676    676   			"not enough memory to parse expression");
   677    677   		errCode = "NOMEM";
................................................................................
   698    698   
   699    699   	if ((NODE_TYPE & lexeme) == 0) {
   700    700   	    int b;
   701    701   
   702    702   	    switch (lexeme) {
   703    703   	    case INVALID:
   704    704   		msg = Tcl_ObjPrintf("invalid character \"%.*s\"",
   705         -			scanned, start);
          705  +			(int)scanned, start);
   706    706   		errCode = "BADCHAR";
   707    707   		goto error;
   708    708   	    case INCOMPLETE:
   709    709   		msg = Tcl_ObjPrintf("incomplete operator \"%.*s\"",
   710         -			scanned, start);
          710  +			(int)scanned, start);
   711    711   		errCode = "PARTOP";
   712    712   		goto error;
   713    713   	    case BAREWORD:
   714    714   
   715    715   		/*
   716    716   		 * Most barewords in an expression are a syntax error. The
   717    717   		 * exceptions are that when a bareword is followed by an open
................................................................................
   732    732   
   733    733   		    Tcl_ListObjAppendElement(NULL, funcList, literal);
   734    734   		} else if (Tcl_GetBooleanFromObj(NULL,literal,&b) == TCL_OK) {
   735    735   		    lexeme = BOOLEAN;
   736    736   		} else {
   737    737   		    Tcl_DecrRefCount(literal);
   738    738   		    msg = Tcl_ObjPrintf("invalid bareword \"%.*s%s\"",
   739         -			    (scanned < limit) ? scanned : limit - 3, start,
          739  +			    (scanned < limit) ? (int)scanned : (int)limit - 3, start,
   740    740   			    (scanned < limit) ? "" : "...");
   741    741   		    post = Tcl_ObjPrintf(
   742    742   			    "should be \"$%.*s%s\" or \"{%.*s%s}\"",
   743         -			    (scanned < limit) ? scanned : limit - 3,
          743  +			    (scanned < limit) ? (int)scanned : (int)limit - 3,
   744    744   			    start, (scanned < limit) ? "" : "...",
   745         -			    (scanned < limit) ? scanned : limit - 3,
          745  +			    (scanned < limit) ? (int)scanned : (int)limit - 3,
   746    746   			    start, (scanned < limit) ? "" : "...");
   747    747   		    Tcl_AppendPrintfToObj(post, " or \"%.*s%s(...)\" or ...",
   748         -			    (scanned < limit) ? scanned : limit - 3,
          748  +			    (scanned < limit) ? (int)scanned : (int)limit - 3,
   749    749   			    start, (scanned < limit) ? "" : "...");
   750    750   		    errCode = "BAREWORD";
   751    751   		    if (start[0] == '0') {
   752    752   			const char *stop;
   753    753   			TclParseNumber(NULL, NULL, NULL, start, scanned,
   754    754   				&stop, TCL_PARSE_NO_WHITESPACE);
   755    755   
................................................................................
  1373   1373       }
  1374   1374   
  1375   1375       /*
  1376   1376        * Free any partial parse tree we've built.
  1377   1377        */
  1378   1378   
  1379   1379       if (nodes != NULL) {
  1380         -	ckfree(nodes);
         1380  +	Tcl_Free(nodes);
  1381   1381       }
  1382   1382   
  1383   1383       if (interp == NULL) {
  1384   1384   	/*
  1385   1385   	 * Nowhere to report an error message, so just free it.
  1386   1386   	 */
  1387   1387   
................................................................................
  1402   1402   	 * Add a detailed quote from the bad expression, displaying and
  1403   1403   	 * sometimes marking the precise location of the syntax error.
  1404   1404   	 */
  1405   1405   
  1406   1406   	Tcl_AppendPrintfToObj(msg, "\nin expression \"%s%.*s%.*s%s%s%.*s%s\"",
  1407   1407   		((start - limit) < parsePtr->string) ? "" : "...",
  1408   1408   		((start - limit) < parsePtr->string)
  1409         -			? (int) (start - parsePtr->string) : limit - 3,
         1409  +			? (int) (start - parsePtr->string) : (int)limit - 3,
  1410   1410   		((start - limit) < parsePtr->string)
  1411   1411   			? parsePtr->string : start - limit + 3,
  1412         -		(scanned < limit) ? scanned : limit - 3, start,
         1412  +		(scanned < limit) ? (int)scanned : (int)limit - 3, start,
  1413   1413   		(scanned < limit) ? "" : "...", insertMark ? mark : "",
  1414   1414   		(start + scanned + limit > parsePtr->end)
  1415         -			? (int) (parsePtr->end - start) - scanned : limit-3,
         1415  +			? (int) (parsePtr->end - start) - (int)scanned : (int)limit-3,
  1416   1416   		start + scanned,
  1417   1417   		(start + scanned + limit > parsePtr->end) ? "" : "...");
  1418   1418   
  1419   1419   	/*
  1420   1420   	 * Next, append any postscript message.
  1421   1421   	 */
  1422   1422   
................................................................................
  1430   1430   	/*
  1431   1431   	 * Finally, place context information in the errorInfo.
  1432   1432   	 */
  1433   1433   
  1434   1434   	numBytes = parsePtr->end - parsePtr->string;
  1435   1435   	Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
  1436   1436   		"\n    (parsing expression \"%.*s%s\")",
  1437         -		(numBytes < limit) ? numBytes : limit - 3,
         1437  +		(numBytes < limit) ? (int)numBytes : (int)limit - 3,
  1438   1438   		parsePtr->string, (numBytes < limit) ? "" : "..."));
  1439   1439   	if (errCode) {
  1440   1440   	    Tcl_SetErrorCode(interp, "TCL", "PARSE", "EXPR", errCode,
  1441   1441   		    subErrCode, NULL);
  1442   1442   	}
  1443   1443       }
  1444   1444   
................................................................................
  1467   1467    *
  1468   1468    *----------------------------------------------------------------------
  1469   1469    */
  1470   1470   
  1471   1471   static void
  1472   1472   ConvertTreeToTokens(
  1473   1473       const char *start,
  1474         -    int numBytes,
         1474  +    size_t numBytes,
  1475   1475       OpNode *nodes,
  1476   1476       Tcl_Token *tokenPtr,
  1477   1477       Tcl_Parse *parsePtr)
  1478   1478   {
  1479   1479       int subExprTokenIdx = 0;
  1480   1480       OpNode *nodePtr = nodes;
  1481   1481       int next = nodePtr->right;
................................................................................
  1815   1815    *----------------------------------------------------------------------
  1816   1816    */
  1817   1817   
  1818   1818   int
  1819   1819   Tcl_ParseExpr(
  1820   1820       Tcl_Interp *interp,		/* Used for error reporting. */
  1821   1821       const char *start,		/* Start of source string to parse. */
  1822         -    int numBytes,		/* Number of bytes in string. If < 0, the
         1822  +    size_t numBytes,		/* Number of bytes in string. If -1, the
  1823   1823   				 * string consists of all bytes up to the
  1824   1824   				 * first null character. */
  1825   1825       Tcl_Parse *parsePtr)	/* Structure to fill with information about
  1826   1826   				 * the parsed expression; any previous
  1827   1827   				 * information in the structure is ignored. */
  1828   1828   {
  1829   1829       int code;
  1830   1830       OpNode *opTree = NULL;	/* Will point to the tree of operators. */
  1831   1831       Tcl_Obj *litList = Tcl_NewObj();	/* List to hold the literals. */
  1832   1832       Tcl_Obj *funcList = Tcl_NewObj();	/* List to hold the functon names. */
  1833   1833       Tcl_Parse *exprParsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse));
  1834   1834   				/* Holds the Tcl_Tokens of substitutions. */
  1835   1835   
  1836         -    if (numBytes < 0) {
         1836  +    if (numBytes == TCL_AUTO_LENGTH) {
  1837   1837   	numBytes = (start ? strlen(start) : 0);
  1838   1838       }
  1839   1839   
  1840   1840       code = ParseExpr(interp, start, numBytes, &opTree, litList, funcList,
  1841   1841   	    exprParsePtr, 1 /* parseOnly */);
  1842   1842       Tcl_DecrRefCount(funcList);
  1843   1843       Tcl_DecrRefCount(litList);
................................................................................
  1849   1849       } else {
  1850   1850   	parsePtr->term = exprParsePtr->term;
  1851   1851   	parsePtr->errorType = exprParsePtr->errorType;
  1852   1852       }
  1853   1853   
  1854   1854       Tcl_FreeParse(exprParsePtr);
  1855   1855       TclStackFree(interp, exprParsePtr);
  1856         -    ckfree(opTree);
         1856  +    Tcl_Free(opTree);
  1857   1857       return code;
  1858   1858   }
  1859   1859   
  1860   1860   /*
  1861   1861    *----------------------------------------------------------------------
  1862   1862    *
  1863   1863    * ParseLexeme --
................................................................................
  1870   1870    *
  1871   1871    * Side effects:
  1872   1872    *	Code identifying lexeme parsed is writen to *lexemePtr.
  1873   1873    *
  1874   1874    *----------------------------------------------------------------------
  1875   1875    */
  1876   1876   
  1877         -static int
         1877  +static size_t
  1878   1878   ParseLexeme(
  1879   1879       const char *start,		/* Start of lexeme to parse. */
  1880         -    int numBytes,		/* Number of bytes in string. */
         1880  +    size_t numBytes,		/* Number of bytes in string. */
  1881   1881       unsigned char *lexemePtr,	/* Write code of parsed lexeme to this
  1882   1882   				 * storage. */
  1883   1883       Tcl_Obj **literalPtr)	/* Write corresponding literal value to this
  1884   1884   				   storage, if non-NULL. */
  1885   1885   {
  1886   1886       const char *end;
  1887         -    int scanned;
  1888   1887       Tcl_UniChar ch = 0;
  1889   1888       Tcl_Obj *literal = NULL;
  1890   1889       unsigned char byte;
  1891   1890   
  1892   1891       if (numBytes == 0) {
  1893   1892   	*lexemePtr = END;
  1894   1893   	return 0;
................................................................................
  2059   2058       /*
  2060   2059        * We reject leading underscores in bareword.  No sensible reason why.
  2061   2060        * Might be inspired by reserved identifier rules in C, which of course
  2062   2061        * have no direct relevance here.
  2063   2062        */
  2064   2063   
  2065   2064       if (!TclIsBareword(*start) || *start == '_') {
         2065  +	size_t scanned;
  2066   2066   	if (Tcl_UtfCharComplete(start, numBytes)) {
  2067   2067   	    scanned = TclUtfToUniChar(start, &ch);
  2068   2068   	} else {
  2069   2069   	    char utfBytes[TCL_UTF_MAX];
  2070   2070   
  2071         -	    memcpy(utfBytes, start, (size_t) numBytes);
         2071  +	    memcpy(utfBytes, start, numBytes);
  2072   2072   	    utfBytes[numBytes] = '\0';
  2073   2073   	    scanned = TclUtfToUniChar(utfBytes, &ch);
  2074   2074   	}
  2075   2075   	*lexemePtr = INVALID;
  2076   2076   	Tcl_DecrRefCount(literal);
  2077   2077   	return scanned;
  2078   2078       }
................................................................................
  2108   2108    *----------------------------------------------------------------------
  2109   2109    */
  2110   2110   
  2111   2111   void
  2112   2112   TclCompileExpr(
  2113   2113       Tcl_Interp *interp,		/* Used for error reporting. */
  2114   2114       const char *script,		/* The source script to compile. */
  2115         -    int numBytes,		/* Number of bytes in script. */
         2115  +    size_t numBytes,		/* Number of bytes in script. */
  2116   2116       CompileEnv *envPtr,		/* Holds resulting instructions. */
  2117   2117       int optimize)		/* 0 for one-off expressions. */
  2118   2118   {
  2119   2119       OpNode *opTree = NULL;	/* Will point to the tree of operators */
  2120   2120       Tcl_Obj *litList = Tcl_NewObj();	/* List to hold the literals */
  2121   2121       Tcl_Obj *funcList = Tcl_NewObj();	/* List to hold the functon names*/
  2122   2122       Tcl_Parse *parsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse));
................................................................................
  2146   2146   	TclCompileSyntaxError(interp, envPtr);
  2147   2147       }
  2148   2148   
  2149   2149       Tcl_FreeParse(parsePtr);
  2150   2150       TclStackFree(interp, parsePtr);
  2151   2151       Tcl_DecrRefCount(funcList);
  2152   2152       Tcl_DecrRefCount(litList);
  2153         -    ckfree(opTree);
         2153  +    Tcl_Free(opTree);
  2154   2154   }
  2155   2155   
  2156   2156   /*
  2157   2157    *----------------------------------------------------------------------
  2158   2158    *
  2159   2159    * ExecConstantExprTree --
  2160   2160    *	Compiles and executes bytecode for the subexpression tree at index

Changes to generic/tclCompile.c.

  1115   1115       }
  1116   1116   
  1117   1117       if (codePtr->localCachePtr && (codePtr->localCachePtr->refCount-- <= 1)) {
  1118   1118   	TclFreeLocalCache(interp, codePtr->localCachePtr);
  1119   1119       }
  1120   1120   
  1121   1121       TclHandleRelease(codePtr->interpHandle);
  1122         -    ckfree(codePtr);
         1122  +    Tcl_Free(codePtr);
  1123   1123   }
  1124   1124   
  1125   1125   /*
  1126   1126    * ---------------------------------------------------------------------
  1127   1127    *
  1128   1128    * IsCompactibleCompileEnv --
  1129   1129    *
................................................................................
  1298   1298   		|| (codePtr->localCachePtr !=
  1299   1299   		iPtr->varFramePtr->localCachePtr)) {
  1300   1300   	    TclFreeIntRep(objPtr);
  1301   1301   	}
  1302   1302       }
  1303   1303       if (objPtr->typePtr != &substCodeType) {
  1304   1304   	CompileEnv compEnv;
  1305         -	int numBytes;
  1306         -	const char *bytes = TclGetStringFromObj(objPtr, &numBytes);
         1305  +	const char *bytes = TclGetString(objPtr);
         1306  +	size_t numBytes = objPtr->length;
  1307   1307   
  1308   1308   	/* TODO: Check for more TIP 280 */
  1309   1309   	TclInitCompileEnv(interp, &compEnv, bytes, numBytes, NULL, 0);
  1310   1310   
  1311   1311   	TclSubstCompile(interp, bytes, numBytes, flags, 1, &compEnv);
  1312   1312   
  1313   1313   	TclEmitOpcode(INST_DONE, &compEnv);
................................................................................
  1365   1365   {
  1366   1366       int i;
  1367   1367   
  1368   1368       if (eclPtr->type == TCL_LOCATION_SOURCE) {
  1369   1369   	Tcl_DecrRefCount(eclPtr->path);
  1370   1370       }
  1371   1371       for (i=0 ; i<eclPtr->nuloc ; i++) {
  1372         -	ckfree(eclPtr->loc[i].line);
         1372  +	Tcl_Free(eclPtr->loc[i].line);
  1373   1373       }
  1374   1374   
  1375   1375       if (eclPtr->loc != NULL) {
  1376         -	ckfree(eclPtr->loc);
         1376  +	Tcl_Free(eclPtr->loc);
  1377   1377       }
  1378   1378   
  1379         -    ckfree(eclPtr);
         1379  +    Tcl_Free(eclPtr);
  1380   1380   }
  1381   1381   
  1382   1382   /*
  1383   1383    *----------------------------------------------------------------------
  1384   1384    *
  1385   1385    * TclInitCompileEnv --
  1386   1386    *
................................................................................
  1399   1399   void
  1400   1400   TclInitCompileEnv(
  1401   1401       Tcl_Interp *interp,		/* The interpreter for which a CompileEnv
  1402   1402   				 * structure is initialized. */
  1403   1403       register CompileEnv *envPtr,/* Points to the CompileEnv structure to
  1404   1404   				 * initialize. */
  1405   1405       const char *stringPtr,	/* The source string to be compiled. */
  1406         -    int numBytes,		/* Number of bytes in source string. */
         1406  +    size_t numBytes,		/* Number of bytes in source string. */
  1407   1407       const CmdFrame *invoker,	/* Location context invoking the bcc */
  1408   1408       int word)			/* Index of the word in that context getting
  1409   1409   				 * compiled */
  1410   1410   {
  1411   1411       Interp *iPtr = (Interp *) interp;
  1412   1412   
  1413   1413       assert(tclInstructionTable[LAST_INST_OPCODE].name == NULL);
................................................................................
  1451   1451        * the context invoking the byte code compiler. This structure is used to
  1452   1452        * keep the per-word line information for all compiled commands.
  1453   1453        *
  1454   1454        * See also tclBasic.c, TclEvalObjEx, for the equivalent code in the
  1455   1455        * non-compiling evaluator
  1456   1456        */
  1457   1457   
  1458         -    envPtr->extCmdMapPtr = ckalloc(sizeof(ExtCmdLoc));
         1458  +    envPtr->extCmdMapPtr = Tcl_Alloc(sizeof(ExtCmdLoc));
  1459   1459       envPtr->extCmdMapPtr->loc = NULL;
  1460   1460       envPtr->extCmdMapPtr->nloc = 0;
  1461   1461       envPtr->extCmdMapPtr->nuloc = 0;
  1462   1462       envPtr->extCmdMapPtr->path = NULL;
  1463   1463   
  1464   1464       if (invoker == NULL) {
  1465   1465   	/*
................................................................................
  1606   1606    */
  1607   1607   
  1608   1608   void
  1609   1609   TclFreeCompileEnv(
  1610   1610       register CompileEnv *envPtr)/* Points to the CompileEnv structure. */
  1611   1611   {
  1612   1612       if (envPtr->localLitTable.buckets != envPtr->localLitTable.staticBuckets){
  1613         -	ckfree(envPtr->localLitTable.buckets);
         1613  +	Tcl_Free(envPtr->localLitTable.buckets);
  1614   1614   	envPtr->localLitTable.buckets = envPtr->localLitTable.staticBuckets;
  1615   1615       }
  1616   1616       if (envPtr->iPtr) {
  1617   1617   	/*
  1618   1618   	 * We never converted to Bytecode, so free the things we would
  1619   1619   	 * have transferred to it.
  1620   1620   	 */
................................................................................
  1636   1636   	    if (auxDataPtr->type->freeProc != NULL) {
  1637   1637   		auxDataPtr->type->freeProc(auxDataPtr->clientData);
  1638   1638   	    }
  1639   1639   	    auxDataPtr++;
  1640   1640   	}
  1641   1641       }
  1642   1642       if (envPtr->mallocedCodeArray) {
  1643         -	ckfree(envPtr->codeStart);
         1643  +	Tcl_Free(envPtr->codeStart);
  1644   1644       }
  1645   1645       if (envPtr->mallocedLiteralArray) {
  1646         -	ckfree(envPtr->literalArrayPtr);
         1646  +	Tcl_Free(envPtr->literalArrayPtr);
  1647   1647       }
  1648   1648       if (envPtr->mallocedExceptArray) {
  1649         -	ckfree(envPtr->exceptArrayPtr);
  1650         -	ckfree(envPtr->exceptAuxArrayPtr);
         1649  +	Tcl_Free(envPtr->exceptArrayPtr);
         1650  +	Tcl_Free(envPtr->exceptAuxArrayPtr);
  1651   1651       }
  1652   1652       if (envPtr->mallocedCmdMap) {
  1653         -	ckfree(envPtr->cmdMapPtr);
         1653  +	Tcl_Free(envPtr->cmdMapPtr);
  1654   1654       }
  1655   1655       if (envPtr->mallocedAuxDataArray) {
  1656         -	ckfree(envPtr->auxDataArrayPtr);
         1656  +	Tcl_Free(envPtr->auxDataArrayPtr);
  1657   1657       }
  1658   1658       if (envPtr->extCmdMapPtr) {
  1659   1659   	ReleaseCmdWordData(envPtr->extCmdMapPtr);
  1660   1660   	envPtr->extCmdMapPtr = NULL;
  1661   1661       }
  1662   1662   }
  1663   1663   
................................................................................
  1776   1776   
  1777   1777   static void
  1778   1778   CompileCmdLiteral(
  1779   1779       Tcl_Interp *interp,
  1780   1780       Tcl_Obj *cmdObj,
  1781   1781       CompileEnv *envPtr)
  1782   1782   {
  1783         -    int numBytes;
  1784   1783       const char *bytes;
  1785   1784       Command *cmdPtr;
  1786   1785       int cmdLitIdx, extraLiteralFlags = LITERAL_CMD_NAME;
  1787   1786   
  1788   1787       cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj);
  1789   1788       if ((cmdPtr != NULL) && (cmdPtr->flags & CMD_VIA_RESOLVER)) {
  1790   1789   	extraLiteralFlags |= LITERAL_UNSHARED;
  1791   1790       }
  1792   1791   
  1793         -    bytes = TclGetStringFromObj(cmdObj, &numBytes);
  1794         -    cmdLitIdx = TclRegisterLiteral(envPtr, bytes, numBytes, extraLiteralFlags);
         1792  +    bytes = TclGetString(cmdObj);
         1793  +    cmdLitIdx = TclRegisterLiteral(envPtr, bytes, cmdObj->length, extraLiteralFlags);
  1795   1794   
  1796   1795       if (cmdPtr) {
  1797   1796   	TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLitIdx), cmdPtr);
  1798   1797       }
  1799   1798       TclEmitPush(cmdLitIdx, envPtr);
  1800   1799   }
  1801   1800   
................................................................................
  1968   1967   
  1969   1968       /*
  1970   1969        * Throw out any line information generated by the failed compile attempt.
  1971   1970        */
  1972   1971   
  1973   1972       while (mapPtr->nuloc - 1 > eclIndex) {
  1974   1973   	mapPtr->nuloc--;
  1975         -	ckfree(mapPtr->loc[mapPtr->nuloc].line);
         1974  +	Tcl_Free(mapPtr->loc[mapPtr->nuloc].line);
  1976   1975   	mapPtr->loc[mapPtr->nuloc].line = NULL;
  1977   1976       }
  1978   1977   
  1979   1978       /*
  1980   1979        * Reset the index of next command.  Toss out any from failed nested
  1981   1980        * partial compiles.
  1982   1981        */
................................................................................
  2086   2085       /*
  2087   2086        * TIP #280: Free full form of per-word line data and insert the reduced
  2088   2087        * form now
  2089   2088        */
  2090   2089   
  2091   2090       envPtr->line = cmdLine;
  2092   2091       envPtr->clNext = clNext;
  2093         -    ckfree(eclPtr->loc[wlineat].line);
  2094         -    ckfree(eclPtr->loc[wlineat].next);
         2092  +    Tcl_Free(eclPtr->loc[wlineat].line);
         2093  +    Tcl_Free(eclPtr->loc[wlineat].next);
  2095   2094       eclPtr->loc[wlineat].line = wlines;
  2096   2095       eclPtr->loc[wlineat].next = NULL;
  2097   2096   
  2098   2097       TclCheckStackDepth(depth, envPtr);
  2099   2098       return cmdIdx;
  2100   2099   }
  2101   2100   
  2102   2101   void
  2103   2102   TclCompileScript(
  2104   2103       Tcl_Interp *interp,		/* Used for error and status reporting. Also
  2105   2104   				 * serves as context for finding and compiling
  2106   2105   				 * commands. May not be NULL. */
  2107   2106       const char *script,		/* The source script to compile. */
  2108         -    int numBytes,		/* Number of bytes in script. If < 0, the
         2107  +    size_t numBytes,		/* Number of bytes in script. If -1, the
  2109   2108   				 * script consists of all bytes up to the
  2110   2109   				 * first null character. */
  2111   2110       CompileEnv *envPtr)		/* Holds resulting instructions. */
  2112   2111   {
  2113   2112       int lastCmdIdx = -1;	/* Index into envPtr->cmdMapPtr of the last
  2114   2113   				 * command this routine compiles into bytecode.
  2115   2114   				 * Initial value of -1 indicates this routine
................................................................................
  2119   2118   
  2120   2119       if (envPtr->iPtr == NULL) {
  2121   2120   	Tcl_Panic("TclCompileScript() called on uninitialized CompileEnv");
  2122   2121       }
  2123   2122   
  2124   2123       /* Each iteration compiles one command from the script. */
  2125   2124   
  2126         -    while (numBytes > 0) {
         2125  +    while (numBytes + 1 > 1) {
  2127   2126   	Tcl_Parse parse;
  2128   2127   	const char *next;
  2129   2128   
  2130   2129   	if (TCL_OK != Tcl_ParseCommand(interp, p, numBytes, 0, &parse)) {
  2131   2130   	    /*
  2132   2131   	     * Compile bytecodes to report the parse error at runtime.
  2133   2132   	     */
................................................................................
  2254   2253   void
  2255   2254   TclCompileVarSubst(
  2256   2255       Tcl_Interp *interp,
  2257   2256       Tcl_Token *tokenPtr,
  2258   2257       CompileEnv *envPtr)
  2259   2258   {
  2260   2259       const char *p, *name = tokenPtr[1].start;
  2261         -    int nameBytes = tokenPtr[1].size;
  2262         -    int i, localVar, localVarName = 1;
         2260  +    size_t i, nameBytes = tokenPtr[1].size;
         2261  +    int localVar, localVarName = 1;
  2263   2262   
  2264   2263       /*
  2265   2264        * Determine how the variable name should be handled: if it contains any
  2266   2265        * namespace qualifiers it is not a local variable (localVarName=-1); if
  2267   2266        * it looks like an array element and the token has a single component, it
  2268   2267        * should not be created here [Bug 569438] (localVarName=0); otherwise,
  2269   2268        * the local variable can safely be created (localVarName=1).
................................................................................
  2329   2328       int count,			/* Number of tokens to consider at tokenPtr.
  2330   2329   				 * Must be at least 1. */
  2331   2330       CompileEnv *envPtr)		/* Holds the resulting instructions. */
  2332   2331   {
  2333   2332       Tcl_DString textBuffer;	/* Holds concatenated chars from adjacent
  2334   2333   				 * TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */
  2335   2334       char buffer[TCL_UTF_MAX];
  2336         -    int i, numObjsToConcat, length, adjust;
         2335  +    int i, numObjsToConcat, adjust;
         2336  +    size_t length;
  2337   2337       unsigned char *entryCodeNext = envPtr->codeNext;
  2338   2338   #define NUM_STATIC_POS 20
  2339   2339       int isLiteral, maxNumCL, numCL;
  2340   2340       int *clPosition = NULL;
  2341   2341       int depth = TclGetStackDepth(envPtr);
  2342   2342   
  2343   2343       /*
................................................................................
  2364   2364   	    isLiteral = 0;
  2365   2365   	    break;
  2366   2366   	}
  2367   2367       }
  2368   2368   
  2369   2369       if (isLiteral) {
  2370   2370   	maxNumCL = NUM_STATIC_POS;
  2371         -	clPosition = ckalloc(maxNumCL * sizeof(int));
         2371  +	clPosition = Tcl_Alloc(maxNumCL * sizeof(int));
  2372   2372       }
  2373   2373   
  2374   2374       adjust = 0;
  2375   2375       Tcl_DStringInit(&textBuffer);
  2376   2376       numObjsToConcat = 0;
  2377   2377       for ( ;  count > 0;  count--, tokenPtr++) {
  2378   2378   	switch (tokenPtr->type) {
................................................................................
  2405   2405   	    if ((length == 1) && (buffer[0] == ' ') &&
  2406   2406   		(tokenPtr->start[1] == '\n')) {
  2407   2407   		if (isLiteral) {
  2408   2408   		    int clPos = Tcl_DStringLength(&textBuffer);
  2409   2409   
  2410   2410   		    if (numCL >= maxNumCL) {
  2411   2411   			maxNumCL *= 2;
  2412         -			clPosition = ckrealloc(clPosition,
         2412  +			clPosition = Tcl_Realloc(clPosition,
  2413   2413                                   maxNumCL * sizeof(int));
  2414   2414   		    }
  2415   2415   		    clPosition[numCL] = clPos;
  2416   2416   		    numCL ++;
  2417   2417   		}
  2418   2418   		adjust++;
  2419   2419   	    }
................................................................................
  2463   2463   	    numObjsToConcat++;
  2464   2464   	    count -= tokenPtr->numComponents;
  2465   2465   	    tokenPtr += tokenPtr->numComponents;
  2466   2466   	    break;
  2467   2467   
  2468   2468   	default:
  2469   2469   	    Tcl_Panic("Unexpected token type in TclCompileTokens: %d; %.*s",
  2470         -		    tokenPtr->type, tokenPtr->size, tokenPtr->start);
         2470  +		    tokenPtr->type, (int)tokenPtr->size, tokenPtr->start);
  2471   2471   	}
  2472   2472       }
  2473   2473   
  2474   2474       /*
  2475   2475        * Push any accumulated characters appearing at the end.
  2476   2476        */
  2477   2477   
................................................................................
  2510   2510   
  2511   2511       /*
  2512   2512        * Release the temp table we used to collect the locations of continuation
  2513   2513        * lines, if any.
  2514   2514        */
  2515   2515   
  2516   2516       if (maxNumCL) {
  2517         -	ckfree(clPosition);
         2517  +	Tcl_Free(clPosition);
  2518   2518       }
  2519   2519       TclCheckStackDepth(depth+1, envPtr);
  2520   2520   }
  2521   2521   
  2522   2522   /*
  2523   2523    *----------------------------------------------------------------------
  2524   2524    *
................................................................................
  2721   2721   	     * reach zero, and memory may leak.  Bugs 467523, 3357771
  2722   2722   	     *
  2723   2723   	     * NOTE:  [Bugs 3392070, 3389764] We make a copy based completely
  2724   2724   	     * on the string value, and do not call Tcl_DuplicateObj() so we
  2725   2725                * can be sure we do not have any lingering cycles hiding in
  2726   2726   	     * the intrep.
  2727   2727   	     */
  2728         -	    int numBytes;
  2729         -	    const char *bytes = TclGetStringFromObj(objPtr, &numBytes);
         2728  +	    const char *bytes = TclGetString(objPtr);
         2729  +	    size_t numBytes = objPtr->length;
  2730   2730   	    Tcl_Obj *copyPtr = Tcl_NewStringObj(bytes, numBytes);
  2731   2731   
  2732   2732   	    Tcl_IncrRefCount(copyPtr);
  2733   2733   	    TclReleaseLiteral((Tcl_Interp *)envPtr->iPtr, objPtr);
  2734   2734   
  2735   2735   	    envPtr->literalArrayPtr[i].objPtr = copyPtr;
  2736   2736   	}
................................................................................
  2779   2779   
  2780   2780       if (envPtr->iPtr->varFramePtr != NULL) {
  2781   2781   	namespacePtr = envPtr->iPtr->varFramePtr->nsPtr;
  2782   2782       } else {
  2783   2783   	namespacePtr = envPtr->iPtr->globalNsPtr;
  2784   2784       }
  2785   2785   
  2786         -    p = ckalloc(structureSize);
         2786  +    p = Tcl_Alloc(structureSize);
  2787   2787       codePtr = (ByteCode *) p;
  2788   2788       codePtr->interpHandle = TclHandlePreserve(iPtr->handle);
  2789   2789       codePtr->compileEpoch = iPtr->compileEpoch;
  2790   2790       codePtr->nsPtr = namespacePtr;
  2791   2791       codePtr->nsEpoch = namespacePtr->resolverEpoch;
  2792   2792       codePtr->refCount = 0;
  2793   2793       TclPreserveByteCode(codePtr);
................................................................................
  2926   2926    */
  2927   2927   
  2928   2928   int
  2929   2929   TclFindCompiledLocal(
  2930   2930       register const char *name,	/* Points to first character of the name of a
  2931   2931   				 * scalar or array variable. If NULL, a
  2932   2932   				 * temporary var should be created. */
  2933         -    int nameBytes,		/* Number of bytes in the name. */
         2933  +    size_t nameBytes,		/* Number of bytes in the name. */
  2934   2934       int create,			/* If 1, allocate a local frame entry for the
  2935   2935   				 * variable if it is new. */
  2936   2936       CompileEnv *envPtr)		/* Points to the current compile environment*/
  2937   2937   {
  2938   2938       register CompiledLocal *localPtr;
  2939   2939       int localVar = -1;
  2940   2940       register int i;
................................................................................
  2952   2952   	 * Compiling a non-body script: give it read access to the LVT in the
  2953   2953   	 * current localCache
  2954   2954   	 */
  2955   2955   
  2956   2956   	LocalCache *cachePtr = envPtr->iPtr->varFramePtr->localCachePtr;
  2957   2957   	const char *localName;
  2958   2958   	Tcl_Obj **varNamePtr;
  2959         -	int len;
         2959  +	size_t len;
  2960   2960   
  2961   2961   	if (!cachePtr || !name) {
  2962   2962   	    return -1;
  2963   2963   	}
  2964   2964   
  2965   2965   	varNamePtr = &cachePtr->varName0;
  2966   2966   	for (i=0; i < cachePtr->numVars; varNamePtr++, i++) {
................................................................................
  2979   2979   	int localCt = procPtr->numCompiledLocals;
  2980   2980   
  2981   2981   	localPtr = procPtr->firstLocalPtr;
  2982   2982   	for (i = 0;  i < localCt;  i++) {
  2983   2983   	    if (!TclIsVarTemporary(localPtr)) {
  2984   2984   		char *localName = localPtr->name;
  2985   2985   
  2986         -		if ((nameBytes == localPtr->nameLength) &&
  2987         -			(strncmp(name,localName,(unsigned)nameBytes) == 0)) {
         2986  +		if ((nameBytes == (size_t)localPtr->nameLength) &&
         2987  +			(strncmp(name,localName,nameBytes) == 0)) {
  2988   2988   		    return i;
  2989   2989   		}
  2990   2990   	    }
  2991   2991   	    localPtr = localPtr->nextPtr;
  2992   2992   	}
  2993   2993       }
  2994   2994   
  2995   2995       /*
  2996   2996        * Create a new variable if appropriate.
  2997   2997        */
  2998   2998   
  2999   2999       if (create || (name == NULL)) {
  3000   3000   	localVar = procPtr->numCompiledLocals;
  3001         -	localPtr = ckalloc(TclOffset(CompiledLocal, name) + nameBytes + 1);
         3001  +	localPtr = Tcl_Alloc(TclOffset(CompiledLocal, name) + nameBytes + 1);
  3002   3002   	if (procPtr->firstLocalPtr == NULL) {
  3003   3003   	    procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr;
  3004   3004   	} else {
  3005   3005   	    procPtr->lastLocalPtr->nextPtr = localPtr;
  3006   3006   	    procPtr->lastLocalPtr = localPtr;
  3007   3007   	}
  3008   3008   	localPtr->nextPtr = NULL;
................................................................................
  3058   3058        * [inclusive].
  3059   3059        */
  3060   3060   
  3061   3061       size_t currBytes = envPtr->codeNext - envPtr->codeStart;
  3062   3062       size_t newBytes = 2 * (envPtr->codeEnd - envPtr->codeStart);
  3063   3063   
  3064   3064       if (envPtr->mallocedCodeArray) {
  3065         -	envPtr->codeStart = ckrealloc(envPtr->codeStart, newBytes);
         3065  +	envPtr->codeStart = Tcl_Realloc(envPtr->codeStart, newBytes);
  3066   3066       } else {
  3067   3067   	/*
  3068         -	 * envPtr->codeStart isn't a ckalloc'd pointer, so we must code a
  3069         -	 * ckrealloc equivalent for ourselves.
         3068  +	 * envPtr->codeStart isn't a Tcl_Alloc'd pointer, so we must code a
         3069  +	 * Tcl_Realloc equivalent for ourselves.
  3070   3070   	 */
  3071   3071   
  3072         -	unsigned char *newPtr = ckalloc(newBytes);
         3072  +	unsigned char *newPtr = Tcl_Alloc(newBytes);
  3073   3073   
  3074   3074   	memcpy(newPtr, envPtr->codeStart, currBytes);
  3075   3075   	envPtr->codeStart = newPtr;
  3076   3076   	envPtr->mallocedCodeArray = 1;
  3077   3077       }
  3078   3078   
  3079   3079       envPtr->codeNext = envPtr->codeStart + currBytes;
................................................................................
  3125   3125   
  3126   3126   	size_t currElems = envPtr->cmdMapEnd;
  3127   3127   	size_t newElems = 2 * currElems;
  3128   3128   	size_t currBytes = currElems * sizeof(CmdLocation);
  3129   3129   	size_t newBytes = newElems * sizeof(CmdLocation);
  3130   3130   
  3131   3131   	if (envPtr->mallocedCmdMap) {
  3132         -	    envPtr->cmdMapPtr = ckrealloc(envPtr->cmdMapPtr, newBytes);
         3132  +	    envPtr->cmdMapPtr = Tcl_Realloc(envPtr->cmdMapPtr, newBytes);
  3133   3133   	} else {
  3134   3134   	    /*
  3135         -	     * envPtr->cmdMapPtr isn't a ckalloc'd pointer, so we must code a
  3136         -	     * ckrealloc equivalent for ourselves.
         3135  +	     * envPtr->cmdMapPtr isn't a Tcl_Alloc'd pointer, so we must code a
         3136  +	     * Tcl_Realloc equivalent for ourselves.
  3137   3137   	     */
  3138   3138   
  3139         -	    CmdLocation *newPtr = ckalloc(newBytes);
         3139  +	    CmdLocation *newPtr = Tcl_Alloc(newBytes);
  3140   3140   
  3141   3141   	    memcpy(newPtr, envPtr->cmdMapPtr, currBytes);
  3142   3142   	    envPtr->cmdMapPtr = newPtr;
  3143   3143   	    envPtr->mallocedCmdMap = 1;
  3144   3144   	}
  3145   3145   	envPtr->cmdMapEnd = newElems;
  3146   3146       }
................................................................................
  3251   3251   	 * to eclPtr->loc[eclPtr->nuloc-1] (inclusive).
  3252   3252   	 */
  3253   3253   
  3254   3254   	size_t currElems = eclPtr->nloc;
  3255   3255   	size_t newElems = (currElems ? 2*currElems : 1);
  3256   3256   	size_t newBytes = newElems * sizeof(ECL);
  3257   3257   
  3258         -	eclPtr->loc = ckrealloc(eclPtr->loc, newBytes);
         3258  +	eclPtr->loc = Tcl_Realloc(eclPtr->loc, newBytes);
  3259   3259   	eclPtr->nloc = newElems;
  3260   3260       }
  3261   3261   
  3262   3262       ePtr = &eclPtr->loc[eclPtr->nuloc];
  3263   3263       ePtr->srcOffset = srcOffset;
  3264         -    ePtr->line = ckalloc(numWords * sizeof(int));
  3265         -    ePtr->next = ckalloc(numWords * sizeof(int *));
         3264  +    ePtr->line = Tcl_Alloc(numWords * sizeof(int));
         3265  +    ePtr->next = Tcl_Alloc(numWords * sizeof(int *));
  3266   3266       ePtr->nline = numWords;
  3267         -    wwlines = ckalloc(numWords * sizeof(int));
         3267  +    wwlines = Tcl_Alloc(numWords * sizeof(int));
  3268   3268   
  3269   3269       last = cmd;
  3270   3270       wordLine = line;
  3271   3271       wordNext = clNext;
  3272   3272       for (wordIdx=0 ; wordIdx<numWords;
  3273   3273   	    wordIdx++, tokenPtr += tokenPtr->numComponents + 1) {
  3274   3274   	TclAdvanceLines(&wordLine, last, tokenPtr->start);
................................................................................
  3329   3329   	size_t currBytes2 = envPtr->exceptArrayNext * sizeof(ExceptionAux);
  3330   3330   	int newElems = 2*envPtr->exceptArrayEnd;
  3331   3331   	size_t newBytes = newElems * sizeof(ExceptionRange);
  3332   3332   	size_t newBytes2 = newElems * sizeof(ExceptionAux);
  3333   3333   
  3334   3334   	if (envPtr->mallocedExceptArray) {
  3335   3335   	    envPtr->exceptArrayPtr =
  3336         -		    ckrealloc(envPtr->exceptArrayPtr, newBytes);
         3336  +		    Tcl_Realloc(envPtr->exceptArrayPtr, newBytes);
  3337   3337   	    envPtr->exceptAuxArrayPtr =
  3338         -		    ckrealloc(envPtr->exceptAuxArrayPtr, newBytes2);
         3338  +		    Tcl_Realloc(envPtr->exceptAuxArrayPtr, newBytes2);
  3339   3339   	} else {
  3340   3340   	    /*
  3341         -	     * envPtr->exceptArrayPtr isn't a ckalloc'd pointer, so we must
  3342         -	     * code a ckrealloc equivalent for ourselves.
         3341  +	     * envPtr->exceptArrayPtr isn't a Tcl_Alloc'd pointer, so we must
         3342  +	     * code a Tcl_Realloc equivalent for ourselves.
  3343   3343   	     */
  3344   3344   
  3345         -	    ExceptionRange *newPtr = ckalloc(newBytes);
  3346         -	    ExceptionAux *newPtr2 = ckalloc(newBytes2);
         3345  +	    ExceptionRange *newPtr = Tcl_Alloc(newBytes);
         3346  +	    ExceptionAux *newPtr2 = Tcl_Alloc(newBytes2);
  3347   3347   
  3348   3348   	    memcpy(newPtr, envPtr->exceptArrayPtr, currBytes);
  3349   3349   	    memcpy(newPtr2, envPtr->exceptAuxArrayPtr, currBytes2);
  3350   3350   	    envPtr->exceptArrayPtr = newPtr;
  3351   3351   	    envPtr->exceptAuxArrayPtr = newPtr2;
  3352   3352   	    envPtr->mallocedExceptArray = 1;
  3353   3353   	}
................................................................................
  3442   3442   	Tcl_Panic("trying to add 'break' fixup to full exception range");
  3443   3443       }
  3444   3444   
  3445   3445       if (++auxPtr->numBreakTargets > auxPtr->allocBreakTargets) {
  3446   3446   	auxPtr->allocBreakTargets *= 2;
  3447   3447   	auxPtr->allocBreakTargets += 2;
  3448   3448   	if (auxPtr->breakTargets) {
  3449         -	    auxPtr->breakTargets = ckrealloc(auxPtr->breakTargets,
         3449  +	    auxPtr->breakTargets = Tcl_Realloc(auxPtr->breakTargets,
  3450   3450   		    sizeof(int) * auxPtr->allocBreakTargets);
  3451   3451   	} else {
  3452   3452   	    auxPtr->breakTargets =
  3453         -		    ckalloc(sizeof(int) * auxPtr->allocBreakTargets);
         3453  +		    Tcl_Alloc(sizeof(int) * auxPtr->allocBreakTargets);
  3454   3454   	}
  3455   3455       }
  3456   3456       auxPtr->breakTargets[auxPtr->numBreakTargets - 1] = CurrentOffset(envPtr);
  3457   3457       TclEmitInstInt4(INST_JUMP4, 0, envPtr);
  3458   3458   }
  3459   3459   
  3460   3460   void
................................................................................
  3468   3468   	Tcl_Panic("trying to add 'continue' fixup to full exception range");
  3469   3469       }
  3470   3470   
  3471   3471       if (++auxPtr->numContinueTargets > auxPtr->allocContinueTargets) {
  3472   3472   	auxPtr->allocContinueTargets *= 2;
  3473   3473   	auxPtr->allocContinueTargets += 2;
  3474   3474   	if (auxPtr->continueTargets) {
  3475         -	    auxPtr->continueTargets = ckrealloc(auxPtr->continueTargets,
         3475  +	    auxPtr->continueTargets = Tcl_Realloc(auxPtr->continueTargets,
  3476   3476   		    sizeof(int) * auxPtr->allocContinueTargets);
  3477   3477   	} else {
  3478   3478   	    auxPtr->continueTargets =
  3479         -		    ckalloc(sizeof(int) * auxPtr->allocContinueTargets);
         3479  +		    Tcl_Alloc(sizeof(int) * auxPtr->allocContinueTargets);
  3480   3480   	}
  3481   3481       }
  3482   3482       auxPtr->continueTargets[auxPtr->numContinueTargets - 1] =
  3483   3483   	    CurrentOffset(envPtr);
  3484   3484       TclEmitInstInt4(INST_JUMP4, 0, envPtr);
  3485   3485   }
  3486   3486   
................................................................................
  3634   3634       }
  3635   3635   
  3636   3636       /*
  3637   3637        * Drop the arrays we were holding the only reference to.
  3638   3638        */
  3639   3639   
  3640   3640       if (auxPtr->breakTargets) {
  3641         -	ckfree(auxPtr->breakTargets);
         3641  +	Tcl_Free(auxPtr->breakTargets);
  3642   3642   	auxPtr->breakTargets = NULL;
  3643   3643   	auxPtr->numBreakTargets = 0;
  3644   3644       }
  3645   3645       if (auxPtr->continueTargets) {
  3646         -	ckfree(auxPtr->continueTargets);
         3646  +	Tcl_Free(auxPtr->continueTargets);
  3647   3647   	auxPtr->continueTargets = NULL;
  3648   3648   	auxPtr->numContinueTargets = 0;
  3649   3649       }
  3650   3650   }
  3651   3651   
  3652   3652   /*
  3653   3653    *----------------------------------------------------------------------
................................................................................
  3695   3695   
  3696   3696   	size_t currBytes = envPtr->auxDataArrayNext * sizeof(AuxData);
  3697   3697   	int newElems = 2*envPtr->auxDataArrayEnd;
  3698   3698   	size_t newBytes = newElems * sizeof(AuxData);
  3699   3699   
  3700   3700   	if (envPtr->mallocedAuxDataArray) {
  3701   3701   	    envPtr->auxDataArrayPtr =
  3702         -		    ckrealloc(envPtr->auxDataArrayPtr, newBytes);
         3702  +		    Tcl_Realloc(envPtr->auxDataArrayPtr, newBytes);
  3703   3703   	} else {
  3704   3704   	    /*
  3705         -	     * envPtr->auxDataArrayPtr isn't a ckalloc'd pointer, so we must
  3706         -	     * code a ckrealloc equivalent for ourselves.
         3705  +	     * envPtr->auxDataArrayPtr isn't a Tcl_Alloc'd pointer, so we must
         3706  +	     * code a Tcl_Realloc equivalent for ourselves.
  3707   3707   	     */
  3708   3708   
  3709         -	    AuxData *newPtr = ckalloc(newBytes);
         3709  +	    AuxData *newPtr = Tcl_Alloc(newBytes);
  3710   3710   
  3711   3711   	    memcpy(newPtr, envPtr->auxDataArrayPtr, currBytes);
  3712   3712   	    envPtr->auxDataArrayPtr = newPtr;
  3713   3713   	    envPtr->mallocedAuxDataArray = 1;
  3714   3714   	}
  3715   3715   	envPtr->auxDataArrayEnd = newElems;
  3716   3716       }
................................................................................
  3784   3784        */
  3785   3785   
  3786   3786       size_t currBytes = fixupArrayPtr->next * sizeof(JumpFixup);
  3787   3787       int newElems = 2*(fixupArrayPtr->end + 1);
  3788   3788       size_t newBytes = newElems * sizeof(JumpFixup);
  3789   3789   
  3790   3790       if (fixupArrayPtr->mallocedArray) {
  3791         -	fixupArrayPtr->fixup = ckrealloc(fixupArrayPtr->fixup, newBytes);
         3791  +	fixupArrayPtr->fixup = Tcl_Realloc(fixupArrayPtr->fixup, newBytes);
  3792   3792       } else {
  3793   3793   	/*
  3794         -	 * fixupArrayPtr->fixup isn't a ckalloc'd pointer, so we must code a
  3795         -	 * ckrealloc equivalent for ourselves.
         3794  +	 * fixupArrayPtr->fixup isn't a Tcl_Alloc'd pointer, so we must code a
         3795  +	 * Tcl_Realloc equivalent for ourselves.
  3796   3796   	 */
  3797   3797   
  3798         -	JumpFixup *newPtr = ckalloc(newBytes);
         3798  +	JumpFixup *newPtr = Tcl_Alloc(newBytes);
  3799   3799   
  3800   3800   	memcpy(newPtr, fixupArrayPtr->fixup, currBytes);
  3801   3801   	fixupArrayPtr->fixup = newPtr;
  3802   3802   	fixupArrayPtr->mallocedArray = 1;
  3803   3803       }
  3804   3804       fixupArrayPtr->end = newElems;
  3805   3805   }
................................................................................
  3823   3823   void
  3824   3824   TclFreeJumpFixupArray(
  3825   3825       register JumpFixupArray *fixupArrayPtr)
  3826   3826   				/* Points to the JumpFixupArray structure to
  3827   3827   				 * free. */
  3828   3828   {
  3829   3829       if (fixupArrayPtr->mallocedArray) {
  3830         -	ckfree(fixupArrayPtr->fixup);
         3830  +	Tcl_Free(fixupArrayPtr->fixup);
  3831   3831       }
  3832   3832   }
  3833   3833   
  3834   3834   /*
  3835   3835    *----------------------------------------------------------------------
  3836   3836    *
  3837   3837    * TclEmitForwardJump --
................................................................................
  3923   3923   				 * describes the forward jump. */
  3924   3924       int jumpDist,		/* Jump distance to set in jump instr. */
  3925   3925       int distThreshold)		/* Maximum distance before the two byte jump
  3926   3926   				 * is grown to five bytes. */
  3927   3927   {
  3928   3928       unsigned char *jumpPc, *p;
  3929   3929       int firstCmd, lastCmd, firstRange, lastRange, k;
  3930         -    unsigned numBytes;
         3930  +    size_t numBytes;
  3931   3931   
  3932   3932       if (jumpDist <= distThreshold) {
  3933   3933   	jumpPc = envPtr->codeStart + jumpFixupPtr->codeOffset;
  3934   3934   	switch (jumpFixupPtr->jumpType) {
  3935   3935   	case TCL_UNCONDITIONAL_JUMP:
  3936   3936   	    TclUpdateInstInt1AtPc(INST_JUMP1, jumpDist, jumpPc);
  3937   3937   	    break;

Changes to generic/tclCompile.h.

   177    177    * in the byte code. The association with a ByteCode structure BC is done
   178    178    * through the 'lineBCPtr' HashTable in Interp, keyed by the address of BC.
   179    179    * Also recorded is information coming from the context, i.e. type of the
   180    180    * frame and associated information, like the path of a sourced file.
   181    181    */
   182    182   
   183    183   typedef struct {
   184         -    int srcOffset;		/* Command location to find the entry. */
          184  +    size_t srcOffset;		/* Command location to find the entry. */
   185    185       int nline;			/* Number of words in the command */
   186    186       int *line;			/* Line information for all words in the
   187    187   				 * command. */
   188    188       int **next;			/* Transient information used by the compiler
   189    189   				 * for tracking of hidden continuation
   190    190   				 * lines. */
   191    191   } ECL;
................................................................................
   213    213    *
   214    214    * The following definitions declare the types of procedures that are called
   215    215    * to duplicate or free this auxiliary data when the containing ByteCode
   216    216    * objects are duplicated and freed. Pointers to these procedures are kept in
   217    217    * the AuxData structure.
   218    218    */
   219    219   
   220         -typedef ClientData (AuxDataDupProc)  (ClientData clientData);
   221         -typedef void	   (AuxDataFreeProc) (ClientData clientData);
   222         -typedef void	   (AuxDataPrintProc)(ClientData clientData,
          220  +typedef void *(AuxDataDupProc)  (void *clientData);
          221  +typedef void	   (AuxDataFreeProc) (void *clientData);
          222  +typedef void	   (AuxDataPrintProc)(void *clientData,
   223    223   			    Tcl_Obj *appendObj, struct ByteCode *codePtr,
   224    224   			    unsigned int pcOffset);
   225    225   
   226    226   /*
   227    227    * We define a separate AuxDataType struct to hold type-related information
   228    228    * for the AuxData structure. This separation makes it possible for clients
   229    229    * outside of the TCL core to manipulate (in a limited fashion!) AuxData; for
................................................................................
   262    262    * during compilation by CompileProcs and used by instructions during
   263    263    * execution.
   264    264    */
   265    265   
   266    266   typedef struct AuxData {
   267    267       const AuxDataType *type;	/* Pointer to the AuxData type associated with
   268    268   				 * this ClientData. */
   269         -    ClientData clientData;	/* The compilation data itself. */
          269  +    void *clientData;	/* The compilation data itself. */
   270    270   } AuxData;
   271    271   
   272    272   /*
   273    273    * Structure defining the compilation environment. After compilation, fields
   274    274    * describing bytecode instructions are copied out into the more compact
   275    275    * ByteCode structure defined below.
   276    276    */
................................................................................
   838    838       OPERAND_LIT4,		/* Four byte unsigned index into table of
   839    839   				 * literals. */
   840    840       OPERAND_SCLS1		/* Index into tclStringClassTable. */
   841    841   } InstOperandType;
   842    842   
   843    843   typedef struct InstructionDesc {
   844    844       const char *name;		/* Name of instruction. */
   845         -    int numBytes;		/* Total number of bytes for instruction. */
          845  +    size_t numBytes;		/* Total number of bytes for instruction. */
   846    846       int stackEffect;		/* The worst-case balance stack effect of the
   847    847   				 * instruction, used for stack requirements
   848    848   				 * computations. The value INT_MIN signals
   849    849   				 * that the instruction's worst case effect is
   850    850   				 * (1-opnd1). */
   851    851       int numOperands;		/* Number of operands. */
   852    852       InstOperandType opTypes[MAX_INSTRUCTION_OPERANDS];
................................................................................
   996    996   /*
   997    997    * Structure used to hold information about a [dict update] command that is
   998    998    * needed during program execution. These structures are stored in CompileEnv
   999    999    * and ByteCode structures as auxiliary data.
  1000   1000    */
  1001   1001   
  1002   1002   typedef struct {
  1003         -    int length;			/* Size of array */
         1003  +    size_t length;		/* Size of array */
  1004   1004       int varIndices[1];		/* Array of variable indices to manage when
  1005   1005   				 * processing the start and end of a [dict
  1006   1006   				 * update]. There is really more than one
  1007   1007   				 * entry, and the structure is allocated to
  1008   1008   				 * take account of this. MUST BE LAST FIELD IN
  1009   1009   				 * STRUCTURE. */
  1010   1010   } DictUpdateInfo;
................................................................................
  1051   1051   			    CompileEnv *envPtr);
  1052   1052   MODULE_SCOPE void	TclCleanupStackForBreakContinue(CompileEnv *envPtr,
  1053   1053   			    ExceptionAux *auxPtr);
  1054   1054   MODULE_SCOPE void	TclCompileCmdWord(Tcl_Interp *interp,
  1055   1055   			    Tcl_Token *tokenPtr, int count,
  1056   1056   			    CompileEnv *envPtr);
  1057   1057   MODULE_SCOPE void	TclCompileExpr(Tcl_Interp *interp, const char *script,
  1058         -			    int numBytes, CompileEnv *envPtr, int optimize);
         1058  +			    size_t numBytes, CompileEnv *envPtr, int optimize);
  1059   1059   MODULE_SCOPE void	TclCompileExprWords(Tcl_Interp *interp,
  1060   1060   			    Tcl_Token *tokenPtr, int numWords,
  1061   1061   			    CompileEnv *envPtr);
  1062   1062   MODULE_SCOPE void	TclCompileInvocation(Tcl_Interp *interp,
  1063   1063   			    Tcl_Token *tokenPtr, Tcl_Obj *cmdObj, int numWords,
  1064   1064   			    CompileEnv *envPtr);
  1065   1065   MODULE_SCOPE void	TclCompileScript(Tcl_Interp *interp,
  1066         -			    const char *script, int numBytes,
         1066  +			    const char *script, size_t numBytes,
  1067   1067   			    CompileEnv *envPtr);
  1068   1068   MODULE_SCOPE void	TclCompileSyntaxError(Tcl_Interp *interp,
  1069   1069   			    CompileEnv *envPtr);
  1070   1070   MODULE_SCOPE void	TclCompileTokens(Tcl_Interp *interp,
  1071   1071   			    Tcl_Token *tokenPtr, int count,
  1072   1072   			    CompileEnv *envPtr);
  1073   1073   MODULE_SCOPE void	TclCompileVarSubst(Tcl_Interp *interp,
  1074   1074   			    Tcl_Token *tokenPtr, CompileEnv *envPtr);
  1075         -MODULE_SCOPE int	TclCreateAuxData(ClientData clientData,
         1075  +MODULE_SCOPE int	TclCreateAuxData(void *clientData,
  1076   1076   			    const AuxDataType *typePtr, CompileEnv *envPtr);
  1077   1077   MODULE_SCOPE int	TclCreateExceptRange(ExceptionRangeType type,
  1078   1078   			    CompileEnv *envPtr);
  1079         -MODULE_SCOPE ExecEnv *	TclCreateExecEnv(Tcl_Interp *interp, int size);
         1079  +MODULE_SCOPE ExecEnv *	TclCreateExecEnv(Tcl_Interp *interp, size_t size);
  1080   1080   MODULE_SCOPE Tcl_Obj *	TclCreateLiteral(Interp *iPtr, const char *bytes,
  1081         -			    int length, unsigned int hash, int *newPtr,
         1081  +			    size_t length, size_t hash, int *newPtr,
  1082   1082   			    Namespace *nsPtr, int flags,
  1083   1083   			    LiteralEntry **globalPtrPtr);
  1084   1084   MODULE_SCOPE void	TclDeleteExecEnv(ExecEnv *eePtr);
  1085   1085   MODULE_SCOPE void	TclDeleteLiteralTable(Tcl_Interp *interp,
  1086   1086   			    LiteralTable *tablePtr);
  1087   1087   MODULE_SCOPE void	TclEmitForwardJump(CompileEnv *envPtr,
  1088   1088   			    TclJumpType jumpType, JumpFixup *jumpFixupPtr);
  1089   1089   MODULE_SCOPE void	TclEmitInvoke(CompileEnv *envPtr, int opcode, ...);
  1090   1090   MODULE_SCOPE ExceptionRange * TclGetExceptionRangeForPc(unsigned char *pc,
  1091   1091   			    int catchOnly, ByteCode *codePtr);
  1092   1092   MODULE_SCOPE void	TclExpandJumpFixupArray(JumpFixupArray *fixupArrayPtr);
  1093   1093   MODULE_SCOPE int	TclNRExecuteByteCode(Tcl_Interp *interp,
  1094   1094   			    ByteCode *codePtr);
  1095         -MODULE_SCOPE Tcl_Obj *	TclFetchLiteral(CompileEnv *envPtr, unsigned int index);
  1096         -MODULE_SCOPE int	TclFindCompiledLocal(const char *name, int nameChars,
         1095  +MODULE_SCOPE Tcl_Obj *	TclFetchLiteral(CompileEnv *envPtr, size_t index);
         1096  +MODULE_SCOPE int	TclFindCompiledLocal(const char *name, size_t nameChars,
  1097   1097   			    int create, CompileEnv *envPtr);
  1098   1098   MODULE_SCOPE int	TclFixupForwardJump(CompileEnv *envPtr,
  1099   1099   			    JumpFixup *jumpFixupPtr, int jumpDist,
  1100   1100   			    int distThreshold);
  1101   1101   MODULE_SCOPE void	TclFreeCompileEnv(CompileEnv *envPtr);
  1102   1102   MODULE_SCOPE void	TclFreeJumpFixupArray(JumpFixupArray *fixupArrayPtr);
  1103   1103   MODULE_SCOPE int	TclGetIndexFromToken(Tcl_Token *tokenPtr,
  1104   1104   			    int before, int after, int *indexPtr);
  1105   1105   MODULE_SCOPE ByteCode *	TclInitByteCode(CompileEnv *envPtr);
  1106   1106   MODULE_SCOPE ByteCode *	TclInitByteCodeObj(Tcl_Obj *objPtr,
  1107   1107   			    const Tcl_ObjType *typePtr, CompileEnv *envPtr);
  1108   1108   MODULE_SCOPE void	TclInitCompileEnv(Tcl_Interp *interp,
  1109   1109   			    CompileEnv *envPtr, const char *string,
  1110         -			    int numBytes, const CmdFrame *invoker, int word);
         1110  +			    size_t numBytes, const CmdFrame *invoker, int word);
  1111   1111   MODULE_SCOPE void	TclInitJumpFixupArray(JumpFixupArray *fixupArrayPtr);
  1112   1112   MODULE_SCOPE void	TclInitLiteralTable(LiteralTable *tablePtr);
  1113   1113   MODULE_SCOPE ExceptionRange *TclGetInnermostExceptionRange(CompileEnv *envPtr,
  1114   1114   			    int returnCode, ExceptionAux **auxPtrPtr);
  1115   1115   MODULE_SCOPE void	TclAddLoopBreakFixup(CompileEnv *envPtr,
  1116   1116   			    ExceptionAux *auxPtr);
  1117   1117   MODULE_SCOPE void	TclAddLoopContinueFixup(CompileEnv *envPtr,
................................................................................
  1118   1118   			    ExceptionAux *auxPtr);
  1119   1119   MODULE_SCOPE void	TclFinalizeLoopExceptionRange(CompileEnv *envPtr,
  1120   1120   			    int range);
  1121   1121   #ifdef TCL_COMPILE_STATS
  1122   1122   MODULE_SCOPE char *	TclLiteralStats(LiteralTable *tablePtr);
  1123   1123   MODULE_SCOPE int	TclLog2(int value);
  1124   1124   #endif
  1125         -MODULE_SCOPE int	TclLocalScalar(const char *bytes, int numBytes,
         1125  +MODULE_SCOPE int	TclLocalScalar(const char *bytes, size_t numBytes,
  1126   1126   			    CompileEnv *envPtr);
  1127   1127   MODULE_SCOPE int	TclLocalScalarFromToken(Tcl_Token *tokenPtr,
  1128   1128   			    CompileEnv *envPtr);
  1129   1129   MODULE_SCOPE void	TclOptimizeBytecode(void *envPtr);
  1130   1130   #ifdef TCL_COMPILE_DEBUG
  1131   1131   MODULE_SCOPE void	TclPrintByteCodeObj(Tcl_Interp *interp,
  1132   1132   			    Tcl_Obj *objPtr);
  1133   1133   #endif
  1134   1134   MODULE_SCOPE int	TclPrintInstruction(ByteCode *codePtr,
  1135   1135   			    const unsigned char *pc);
  1136   1136   MODULE_SCOPE void	TclPrintObject(FILE *outFile,
  1137         -			    Tcl_Obj *objPtr, int maxChars);
         1137  +			    Tcl_Obj *objPtr, size_t maxChars);
  1138   1138   MODULE_SCOPE void	TclPrintSource(FILE *outFile,
  1139         -			    const char *string, int maxChars);
         1139  +			    const char *string, size_t maxChars);
  1140   1140   MODULE_SCOPE void	TclPushVarName(Tcl_Interp *interp,
  1141   1141   			    Tcl_Token *varTokenPtr, CompileEnv *envPtr,
  1142   1142   			    int flags, int *localIndexPtr,
  1143   1143   			    int *isScalarPtr);
  1144   1144   MODULE_SCOPE void	TclPreserveByteCode(ByteCode *codePtr);
  1145   1145   MODULE_SCOPE void	TclReleaseByteCode(ByteCode *codePtr);
  1146   1146   MODULE_SCOPE void	TclReleaseLiteral(Tcl_Interp *interp, Tcl_Obj *objPtr);
  1147   1147   MODULE_SCOPE void	TclInvalidateCmdLiteral(Tcl_Interp *interp,
  1148   1148   			    const char *name, Namespace *nsPtr);
  1149         -MODULE_SCOPE int	TclSingleOpCmd(ClientData clientData,
         1149  +MODULE_SCOPE int	TclSingleOpCmd(void *clientData,
         1150  +			    Tcl_Interp *interp, int objc,
         1151  +			    Tcl_Obj *const objv[]);
         1152  +MODULE_SCOPE int	TclSortingOpCmd(void *clientData,
  1150   1153   			    Tcl_Interp *interp, int objc,
  1151   1154   			    Tcl_Obj *const objv[]);
  1152         -MODULE_SCOPE int	TclSortingOpCmd(ClientData clientData,
         1155  +MODULE_SCOPE int	TclVariadicOpCmd(void *clientData,
  1153   1156   			    Tcl_Interp *interp, int objc,
  1154   1157   			    Tcl_Obj *const objv[]);
  1155         -MODULE_SCOPE int	TclVariadicOpCmd(ClientData clientData,
  1156         -			    Tcl_Interp *interp, int objc,
  1157         -			    Tcl_Obj *const objv[]);
  1158         -MODULE_SCOPE int	TclNoIdentOpCmd(ClientData clientData,
         1158  +MODULE_SCOPE int	TclNoIdentOpCmd(void *clientData,
  1159   1159   			    Tcl_Interp *interp, int objc,
  1160   1160   			    Tcl_Obj *const objv[]);
  1161   1161   #ifdef TCL_COMPILE_DEBUG
  1162   1162   MODULE_SCOPE void	TclVerifyGlobalLiteralTable(Interp *iPtr);
  1163   1163   MODULE_SCOPE void	TclVerifyLocalLiteralTable(CompileEnv *envPtr);
  1164   1164   #endif
  1165   1165   MODULE_SCOPE int	TclWordKnownAtCompileTime(Tcl_Token *tokenPtr,
  1166   1166   			    Tcl_Obj *valuePtr);
  1167   1167   MODULE_SCOPE void	TclLogCommandInfo(Tcl_Interp *interp,
  1168   1168   			    const char *script, const char *command,
  1169         -			    int length, const unsigned char *pc,
         1169  +			    size_t length, const unsigned char *pc,
  1170   1170   			    Tcl_Obj **tosPtr);
  1171   1171   MODULE_SCOPE Tcl_Obj	*TclGetInnerContext(Tcl_Interp *interp,
  1172   1172   			    const unsigned char *pc, Tcl_Obj **tosPtr);
  1173   1173   MODULE_SCOPE Tcl_Obj	*TclNewInstNameObj(unsigned char inst);
  1174         -MODULE_SCOPE int	TclPushProcCallFrame(ClientData clientData,
         1174  +MODULE_SCOPE int	TclPushProcCallFrame(void *clientData,
  1175   1175   			    register Tcl_Interp *interp, int objc,
  1176   1176   			    Tcl_Obj *const objv[], int isLambda);
  1177   1177   
  1178   1178   
  1179   1179   /*
  1180   1180    *----------------------------------------------------------------
  1181   1181    * Macros and flag values used by Tcl bytecode compilation and execution
................................................................................
  1182   1182    * modules inside the Tcl core but not used outside.
  1183   1183    *----------------------------------------------------------------
  1184   1184    */
  1185   1185   
  1186   1186   /*
  1187   1187    * Simplified form to access AuxData.
  1188   1188    *
  1189         - * ClientData TclFetchAuxData(CompileEng *envPtr, int index);
         1189  + * void *TclFetchAuxData(CompileEng *envPtr, int index);
  1190   1190    */
  1191   1191   
  1192   1192   #define TclFetchAuxData(envPtr, index) \
  1193   1193       (envPtr)->auxDataArrayPtr[(index)].clientData
  1194   1194   
  1195   1195   #define LITERAL_ON_HEAP		0x01
  1196   1196   #define LITERAL_CMD_NAME	0x02
................................................................................
  1501   1501       TclCompileTokens((interp), (tokenPtr)+1, (tokenPtr)->numComponents, \
  1502   1502   	    (envPtr));
  1503   1503   /*
  1504   1504    * Convenience macros for use when pushing literals. The ANSI C "prototype" for
  1505   1505    * these macros are:
  1506   1506    *
  1507   1507    * static void		PushLiteral(CompileEnv *envPtr,
  1508         - *			    const char *string, int length);
         1508  + *			    const char *string, size_t length);
  1509   1509    * static void		PushStringLiteral(CompileEnv *envPtr,
  1510   1510    *			    const char *string);
  1511   1511    */
  1512   1512   
  1513   1513   #define PushLiteral(envPtr, string, length) \
  1514   1514       TclEmitPush(TclRegisterLiteral(envPtr, string, length, 0), (envPtr))
  1515   1515   #define PushStringLiteral(envPtr, string) \
  1516         -    PushLiteral(envPtr, string, (int) (sizeof(string "") - 1))
         1516  +    PushLiteral(envPtr, string, sizeof(string "") - 1)
  1517   1517   
  1518   1518   /*
  1519   1519    * Macro to advance to the next token; it is more mnemonic than the address
  1520   1520    * arithmetic that it replaces. The ANSI C "prototype" for this macro is:
  1521   1521    *
  1522   1522    * static Tcl_Token *	TokenAfter(Tcl_Token *tokenPtr);
  1523   1523    */
................................................................................
  1525   1525   #define TokenAfter(tokenPtr) \
  1526   1526       ((tokenPtr) + ((tokenPtr)->numComponents + 1))
  1527   1527   
  1528   1528   /*
  1529   1529    * Macro to get the offset to the next instruction to be issued. The ANSI C
  1530   1530    * "prototype" for this macro is:
  1531   1531    *
  1532         - * static int	CurrentOffset(CompileEnv *envPtr);
         1532  + * static ptrdiff_t	CurrentOffset(CompileEnv *envPtr);
  1533   1533    */
  1534   1534   
  1535   1535   #define CurrentOffset(envPtr) \
  1536   1536       ((envPtr)->codeNext - (envPtr)->codeStart)
  1537   1537   
  1538   1538   /*
  1539   1539    * Note: the exceptDepth is a bit of a misnomer: TEBC only needs the

Changes to generic/tclConfig.c.

    75     75       const Tcl_Config *configuration,	/* Embedded configuration. */
    76     76       const char *valEncoding)	/* Name of the encoding used to store the
    77     77   				 * configuration values, ASCII, thus UTF-8. */
    78     78   {
    79     79       Tcl_Obj *pDB, *pkgDict;
    80     80       Tcl_DString cmdName;
    81     81       const Tcl_Config *cfg;
    82         -    QCCD *cdPtr = ckalloc(sizeof(QCCD));
           82  +    QCCD *cdPtr = Tcl_Alloc(sizeof(QCCD));
    83     83   
    84     84       cdPtr->interp = interp;
    85     85       if (valEncoding) {
    86         -	cdPtr->encoding = ckalloc(strlen(valEncoding)+1);
           86  +	cdPtr->encoding = Tcl_Alloc(strlen(valEncoding)+1);
    87     87   	strcpy(cdPtr->encoding, valEncoding);
    88     88       } else {
    89     89   	cdPtr->encoding = NULL;
    90     90       }
    91     91       cdPtr->pkg = Tcl_NewStringObj(pkgName, -1);
    92     92   
    93     93       /*
................................................................................
   329    329       QCCD *cdPtr = clientData;
   330    330       Tcl_Obj *pkgName = cdPtr->pkg;
   331    331       Tcl_Obj *pDB = GetConfigDict(cdPtr->interp);
   332    332   
   333    333       Tcl_DictObjRemove(NULL, pDB, pkgName);
   334    334       Tcl_DecrRefCount(pkgName);
   335    335       if (cdPtr->encoding) {
   336         -	ckfree(cdPtr->encoding);
          336  +	Tcl_Free(cdPtr->encoding);
   337    337       }
   338         -    ckfree(cdPtr);
          338  +    Tcl_Free(cdPtr);
   339    339   }
   340    340   
   341    341   /*
   342    342    *-------------------------------------------------------------------------
   343    343    *
   344    344    * GetConfigDict --
   345    345    *

Changes to generic/tclDTrace.d.

   178    178       void *freeIntRepProc;
   179    179       void *dupIntRepProc;
   180    180       void *updateStringProc;
   181    181       void *setFromAnyProc;
   182    182   } Tcl_ObjType;
   183    183   
   184    184   struct Tcl_Obj {
   185         -    int refCount;
          185  +    size_t refCount;
   186    186       char *bytes;
   187         -    int length;
          187  +    size_t length;
   188    188       Tcl_ObjType *typePtr;
   189    189       union {
   190    190   	long longValue;
   191    191   	double doubleValue;
   192    192   	void *otherValuePtr;
   193    193   	int64_t wideValue;
   194    194   	struct {

Changes to generic/tclDate.c.

   181    181       const char *dateStart;
   182    182       const char *dateInput;
   183    183       time_t *dateRelPointer;
   184    184   
   185    185       int dateDigitCount;
   186    186   } DateInfo;
   187    187   
   188         -#define YYMALLOC	ckalloc
   189         -#define YYFREE(x)	(ckfree((void*) (x)))
          188  +#define YYMALLOC	Tcl_Alloc
          189  +#define YYFREE(x)	(Tcl_Free((void*) (x)))
   190    190   
   191    191   #define yyDSTmode	(info->dateDSTmode)
   192    192   #define yyDayOrdinal	(info->dateDayOrdinal)
   193    193   #define yyDayNumber	(info->dateDayNumber)
   194    194   #define yyMonthOrdinal	(info->dateMonthOrdinal)
   195    195   #define yyHaveDate	(info->dateHaveDate)
   196    196   #define yyHaveDay	(info->dateHaveDay)

Changes to generic/tclDecls.h.

    55     55   /* 1 */
    56     56   EXTERN const char *	Tcl_PkgRequireEx(Tcl_Interp *interp,
    57     57   				const char *name, const char *version,
    58     58   				int exact, void *clientDataPtr);
    59     59   /* 2 */
    60     60   EXTERN TCL_NORETURN void Tcl_Panic(const char *format, ...) TCL_FORMAT_PRINTF(1, 2);
    61     61   /* 3 */
    62         -EXTERN char *		Tcl_Alloc(unsigned int size);
           62  +EXTERN void *		Tcl_Alloc(size_t size);
    63     63   /* 4 */
    64         -EXTERN void		Tcl_Free(char *ptr);
           64  +EXTERN void		Tcl_Free(void *ptr);
    65     65   /* 5 */
    66         -EXTERN char *		Tcl_Realloc(char *ptr, unsigned int size);
           66  +EXTERN void *		Tcl_Realloc(void *ptr, size_t size);
    67     67   /* 6 */
    68         -EXTERN char *		Tcl_DbCkalloc(unsigned int size, const char *file,
           68  +EXTERN void *		Tcl_DbCkalloc(size_t size, const char *file,
    69     69   				int line);
    70     70   /* 7 */
    71         -EXTERN void		Tcl_DbCkfree(char *ptr, const char *file, int line);
           71  +EXTERN void		Tcl_DbCkfree(void *ptr, const char *file, int line);
    72     72   /* 8 */
    73         -EXTERN char *		Tcl_DbCkrealloc(char *ptr, unsigned int size,
           73  +EXTERN void *		Tcl_DbCkrealloc(void *ptr, size_t size,
    74     74   				const char *file, int line);
    75     75   #if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
    76     76   /* 9 */
    77     77   EXTERN void		Tcl_CreateFileHandler(int fd, int mask,
    78         -				Tcl_FileProc *proc, ClientData clientData);
           78  +				Tcl_FileProc *proc, void *clientData);
    79     79   #endif /* UNIX */
    80     80   #ifdef MAC_OSX_TCL /* MACOSX */
    81     81   /* 9 */
    82     82   EXTERN void		Tcl_CreateFileHandler(int fd, int mask,
    83         -				Tcl_FileProc *proc, ClientData clientData);
           83  +				Tcl_FileProc *proc, void *clientData);
    84     84   #endif /* MACOSX */
    85     85   #if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
    86     86   /* 10 */
    87     87   EXTERN void		Tcl_DeleteFileHandler(int fd);
    88     88   #endif /* UNIX */
    89     89   #ifdef MAC_OSX_TCL /* MACOSX */
    90     90   /* 10 */
................................................................................
    99     99   /* 14 */
   100    100   EXTERN int		Tcl_AppendAllObjTypes(Tcl_Interp *interp,
   101    101   				Tcl_Obj *objPtr);
   102    102   /* 15 */
   103    103   EXTERN void		Tcl_AppendStringsToObj(Tcl_Obj *objPtr, ...);
   104    104   /* 16 */
   105    105   EXTERN void		Tcl_AppendToObj(Tcl_Obj *objPtr, const char *bytes,
   106         -				int length);
          106  +				size_t length);
   107    107   /* 17 */
   108    108   EXTERN Tcl_Obj *	Tcl_ConcatObj(int objc, Tcl_Obj *const objv[]);
   109    109   /* 18 */
   110    110   EXTERN int		Tcl_ConvertToType(Tcl_Interp *interp,
   111    111   				Tcl_Obj *objPtr, const Tcl_ObjType *typePtr);
   112    112   /* 19 */
   113    113   EXTERN void		Tcl_DbDecrRefCount(Tcl_Obj *objPtr, const char *file,
................................................................................
   117    117   				int line);
   118    118   /* 21 */
   119    119   EXTERN int		Tcl_DbIsShared(Tcl_Obj *objPtr, const char *file,
   120    120   				int line);
   121    121   /* Slot 22 is reserved */
   122    122   /* 23 */
   123    123   EXTERN Tcl_Obj *	Tcl_DbNewByteArrayObj(const unsigned char *bytes,
   124         -				int length, const char *file, int line);
          124  +				size_t length, const char *file, int line);
   125    125   /* 24 */
   126    126   EXTERN Tcl_Obj *	Tcl_DbNewDoubleObj(double doubleValue,
   127    127   				const char *file, int line);
   128    128   /* 25 */
   129    129   EXTERN Tcl_Obj *	Tcl_DbNewListObj(int objc, Tcl_Obj *const *objv,
   130    130   				const char *file, int line);
   131    131   /* Slot 26 is reserved */
   132    132   /* 27 */
   133    133   EXTERN Tcl_Obj *	Tcl_DbNewObj(const char *file, int line);
   134    134   /* 28 */
   135         -EXTERN Tcl_Obj *	Tcl_DbNewStringObj(const char *bytes, int length,
          135  +EXTERN Tcl_Obj *	Tcl_DbNewStringObj(const char *bytes, size_t length,
   136    136   				const char *file, int line);
   137    137   /* 29 */
   138    138   EXTERN Tcl_Obj *	Tcl_DuplicateObj(Tcl_Obj *objPtr);
   139    139   /* 30 */
   140    140   EXTERN void		TclFreeObj(Tcl_Obj *objPtr);
   141    141   /* 31 */
   142    142   EXTERN int		Tcl_GetBoolean(Tcl_Interp *interp, const char *src,
................................................................................
   189    189   /* 48 */
   190    190   EXTERN int		Tcl_ListObjReplace(Tcl_Interp *interp,
   191    191   				Tcl_Obj *listPtr, int first, int count,
   192    192   				int objc, Tcl_Obj *const objv[]);
   193    193   /* Slot 49 is reserved */
   194    194   /* 50 */
   195    195   EXTERN Tcl_Obj *	Tcl_NewByteArrayObj(const unsigned char *bytes,
   196         -				int length);
          196  +				size_t length);
   197    197   /* 51 */
   198    198   EXTERN Tcl_Obj *	Tcl_NewDoubleObj(double doubleValue);
   199    199   /* Slot 52 is reserved */
   200    200   /* 53 */
   201    201   EXTERN Tcl_Obj *	Tcl_NewListObj(int objc, Tcl_Obj *const objv[]);
   202    202   /* Slot 54 is reserved */
   203    203   /* 55 */
   204    204   EXTERN Tcl_Obj *	Tcl_NewObj(void);
   205    205   /* 56 */
   206         -EXTERN Tcl_Obj *	Tcl_NewStringObj(const char *bytes, int length);
          206  +EXTERN Tcl_Obj *	Tcl_NewStringObj(const char *bytes, size_t length);
   207    207   /* Slot 57 is reserved */
   208    208   /* 58 */
   209         -EXTERN unsigned char *	Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int length);
          209  +EXTERN unsigned char *	Tcl_SetByteArrayLength(Tcl_Obj *objPtr,
          210  +				size_t length);
   210    211   /* 59 */
   211    212   EXTERN void		Tcl_SetByteArrayObj(Tcl_Obj *objPtr,
   212         -				const unsigned char *bytes, int length);
          213  +				const unsigned char *bytes, size_t length);
   213    214   /* 60 */
   214    215   EXTERN void		Tcl_SetDoubleObj(Tcl_Obj *objPtr, double doubleValue);
   215    216   /* Slot 61 is reserved */
   216    217   /* 62 */
   217    218   EXTERN void		Tcl_SetListObj(Tcl_Obj *objPtr, int objc,
   218    219   				Tcl_Obj *const objv[]);
   219    220   /* Slot 63 is reserved */
   220    221   /* 64 */
   221         -EXTERN void		Tcl_SetObjLength(Tcl_Obj *objPtr, int length);
          222  +EXTERN void		Tcl_SetObjLength(Tcl_Obj *objPtr, size_t length);
   222    223   /* 65 */
   223    224   EXTERN void		Tcl_SetStringObj(Tcl_Obj *objPtr, const char *bytes,
   224         -				int length);
          225  +				size_t length);
   225    226   /* Slot 66 is reserved */
   226    227   /* Slot 67 is reserved */
   227    228   /* 68 */
   228    229   EXTERN void		Tcl_AllowExceptions(Tcl_Interp *interp);
   229    230   /* 69 */
   230    231   EXTERN void		Tcl_AppendElement(Tcl_Interp *interp,
   231    232   				const char *element);
   232    233   /* 70 */
   233    234   EXTERN void		Tcl_AppendResult(Tcl_Interp *interp, ...);
   234    235   /* 71 */
   235    236   EXTERN Tcl_AsyncHandler	 Tcl_AsyncCreate(Tcl_AsyncProc *proc,
   236         -				ClientData clientData);
          237  +				void *clientData);
   237    238   /* 72 */
   238    239   EXTERN void		Tcl_AsyncDelete(Tcl_AsyncHandler async);
   239    240   /* 73 */
   240    241   EXTERN int		Tcl_AsyncInvoke(Tcl_Interp *interp, int code);
   241    242   /* 74 */
   242    243   EXTERN void		Tcl_AsyncMark(Tcl_AsyncHandler async);
   243    244   /* 75 */
................................................................................
   247    248   /* Slot 77 is reserved */
   248    249   /* 78 */
   249    250   EXTERN int		Tcl_BadChannelOption(Tcl_Interp *interp,
   250    251   				const char *optionName,
   251    252   				const char *optionList);
   252    253   /* 79 */
   253    254   EXTERN void		Tcl_CallWhenDeleted(Tcl_Interp *interp,
   254         -				Tcl_InterpDeleteProc *proc,
   255         -				ClientData clientData);
          255  +				Tcl_InterpDeleteProc *proc, void *clientData);
   256    256   /* 80 */
   257    257   EXTERN void		Tcl_CancelIdleCall(Tcl_IdleProc *idleProc,
   258         -				ClientData clientData);
          258  +				void *clientData);
   259    259   /* 81 */
   260    260   EXTERN int		Tcl_Close(Tcl_Interp *interp, Tcl_Channel chan);
   261    261   /* 82 */
   262    262   EXTERN int		Tcl_CommandComplete(const char *cmd);
   263    263   /* 83 */
   264    264   EXTERN char *		Tcl_Concat(int argc, const char *const *argv);
   265    265   /* 84 */
   266         -EXTERN int		Tcl_ConvertElement(const char *src, char *dst,
          266  +EXTERN size_t		Tcl_ConvertElement(const char *src, char *dst,
   267    267   				int flags);
   268    268   /* 85 */
   269         -EXTERN int		Tcl_ConvertCountedElement(const char *src,
   270         -				int length, char *dst, int flags);
          269  +EXTERN size_t		Tcl_ConvertCountedElement(const char *src,
          270  +				size_t length, char *dst, int flags);
   271    271   /* 86 */
   272    272   EXTERN int		Tcl_CreateAlias(Tcl_Interp *slave,
   273    273   				const char *slaveCmd, Tcl_Interp *target,
   274    274   				const char *targetCmd, int argc,
   275    275   				const char *const *argv);
   276    276   /* 87 */
   277    277   EXTERN int		Tcl_CreateAliasObj(Tcl_Interp *slave,
   278    278   				const char *slaveCmd, Tcl_Interp *target,
   279    279   				const char *targetCmd, int objc,
   280    280   				Tcl_Obj *const objv[]);
   281    281   /* 88 */
   282    282   EXTERN Tcl_Channel	Tcl_CreateChannel(const Tcl_ChannelType *typePtr,
   283         -				const char *chanName,
   284         -				ClientData instanceData, int mask);
          283  +				const char *chanName, void *instanceData,
          284  +				int mask);
   285    285   /* 89 */
   286    286   EXTERN void		Tcl_CreateChannelHandler(Tcl_Channel chan, int mask,
   287         -				Tcl_ChannelProc *proc, ClientData clientData);
          287  +				Tcl_ChannelProc *proc, void *clientData);
   288    288   /* 90 */
   289    289   EXTERN void		Tcl_CreateCloseHandler(Tcl_Channel chan,
   290         -				Tcl_CloseProc *proc, ClientData clientData);
          290  +				Tcl_CloseProc *proc, void *clientData);
   291    291   /* 91 */
   292    292   EXTERN Tcl_Command	Tcl_CreateCommand(Tcl_Interp *interp,
   293    293   				const char *cmdName, Tcl_CmdProc *proc,
   294         -				ClientData clientData,
          294  +				void *clientData,
   295    295   				Tcl_CmdDeleteProc *deleteProc);
   296    296   /* 92 */
   297    297   EXTERN void		Tcl_CreateEventSource(Tcl_EventSetupProc *setupProc,
   298    298   				Tcl_EventCheckProc *checkProc,
   299         -				ClientData clientData);
          299  +				void *clientData);
   300    300   /* 93 */
   301    301   EXTERN void		Tcl_CreateExitHandler(Tcl_ExitProc *proc,
   302         -				ClientData clientData);
          302  +				void *clientData);
   303    303   /* 94 */
   304    304   EXTERN Tcl_Interp *	Tcl_CreateInterp(void);
   305    305   /* Slot 95 is reserved */
   306    306   /* 96 */
   307    307   EXTERN Tcl_Command	Tcl_CreateObjCommand(Tcl_Interp *interp,
   308    308   				const char *cmdName, Tcl_ObjCmdProc *proc,
   309         -				ClientData clientData,
          309  +				void *clientData,
   310    310   				Tcl_CmdDeleteProc *deleteProc);
   311    311   /* 97 */
   312    312   EXTERN Tcl_Interp *	Tcl_CreateSlave(Tcl_Interp *interp,
   313    313   				const char *slaveName, int isSafe);
   314    314   /* 98 */
   315    315   EXTERN Tcl_TimerToken	Tcl_CreateTimerHandler(int milliseconds,
   316         -				Tcl_TimerProc *proc, ClientData clientData);
          316  +				Tcl_TimerProc *proc, void *clientData);
   317    317   /* 99 */
   318    318   EXTERN Tcl_Trace	Tcl_CreateTrace(Tcl_Interp *interp, int level,
   319         -				Tcl_CmdTraceProc *proc,
   320         -				ClientData clientData);
          319  +				Tcl_CmdTraceProc *proc, void *clientData);
   321    320   /* 100 */
   322    321   EXTERN void		Tcl_DeleteAssocData(Tcl_Interp *interp,
   323    322   				const char *name);
   324    323   /* 101 */
   325    324   EXTERN void		Tcl_DeleteChannelHandler(Tcl_Channel chan,
   326         -				Tcl_ChannelProc *proc, ClientData clientData);
          325  +				Tcl_ChannelProc *proc, void *clientData);
   327    326   /* 102 */
   328    327   EXTERN void		Tcl_DeleteCloseHandler(Tcl_Channel chan,
   329         -				Tcl_CloseProc *proc, ClientData clientData);
          328  +				Tcl_CloseProc *proc, void *clientData);
   330    329   /* 103 */
   331    330   EXTERN int		Tcl_DeleteCommand(Tcl_Interp *interp,
   332    331   				const char *cmdName);
   333    332   /* 104 */
   334    333   EXTERN int		Tcl_DeleteCommandFromToken(Tcl_Interp *interp,
   335    334   				Tcl_Command command);
   336    335   /* 105 */
   337    336   EXTERN void		Tcl_DeleteEvents(Tcl_EventDeleteProc *proc,
   338         -				ClientData clientData);
          337  +				void *clientData);
   339    338   /* 106 */
   340    339   EXTERN void		Tcl_DeleteEventSource(Tcl_EventSetupProc *setupProc,
   341    340   				Tcl_EventCheckProc *checkProc,
   342         -				ClientData clientData);
          341  +				void *clientData);
   343    342   /* 107 */
   344    343   EXTERN void		Tcl_DeleteExitHandler(Tcl_ExitProc *proc,
   345         -				ClientData clientData);
          344  +				void *clientData);
   346    345   /* 108 */
   347    346   EXTERN void		Tcl_DeleteHashEntry(Tcl_HashEntry *entryPtr);
   348    347   /* 109 */
   349    348   EXTERN void		Tcl_DeleteHashTable(Tcl_HashTable *tablePtr);
   350    349   /* 110 */
   351    350   EXTERN void		Tcl_DeleteInterp(Tcl_Interp *interp);
   352    351   /* 111 */
................................................................................
   353    352   EXTERN void		Tcl_DetachPids(int numPids, Tcl_Pid *pidPtr);
   354    353   /* 112 */
   355    354   EXTERN void		Tcl_DeleteTimerHandler(Tcl_TimerToken token);
   356    355   /* 113 */
   357    356   EXTERN void		Tcl_DeleteTrace(Tcl_Interp *interp, Tcl_Trace trace);
   358    357   /* 114 */
   359    358   EXTERN void		Tcl_DontCallWhenDeleted(Tcl_Interp *interp,
   360         -				Tcl_InterpDeleteProc *proc,
   361         -				ClientData clientData);
          359  +				Tcl_InterpDeleteProc *proc, void *clientData);
   362    360   /* 115 */
   363    361   EXTERN int		Tcl_DoOneEvent(int flags);
   364    362   /* 116 */
   365         -EXTERN void		Tcl_DoWhenIdle(Tcl_IdleProc *proc,
   366         -				ClientData clientData);
          363  +EXTERN void		Tcl_DoWhenIdle(Tcl_IdleProc *proc, void *clientData);
   367    364   /* 117 */
   368    365   EXTERN char *		Tcl_DStringAppend(Tcl_DString *dsPtr,
   369         -				const char *bytes, int length);
          366  +				const char *bytes, size_t length);
   370    367   /* 118 */
   371    368   EXTERN char *		Tcl_DStringAppendElement(Tcl_DString *dsPtr,
   372    369   				const char *element);
   373    370   /* 119 */
   374    371   EXTERN void		Tcl_DStringEndSublist(Tcl_DString *dsPtr);
   375    372   /* 120 */
   376    373   EXTERN void		Tcl_DStringFree(Tcl_DString *dsPtr);
................................................................................
   379    376   				Tcl_DString *dsPtr);
   380    377   /* 122 */
   381    378   EXTERN void		Tcl_DStringInit(Tcl_DString *dsPtr);
   382    379   /* 123 */
   383    380   EXTERN void		Tcl_DStringResult(Tcl_Interp *interp,
   384    381   				Tcl_DString *dsPtr);
   385    382   /* 124 */
   386         -EXTERN void		Tcl_DStringSetLength(Tcl_DString *dsPtr, int length);
          383  +EXTERN void		Tcl_DStringSetLength(Tcl_DString *dsPtr,
          384  +				size_t length);
   387    385   /* 125 */
   388    386   EXTERN void		Tcl_DStringStartSublist(Tcl_DString *dsPtr);
   389    387   /* 126 */
   390    388   EXTERN int		Tcl_Eof(Tcl_Channel chan);
   391    389   /* 127 */
   392    390   EXTERN const char *	Tcl_ErrnoId(void);
   393    391   /* 128 */
................................................................................
   394    392   EXTERN const char *	Tcl_ErrnoMsg(int err);
   395    393   /* Slot 129 is reserved */
   396    394   /* 130 */
   397    395   EXTERN int		Tcl_EvalFile(Tcl_Interp *interp,
   398    396   				const char *fileName);
   399    397   /* Slot 131 is reserved */
   400    398   /* 132 */
   401         -EXTERN void		Tcl_EventuallyFree(ClientData clientData,
          399  +EXTERN void		Tcl_EventuallyFree(void *clientData,
   402    400   				Tcl_FreeProc *freeProc);
   403    401   /* 133 */
   404    402   EXTERN TCL_NORETURN void Tcl_Exit(int status);
   405    403   /* 134 */
   406    404   EXTERN int		Tcl_ExposeCommand(Tcl_Interp *interp,
   407    405   				const char *hiddenCmdToken,
   408    406   				const char *cmdName);
................................................................................
   449    447   /* 149 */
   450    448   EXTERN int		Tcl_GetAliasObj(Tcl_Interp *interp,
   451    449   				const char *slaveCmd,
   452    450   				Tcl_Interp **targetInterpPtr,
   453    451   				const char **targetCmdPtr, int *objcPtr,
   454    452   				Tcl_Obj ***objv);
   455    453   /* 150 */
   456         -EXTERN ClientData	Tcl_GetAssocData(Tcl_Interp *interp,
          454  +EXTERN void *		Tcl_GetAssocData(Tcl_Interp *interp,
   457    455   				const char *name,
   458    456   				Tcl_InterpDeleteProc **procPtr);
   459    457   /* 151 */
   460    458   EXTERN Tcl_Channel	Tcl_GetChannel(Tcl_Interp *interp,
   461    459   				const char *chanName, int *modePtr);
   462    460   /* 152 */
   463    461   EXTERN int		Tcl_GetChannelBufferSize(Tcl_Channel chan);
   464    462   /* 153 */
   465    463   EXTERN int		Tcl_GetChannelHandle(Tcl_Channel chan, int direction,
   466         -				ClientData *handlePtr);
          464  +				void **handlePtr);
   467    465   /* 154 */
   468         -EXTERN ClientData	Tcl_GetChannelInstanceData(Tcl_Channel chan);
          466  +EXTERN void *		Tcl_GetChannelInstanceData(Tcl_Channel chan);
   469    467   /* 155 */
   470    468   EXTERN int		Tcl_GetChannelMode(Tcl_Channel chan);
   471    469   /* 156 */
   472    470   EXTERN const char *	Tcl_GetChannelName(Tcl_Channel chan);
   473    471   /* 157 */
   474    472   EXTERN int		Tcl_GetChannelOption(Tcl_Interp *interp,
   475    473   				Tcl_Channel chan, const char *optionName,
................................................................................
   495    493   EXTERN const char *	Tcl_GetNameOfExecutable(void);
   496    494   /* 166 */
   497    495   EXTERN Tcl_Obj *	Tcl_GetObjResult(Tcl_Interp *interp);
   498    496   #if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
   499    497   /* 167 */
   500    498   EXTERN int		Tcl_GetOpenFile(Tcl_Interp *interp,
   501    499   				const char *chanID, int forWriting,
   502         -				int checkUsage, ClientData *filePtr);
          500  +				int checkUsage, void **filePtr);
   503    501   #endif /* UNIX */
   504    502   #ifdef MAC_OSX_TCL /* MACOSX */
   505    503   /* 167 */
   506    504   EXTERN int		Tcl_GetOpenFile(Tcl_Interp *interp,
   507    505   				const char *chanID, int forWriting,
   508         -				int checkUsage, ClientData *filePtr);
          506  +				int checkUsage, void **filePtr);
   509    507   #endif /* MACOSX */
   510    508   /* 168 */
   511    509   EXTERN Tcl_PathType	Tcl_GetPathType(const char *path);
   512    510   /* 169 */
   513         -EXTERN int		Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr);
          511  +EXTERN size_t		Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr);
   514    512   /* 170 */
   515         -EXTERN int		Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr);
          513  +EXTERN size_t		Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr);
   516    514   /* 171 */
   517    515   EXTERN int		Tcl_GetServiceMode(void);
   518    516   /* 172 */
   519    517   EXTERN Tcl_Interp *	Tcl_GetSlave(Tcl_Interp *interp,
   520    518   				const char *slaveName);
   521    519   /* 173 */
   522    520   EXTERN Tcl_Channel	Tcl_GetStdChannel(int type);
................................................................................
   549    547   EXTERN char *		Tcl_JoinPath(int argc, const char *const *argv,
   550    548   				Tcl_DString *resultPtr);
   551    549   /* 187 */
   552    550   EXTERN int		Tcl_LinkVar(Tcl_Interp *interp, const char *varName,
   553    551   				char *addr, int type);
   554    552   /* Slot 188 is reserved */
   555    553   /* 189 */
   556         -EXTERN Tcl_Channel	Tcl_MakeFileChannel(ClientData handle, int mode);
          554  +EXTERN Tcl_Channel	Tcl_MakeFileChannel(void *handle, int mode);
   557    555   /* 190 */
   558    556   EXTERN int		Tcl_MakeSafe(Tcl_Interp *interp);
   559    557   /* 191 */
   560         -EXTERN Tcl_Channel	Tcl_MakeTcpClientChannel(ClientData tcpSocket);
          558  +EXTERN Tcl_Channel	Tcl_MakeTcpClientChannel(void *tcpSocket);
   561    559   /* 192 */
   562    560   EXTERN char *		Tcl_Merge(int argc, const char *const *argv);
   563    561   /* 193 */
   564    562   EXTERN Tcl_HashEntry *	Tcl_NextHashEntry(Tcl_HashSearch *searchPtr);
   565    563   /* 194 */
   566    564   EXTERN void		Tcl_NotifyChannel(Tcl_Channel channel, int mask);
   567    565   /* 195 */
................................................................................
   582    580   EXTERN Tcl_Channel	Tcl_OpenTcpClient(Tcl_Interp *interp, int port,
   583    581   				const char *address, const char *myaddr,
   584    582   				int myport, int async);
   585    583   /* 200 */
   586    584   EXTERN Tcl_Channel	Tcl_OpenTcpServer(Tcl_Interp *interp, int port,
   587    585   				const char *host,
   588    586   				Tcl_TcpAcceptProc *acceptProc,
   589         -				ClientData callbackData);
          587  +				void *callbackData);
   590    588   /* 201 */
   591         -EXTERN void		Tcl_Preserve(ClientData data);
          589  +EXTERN void		Tcl_Preserve(void *data);
   592    590   /* 202 */
   593    591   EXTERN void		Tcl_PrintDouble(Tcl_Interp *interp, double value,
   594    592   				char *dst);
   595    593   /* 203 */
   596    594   EXTERN int		Tcl_PutEnv(const char *assignment);
   597    595   /* 204 */
   598    596   EXTERN const char *	Tcl_PosixError(Tcl_Interp *interp);
   599    597   /* 205 */
   600    598   EXTERN void		Tcl_QueueEvent(Tcl_Event *evPtr,
   601    599   				Tcl_QueuePosition position);
   602    600   /* 206 */
   603         -EXTERN int		Tcl_Read(Tcl_Channel chan, char *bufPtr, int toRead);
          601  +EXTERN size_t		Tcl_Read(Tcl_Channel chan, char *bufPtr,
          602  +				size_t toRead);
   604    603   /* 207 */
   605    604   EXTERN void		Tcl_ReapDetachedProcs(void);
   606    605   /* 208 */
   607    606   EXTERN int		Tcl_RecordAndEval(Tcl_Interp *interp,
   608    607   				const char *cmd, int flags);
   609    608   /* 209 */
   610    609   EXTERN int		Tcl_RecordAndEvalObj(Tcl_Interp *interp,
................................................................................
   620    619   /* 213 */
   621    620   EXTERN int		Tcl_RegExpExec(Tcl_Interp *interp, Tcl_RegExp regexp,
   622    621   				const char *text, const char *start);
   623    622   /* 214 */
   624    623   EXTERN int		Tcl_RegExpMatch(Tcl_Interp *interp, const char *text,
   625    624   				const char *pattern);
   626    625   /* 215 */
   627         -EXTERN void		Tcl_RegExpRange(Tcl_RegExp regexp, int index,
          626  +EXTERN void		Tcl_RegExpRange(Tcl_RegExp regexp, size_t index,
   628    627   				const char **startPtr, const char **endPtr);
   629    628   /* 216 */
   630         -EXTERN void		Tcl_Release(ClientData clientData);
          629  +EXTERN void		Tcl_Release(void *clientData);
   631    630   /* 217 */
   632    631   EXTERN void		Tcl_ResetResult(Tcl_Interp *interp);
   633    632   /* 218 */
   634         -EXTERN int		Tcl_ScanElement(const char *src, int *flagPtr);
          633  +EXTERN size_t		Tcl_ScanElement(const char *src, int *flagPtr);
   635    634   /* 219 */
   636         -EXTERN int		Tcl_ScanCountedElement(const char *src, int length,
   637         -				int *flagPtr);
          635  +EXTERN size_t		Tcl_ScanCountedElement(const char *src,
          636  +				size_t length, int *flagPtr);
   638    637   /* Slot 220 is reserved */
   639    638   /* 221 */
   640    639   EXTERN int		Tcl_ServiceAll(void);
   641    640   /* 222 */
   642    641   EXTERN int		Tcl_ServiceEvent(int flags);
   643    642   /* 223 */
   644    643   EXTERN void		Tcl_SetAssocData(Tcl_Interp *interp,
   645    644   				const char *name, Tcl_InterpDeleteProc *proc,
   646         -				ClientData clientData);
          645  +				void *clientData);
   647    646   /* 224 */
   648    647   EXTERN void		Tcl_SetChannelBufferSize(Tcl_Channel chan, int sz);
   649    648   /* 225 */
   650    649   EXTERN int		Tcl_SetChannelOption(Tcl_Interp *interp,
   651    650   				Tcl_Channel chan, const char *optionName,
   652    651   				const char *newValue);
   653    652   /* 226 */
................................................................................
   702    701   /* 245 */
   703    702   EXTERN int		Tcl_StringMatch(const char *str, const char *pattern);
   704    703   /* Slot 246 is reserved */
   705    704   /* Slot 247 is reserved */
   706    705   /* 248 */
   707    706   EXTERN int		Tcl_TraceVar2(Tcl_Interp *interp, const char *part1,
   708    707   				const char *part2, int flags,
   709         -				Tcl_VarTraceProc *proc,
   710         -				ClientData clientData);
          708  +				Tcl_VarTraceProc *proc, void *clientData);
   711    709   /* 249 */
   712    710   EXTERN char *		Tcl_TranslateFileName(Tcl_Interp *interp,
   713    711   				const char *name, Tcl_DString *bufferPtr);
   714    712   /* 250 */
   715         -EXTERN int		Tcl_Ungets(Tcl_Channel chan, const char *str,
   716         -				int len, int atHead);
          713  +EXTERN size_t		Tcl_Ungets(Tcl_Channel chan, const char *str,
          714  +				size_t len, int atHead);
   717    715   /* 251 */
   718    716   EXTERN void		Tcl_UnlinkVar(Tcl_Interp *interp,
   719    717   				const char *varName);
   720    718   /* 252 */
   721    719   EXTERN int		Tcl_UnregisterChannel(Tcl_Interp *interp,
   722    720   				Tcl_Channel chan);
   723    721   /* Slot 253 is reserved */
................................................................................
   725    723   EXTERN int		Tcl_UnsetVar2(Tcl_Interp *interp, const char *part1,
   726    724   				const char *part2, int flags);
   727    725   /* Slot 255 is reserved */
   728    726   /* 256 */
   729    727   EXTERN void		Tcl_UntraceVar2(Tcl_Interp *interp,
   730    728   				const char *part1, const char *part2,
   731    729   				int flags, Tcl_VarTraceProc *proc,
   732         -				ClientData clientData);
          730  +				void *clientData);
   733    731   /* 257 */
   734    732   EXTERN void		Tcl_UpdateLinkedVar(Tcl_Interp *interp,
   735    733   				const char *varName);
   736    734   /* Slot 258 is reserved */
   737    735   /* 259 */
   738    736   EXTERN int		Tcl_UpVar2(Tcl_Interp *interp, const char *frameName,
   739    737   				const char *part1, const char *part2,
   740    738   				const char *localName, int flags);
   741    739   /* 260 */
   742    740   EXTERN int		Tcl_VarEval(Tcl_Interp *interp, ...);
   743    741   /* Slot 261 is reserved */
   744    742   /* 262 */
   745         -EXTERN ClientData	Tcl_VarTraceInfo2(Tcl_Interp *interp,
          743  +EXTERN void *		Tcl_VarTraceInfo2(Tcl_Interp *interp,
   746    744   				const char *part1, const char *part2,
   747    745   				int flags, Tcl_VarTraceProc *procPtr,
   748         -				ClientData prevClientData);
          746  +				void *prevClientData);
   749    747   /* 263 */
   750         -EXTERN int		Tcl_Write(Tcl_Channel chan, const char *s, int slen);
          748  +EXTERN size_t		Tcl_Write(Tcl_Channel chan, const char *s,
          749  +				size_t slen);
   751    750   /* 264 */
   752    751   EXTERN void		Tcl_WrongNumArgs(Tcl_Interp *interp, int objc,
   753    752   				Tcl_Obj *const objv[], const char *message);
   754    753   /* 265 */
   755    754   EXTERN int		Tcl_DumpActiveMemory(const char *fileName);
   756    755   /* 266 */
   757    756   EXTERN void		Tcl_ValidateAllMemory(const char *file, int line);
................................................................................
   778    777   EXTERN void		Tcl_GetVersion(int *major, int *minor,
   779    778   				int *patchLevel, int *type);
   780    779   /* 280 */
   781    780   EXTERN void		Tcl_InitMemory(Tcl_Interp *interp);
   782    781   /* 281 */
   783    782   EXTERN Tcl_Channel	Tcl_StackChannel(Tcl_Interp *interp,
   784    783   				const Tcl_ChannelType *typePtr,
   785         -				ClientData instanceData, int mask,
          784  +				void *instanceData, int mask,
   786    785   				Tcl_Channel prevChan);
   787    786   /* 282 */
   788    787   EXTERN int		Tcl_UnstackChannel(Tcl_Interp *interp,
   789    788   				Tcl_Channel chan);
   790    789   /* 283 */
   791    790   EXTERN Tcl_Channel	Tcl_GetStackedChannel(Tcl_Channel chan);
   792    791   /* 284 */
................................................................................
   795    794   /* 286 */
   796    795   EXTERN void		Tcl_AppendObjToObj(Tcl_Obj *objPtr,
   797    796   				Tcl_Obj *appendObjPtr);
   798    797   /* 287 */
   799    798   EXTERN Tcl_Encoding	Tcl_CreateEncoding(const Tcl_EncodingType *typePtr);
   800    799   /* 288 */
   801    800   EXTERN void		Tcl_CreateThreadExitHandler(Tcl_ExitProc *proc,
   802         -				ClientData clientData);
          801  +				void *clientData);
   803    802   /* 289 */
   804    803   EXTERN void		Tcl_DeleteThreadExitHandler(Tcl_ExitProc *proc,
   805         -				ClientData clientData);
          804  +				void *clientData);
   806    805   /* Slot 290 is reserved */
   807    806   /* 291 */
   808    807   EXTERN int		Tcl_EvalEx(Tcl_Interp *interp, const char *script,
   809         -				int numBytes, int flags);
          808  +				size_t numBytes, int flags);
   810    809   /* 292 */
   811    810   EXTERN int		Tcl_EvalObjv(Tcl_Interp *interp, int objc,
   812    811   				Tcl_Obj *const objv[], int flags);
   813    812   /* 293 */
   814    813   EXTERN int		Tcl_EvalObjEx(Tcl_Interp *interp, Tcl_Obj *objPtr,
   815    814   				int flags);
   816    815   /* 294 */
   817    816   EXTERN TCL_NORETURN void Tcl_ExitThread(int status);
   818    817   /* 295 */
   819    818   EXTERN int		Tcl_ExternalToUtf(Tcl_Interp *interp,
   820    819   				Tcl_Encoding encoding, const char *src,
   821         -				int srcLen, int flags,
          820  +				size_t srcLen, int flags,
   822    821   				Tcl_EncodingState *statePtr, char *dst,
   823         -				int dstLen, int *srcReadPtr,
          822  +				size_t dstLen, int *srcReadPtr,
   824    823   				int *dstWrotePtr, int *dstCharsPtr);
   825    824   /* 296 */
   826    825   EXTERN char *		Tcl_ExternalToUtfDString(Tcl_Encoding encoding,
   827         -				const char *src, int srcLen,
          826  +				const char *src, size_t srcLen,
   828    827   				Tcl_DString *dsPtr);
   829    828   /* 297 */
   830    829   EXTERN void		Tcl_FinalizeThread(void);
   831    830   /* 298 */
   832         -EXTERN void		Tcl_FinalizeNotifier(ClientData clientData);
          831  +EXTERN void		Tcl_FinalizeNotifier(void *clientData);
   833    832   /* 299 */
   834    833   EXTERN void		Tcl_FreeEncoding(Tcl_Encoding encoding);
   835    834   /* 300 */
   836    835   EXTERN Tcl_ThreadId	Tcl_GetCurrentThread(void);
   837    836   /* 301 */
   838    837   EXTERN Tcl_Encoding	Tcl_GetEncoding(Tcl_Interp *interp, const char *name);
   839    838   /* 302 */
   840    839   EXTERN const char *	Tcl_GetEncodingName(Tcl_Encoding encoding);
   841    840   /* 303 */
   842    841   EXTERN void		Tcl_GetEncodingNames(Tcl_Interp *interp);
   843    842   /* 304 */
   844    843   EXTERN int		Tcl_GetIndexFromObjStruct(Tcl_Interp *interp,
   845    844   				Tcl_Obj *objPtr, const void *tablePtr,
   846         -				int offset, const char *msg, int flags,
          845  +				size_t offset, const char *msg, int flags,
   847    846   				int *indexPtr);
   848    847   /* 305 */
   849    848   EXTERN void *		Tcl_GetThreadData(Tcl_ThreadDataKey *keyPtr,
   850         -				int size);
          849  +				size_t size);
   851    850   /* 306 */
   852    851   EXTERN Tcl_Obj *	Tcl_GetVar2Ex(Tcl_Interp *interp, const char *part1,
   853    852   				const char *part2, int flags);
   854    853   /* 307 */
   855         -EXTERN ClientData	Tcl_InitNotifier(void);
          854  +EXTERN void *		Tcl_InitNotifier(void);
   856    855   /* 308 */
   857    856   EXTERN void		Tcl_MutexLock(Tcl_Mutex *mutexPtr);
   858    857   /* 309 */
   859    858   EXTERN void		Tcl_MutexUnlock(Tcl_Mutex *mutexPtr);
   860    859   /* 310 */
   861    860   EXTERN void		Tcl_ConditionNotify(Tcl_Condition *condPtr);
   862    861   /* 311 */
   863    862   EXTERN void		Tcl_ConditionWait(Tcl_Condition *condPtr,
   864    863   				Tcl_Mutex *mutexPtr, const Tcl_Time *timePtr);
   865    864   /* 312 */
   866         -EXTERN int		Tcl_NumUtfChars(const char *src, int length);
          865  +EXTERN size_t		Tcl_NumUtfChars(const char *src, size_t length);
   867    866   /* 313 */
   868         -EXTERN int		Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr,
   869         -				int charsToRead, int appendFlag);
          867  +EXTERN size_t		Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr,
          868  +				size_t charsToRead, int appendFlag);
   870    869   /* Slot 314 is reserved */
   871    870   /* Slot 315 is reserved */
   872    871   /* 316 */
   873    872   EXTERN int		Tcl_SetSystemEncoding(Tcl_Interp *interp,
   874    873   				const char *name);
   875    874   /* 317 */
   876    875   EXTERN Tcl_Obj *	Tcl_SetVar2Ex(Tcl_Interp *interp, const char *part1,
................................................................................
   878    877   				int flags);
   879    878   /* 318 */
   880    879   EXTERN void		Tcl_ThreadAlert(Tcl_ThreadId threadId);
   881    880   /* 319 */
   882    881   EXTERN void		Tcl_ThreadQueueEvent(Tcl_ThreadId threadId,
   883    882   				Tcl_Event *evPtr, Tcl_QueuePosition position);
   884    883   /* 320 */
   885         -EXTERN int		Tcl_UniCharAtIndex(const char *src, int index);
          884  +EXTERN int		Tcl_UniCharAtIndex(const char *src, size_t index);
   886    885   /* 321 */
   887    886   EXTERN int		Tcl_UniCharToLower(int ch);
   888    887   /* 322 */
   889    888   EXTERN int		Tcl_UniCharToTitle(int ch);
   890    889   /* 323 */
   891    890   EXTERN int		Tcl_UniCharToUpper(int ch);
   892    891   /* 324 */
   893    892   EXTERN int		Tcl_UniCharToUtf(int ch, char *buf);
   894    893   /* 325 */
   895         -EXTERN const char *	Tcl_UtfAtIndex(const char *src, int index);
          894  +EXTERN const char *	Tcl_UtfAtIndex(const char *src, size_t index);
   896    895   /* 326 */
   897         -EXTERN int		Tcl_UtfCharComplete(const char *src, int length);
          896  +EXTERN int		Tcl_UtfCharComplete(const char *src, size_t length);
   898    897   /* 327 */
   899         -EXTERN int		Tcl_UtfBackslash(const char *src, int *readPtr,
          898  +EXTERN size_t		Tcl_UtfBackslash(const char *src, int *readPtr,
   900    899   				char *dst);
   901    900   /* 328 */
   902    901   EXTERN const char *	Tcl_UtfFindFirst(const char *src, int ch);
   903    902   /* 329 */
   904    903   EXTERN const char *	Tcl_UtfFindLast(const char *src, int ch);
   905    904   /* 330 */
   906    905   EXTERN const char *	Tcl_UtfNext(const char *src);
   907    906   /* 331 */
   908    907   EXTERN const char *	Tcl_UtfPrev(const char *src, const char *start);
   909    908   /* 332 */
   910    909   EXTERN int		Tcl_UtfToExternal(Tcl_Interp *interp,
   911    910   				Tcl_Encoding encoding, const char *src,
   912         -				int srcLen, int flags,
          911  +				size_t srcLen, int flags,
   913    912   				Tcl_EncodingState *statePtr, char *dst,
   914         -				int dstLen, int *srcReadPtr,
          913  +				size_t dstLen, int *srcReadPtr,
   915    914   				int *dstWrotePtr, int *dstCharsPtr);
   916    915   /* 333 */
   917    916   EXTERN char *		Tcl_UtfToExternalDString(Tcl_Encoding encoding,
   918         -				const char *src, int srcLen,
          917  +				const char *src, size_t srcLen,
   919    918   				Tcl_DString *dsPtr);
   920    919   /* 334 */
   921    920   EXTERN int		Tcl_UtfToLower(char *src);
   922    921   /* 335 */
   923    922   EXTERN int		Tcl_UtfToTitle(char *src);
   924    923   /* 336 */
   925    924   EXTERN int		Tcl_UtfToUniChar(const char *src, Tcl_UniChar *chPtr);
   926    925   /* 337 */
   927    926   EXTERN int		Tcl_UtfToUpper(char *src);
   928    927   /* 338 */
   929         -EXTERN int		Tcl_WriteChars(Tcl_Channel chan, const char *src,
   930         -				int srcLen);
          928  +EXTERN size_t		Tcl_WriteChars(Tcl_Channel chan, const char *src,
          929  +				size_t srcLen);
   931    930   /* 339 */
   932         -EXTERN int		Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr);
          931  +EXTERN size_t		Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr);
   933    932   /* 340 */
   934    933   EXTERN char *		Tcl_GetString(Tcl_Obj *objPtr);
   935    934   /* Slot 341 is reserved */
   936    935   /* Slot 342 is reserved */
   937    936   /* 343 */
   938         -EXTERN void		Tcl_AlertNotifier(ClientData clientData);
          937  +EXTERN void		Tcl_AlertNotifier(void *clientData);
   939    938   /* 344 */
   940    939   EXTERN void		Tcl_ServiceModeHook(int mode);
   941    940   /* 345 */
   942    941   EXTERN int		Tcl_UniCharIsAlnum(int ch);
   943    942   /* 346 */
   944    943   EXTERN int		Tcl_UniCharIsAlpha(int ch);
   945    944   /* 347 */
................................................................................
   949    948   /* 349 */
   950    949   EXTERN int		Tcl_UniCharIsSpace(int ch);
   951    950   /* 350 */
   952    951   EXTERN int		Tcl_UniCharIsUpper(int ch);
   953    952   /* 351 */
   954    953   EXTERN int		Tcl_UniCharIsWordChar(int ch);
   955    954   /* 352 */
   956         -EXTERN int		Tcl_UniCharLen(const Tcl_UniChar *uniStr);
          955  +EXTERN size_t		Tcl_UniCharLen(const Tcl_UniChar *uniStr);
   957    956   /* 353 */
   958    957   EXTERN int		Tcl_UniCharNcmp(const Tcl_UniChar *ucs,
   959         -				const Tcl_UniChar *uct,
   960         -				unsigned long numChars);
          958  +				const Tcl_UniChar *uct, size_t numChars);
   961    959   /* 354 */
   962    960   EXTERN char *		Tcl_UniCharToUtfDString(const Tcl_UniChar *uniStr,
   963         -				int uniLength, Tcl_DString *dsPtr);
          961  +				size_t uniLength, Tcl_DString *dsPtr);
   964    962   /* 355 */
   965         -EXTERN Tcl_UniChar *	Tcl_UtfToUniCharDString(const char *src, int length,
   966         -				Tcl_DString *dsPtr);
          963  +EXTERN Tcl_UniChar *	Tcl_UtfToUniCharDString(const char *src,
          964  +				size_t length, Tcl_DString *dsPtr);
   967    965   /* 356 */
   968    966   EXTERN Tcl_RegExp	Tcl_GetRegExpFromObj(Tcl_Interp *interp,
   969    967   				Tcl_Obj *patObj, int flags);
   970    968   /* Slot 357 is reserved */
   971    969   /* 358 */
   972    970   EXTERN void		Tcl_FreeParse(Tcl_Parse *parsePtr);
   973    971   /* 359 */
   974    972   EXTERN void		Tcl_LogCommandInfo(Tcl_Interp *interp,
   975    973   				const char *script, const char *command,
   976         -				int length);
          974  +				size_t length);
   977    975   /* 360 */
   978    976   EXTERN int		Tcl_ParseBraces(Tcl_Interp *interp,
   979         -				const char *start, int numBytes,
          977  +				const char *start, size_t numBytes,
   980    978   				Tcl_Parse *parsePtr, int append,
   981    979   				const char **termPtr);
   982    980   /* 361 */
   983    981   EXTERN int		Tcl_ParseCommand(Tcl_Interp *interp,
   984         -				const char *start, int numBytes, int nested,
   985         -				Tcl_Parse *parsePtr);
          982  +				const char *start, size_t numBytes,
          983  +				int nested, Tcl_Parse *parsePtr);
   986    984   /* 362 */
   987    985   EXTERN int		Tcl_ParseExpr(Tcl_Interp *interp, const char *start,
   988         -				int numBytes, Tcl_Parse *parsePtr);
          986  +				size_t numBytes, Tcl_Parse *parsePtr);
   989    987   /* 363 */
   990    988   EXTERN int		Tcl_ParseQuotedString(Tcl_Interp *interp,
   991         -				const char *start, int numBytes,
          989  +				const char *start, size_t numBytes,
   992    990   				Tcl_Parse *parsePtr, int append,
   993    991   				const char **termPtr);
   994    992   /* 364 */
   995    993   EXTERN int		Tcl_ParseVarName(Tcl_Interp *interp,
   996         -				const char *start, int numBytes,
          994  +				const char *start, size_t numBytes,
   997    995   				Tcl_Parse *parsePtr, int append);
   998    996   /* 365 */
   999    997   EXTERN char *		Tcl_GetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr);
  1000    998   /* 366 */
  1001    999   EXTERN int		Tcl_Chdir(const char *dirName);
  1002   1000   /* 367 */
  1003   1001   EXTERN int		Tcl_Access(const char *path, int mode);
  1004   1002   /* 368 */
  1005   1003   EXTERN int		Tcl_Stat(const char *path, struct stat *bufPtr);
  1006   1004   /* 369 */
  1007         -EXTERN int		Tcl_UtfNcmp(const char *s1, const char *s2,
  1008         -				unsigned long n);
         1005  +EXTERN int		Tcl_UtfNcmp(const char *s1, const char *s2, size_t n);
  1009   1006   /* 370 */
  1010   1007   EXTERN int		Tcl_UtfNcasecmp(const char *s1, const char *s2,
  1011         -				unsigned long n);
         1008  +				size_t n);
  1012   1009   /* 371 */
  1013   1010   EXTERN int		Tcl_StringCaseMatch(const char *str,
  1014   1011   				const char *pattern, int nocase);
  1015   1012   /* 372 */
  1016   1013   EXTERN int		Tcl_UniCharIsControl(int ch);
  1017   1014   /* 373 */
  1018   1015   EXTERN int		Tcl_UniCharIsGraph(int ch);
................................................................................
  1019   1016   /* 374 */
  1020   1017   EXTERN int		Tcl_UniCharIsPrint(int ch);
  1021   1018   /* 375 */
  1022   1019   EXTERN int		Tcl_UniCharIsPunct(int ch);
  1023   1020   /* 376 */
  1024   1021   EXTERN int		Tcl_RegExpExecObj(Tcl_Interp *interp,
  1025   1022   				Tcl_RegExp regexp, Tcl_Obj *textObj,
  1026         -				int offset, int nmatches, int flags);
         1023  +				size_t offset, size_t nmatches, int flags);
  1027   1024   /* 377 */
  1028   1025   EXTERN void		Tcl_RegExpGetInfo(Tcl_RegExp regexp,
  1029   1026   				Tcl_RegExpInfo *infoPtr);
  1030   1027   /* 378 */
  1031   1028   EXTERN Tcl_Obj *	Tcl_NewUnicodeObj(const Tcl_UniChar *unicode,
  1032         -				int numChars);
         1029  +				size_t numChars);
  1033   1030   /* 379 */
  1034   1031   EXTERN void		Tcl_SetUnicodeObj(Tcl_Obj *objPtr,
  1035         -				const Tcl_UniChar *unicode, int numChars);
         1032  +				const Tcl_UniChar *unicode, size_t numChars);
  1036   1033   /* 380 */
  1037         -EXTERN int		Tcl_GetCharLength(Tcl_Obj *objPtr);
         1034  +EXTERN size_t		Tcl_GetCharLength(Tcl_Obj *objPtr);
  1038   1035   /* 381 */
  1039         -EXTERN int		Tcl_GetUniChar(Tcl_Obj *objPtr, int index);
         1036  +EXTERN int		Tcl_GetUniChar(Tcl_Obj *objPtr, size_t index);
  1040   1037   /* Slot 382 is reserved */
  1041   1038   /* 383 */
  1042         -EXTERN Tcl_Obj *	Tcl_GetRange(Tcl_Obj *objPtr, int first, int last);
         1039  +EXTERN Tcl_Obj *	Tcl_GetRange(Tcl_Obj *objPtr, size_t first,
         1040  +				size_t last);
  1043   1041   /* 384 */
  1044   1042   EXTERN void		Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr,
  1045         -				const Tcl_UniChar *unicode, int length);
         1043  +				const Tcl_UniChar *unicode, size_t length);
  1046   1044   /* 385 */
  1047   1045   EXTERN int		Tcl_RegExpMatchObj(Tcl_Interp *interp,
  1048   1046   				Tcl_Obj *textObj, Tcl_Obj *patternObj);
  1049   1047   /* 386 */
  1050   1048   EXTERN void		Tcl_SetNotifier(Tcl_NotifierProcs *notifierProcPtr);
  1051   1049   /* 387 */
  1052   1050   EXTERN Tcl_Mutex *	Tcl_GetAllocMutex(void);
  1053   1051   /* 388 */
  1054   1052   EXTERN int		Tcl_GetChannelNames(Tcl_Interp *interp);
  1055   1053   /* 389 */
  1056   1054   EXTERN int		Tcl_GetChannelNamesEx(Tcl_Interp *interp,
  1057   1055   				const char *pattern);
  1058   1056   /* 390 */
  1059         -EXTERN int		Tcl_ProcObjCmd(ClientData clientData,
  1060         -				Tcl_Interp *interp, int objc,
  1061         -				Tcl_Obj *const objv[]);
         1057  +EXTERN int		Tcl_ProcObjCmd(void *clientData, Tcl_Interp *interp,
         1058  +				int objc, Tcl_Obj *const objv[]);
  1062   1059   /* 391 */
  1063   1060   EXTERN void		Tcl_ConditionFinalize(Tcl_Condition *condPtr);
  1064   1061   /* 392 */
  1065   1062   EXTERN void		Tcl_MutexFinalize(Tcl_Mutex *mutex);
  1066   1063   /* 393 */
  1067   1064   EXTERN int		Tcl_CreateThread(Tcl_ThreadId *idPtr,
  1068         -				Tcl_ThreadCreateProc *proc,
  1069         -				ClientData clientData, int stackSize,
  1070         -				int flags);
         1065  +				Tcl_ThreadCreateProc *proc, void *clientData,
         1066  +				size_t stackSize, int flags);
  1071   1067   /* 394 */
  1072         -EXTERN int		Tcl_ReadRaw(Tcl_Channel chan, char *dst,
  1073         -				int bytesToRead);
         1068  +EXTERN size_t		Tcl_ReadRaw(Tcl_Channel chan, char *dst,
         1069  +				size_t bytesToRead);
  1074   1070   /* 395 */
  1075         -EXTERN int		Tcl_WriteRaw(Tcl_Channel chan, const char *src,
  1076         -				int srcLen);
         1071  +EXTERN size_t		Tcl_WriteRaw(Tcl_Channel chan, const char *src,
         1072  +				size_t srcLen);
  1077   1073   /* 396 */
  1078   1074   EXTERN Tcl_Channel	Tcl_GetTopChannel(Tcl_Channel chan);
  1079   1075   /* 397 */
  1080   1076   EXTERN int		Tcl_ChannelBuffered(Tcl_Channel chan);
  1081   1077   /* 398 */
  1082   1078   EXTERN const char *	Tcl_ChannelName(const Tcl_ChannelType *chanTypePtr);
  1083   1079   /* 399 */
................................................................................
  1132   1128   EXTERN void		Tcl_SpliceChannel(Tcl_Channel channel);
  1133   1129   /* 417 */
  1134   1130   EXTERN void		Tcl_ClearChannelHandlers(Tcl_Channel channel);
  1135   1131   /* 418 */
  1136   1132   EXTERN int		Tcl_IsChannelExisting(const char *channelName);
  1137   1133   /* 419 */
  1138   1134   EXTERN int		Tcl_UniCharNcasecmp(const Tcl_UniChar *ucs,
  1139         -				const Tcl_UniChar *uct,
  1140         -				unsigned long numChars);
         1135  +				const Tcl_UniChar *uct, size_t numChars);
  1141   1136   /* 420 */
  1142   1137   EXTERN int		Tcl_UniCharCaseMatch(const Tcl_UniChar *uniStr,
  1143   1138   				const Tcl_UniChar *uniPattern, int nocase);
  1144   1139   /* Slot 421 is reserved */
  1145   1140   /* Slot 422 is reserved */
  1146   1141   /* 423 */
  1147   1142   EXTERN void		Tcl_InitCustomHashTable(Tcl_HashTable *tablePtr,
  1148   1143   				int keyType, const Tcl_HashKeyType *typePtr);
  1149   1144   /* 424 */
  1150   1145   EXTERN void		Tcl_InitObjHashTable(Tcl_HashTable *tablePtr);
  1151   1146   /* 425 */
  1152         -EXTERN ClientData	Tcl_CommandTraceInfo(Tcl_Interp *interp,
         1147  +EXTERN void *		Tcl_CommandTraceInfo(Tcl_Interp *interp,
  1153   1148   				const char *varName, int flags,
  1154   1149   				Tcl_CommandTraceProc *procPtr,
  1155         -				ClientData prevClientData);
         1150  +				void *prevClientData);
  1156   1151   /* 426 */
  1157   1152   EXTERN int		Tcl_TraceCommand(Tcl_Interp *interp,
  1158   1153   				const char *varName, int flags,
  1159         -				Tcl_CommandTraceProc *proc,
  1160         -				ClientData clientData);
         1154  +				Tcl_CommandTraceProc *proc, void *clientData);
  1161   1155   /* 427 */
  1162   1156   EXTERN void		Tcl_UntraceCommand(Tcl_Interp *interp,
  1163   1157   				const char *varName, int flags,
  1164         -				Tcl_CommandTraceProc *proc,
  1165         -				ClientData clientData);
         1158  +				Tcl_CommandTraceProc *proc, void *clientData);
  1166   1159   /* 428 */
  1167         -EXTERN char *		Tcl_AttemptAlloc(unsigned int size);
         1160  +EXTERN void *		Tcl_AttemptAlloc(size_t size);
  1168   1161   /* 429 */
  1169         -EXTERN char *		Tcl_AttemptDbCkalloc(unsigned int size,
  1170         -				const char *file, int line);
         1162  +EXTERN void *		Tcl_AttemptDbCkalloc(size_t size, const char *file,
         1163  +				int line);
  1171   1164   /* 430 */
  1172         -EXTERN char *		Tcl_AttemptRealloc(char *ptr, unsigned int size);
         1165  +EXTERN void *		Tcl_AttemptRealloc(void *ptr, size_t size);
  1173   1166   /* 431 */
  1174         -EXTERN char *		Tcl_AttemptDbCkrealloc(char *ptr, unsigned int size,
         1167  +EXTERN void *		Tcl_AttemptDbCkrealloc(void *ptr, size_t size,
  1175   1168   				const char *file, int line);
  1176   1169   /* 432 */
  1177         -EXTERN int		Tcl_AttemptSetObjLength(Tcl_Obj *objPtr, int length);
         1170  +EXTERN int		Tcl_AttemptSetObjLength(Tcl_Obj *objPtr,
         1171  +				size_t length);
  1178   1172   /* 433 */
  1179   1173   EXTERN Tcl_ThreadId	Tcl_GetChannelThread(Tcl_Channel channel);
  1180   1174   /* 434 */
  1181   1175   EXTERN Tcl_UniChar *	Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr,
  1182   1176   				int *lengthPtr);
  1183   1177   /* Slot 435 is reserved */
  1184   1178   /* Slot 436 is reserved */
................................................................................
  1258   1252   /* 463 */
  1259   1253   EXTERN Tcl_Obj *	Tcl_FSGetNormalizedPath(Tcl_Interp *interp,
  1260   1254   				Tcl_Obj *pathPtr);
  1261   1255   /* 464 */
  1262   1256   EXTERN Tcl_Obj *	Tcl_FSJoinToPath(Tcl_Obj *pathPtr, int objc,
  1263   1257   				Tcl_Obj *const objv[]);
  1264   1258   /* 465 */
  1265         -EXTERN ClientData	Tcl_FSGetInternalRep(Tcl_Obj *pathPtr,
         1259  +EXTERN void *		Tcl_FSGetInternalRep(Tcl_Obj *pathPtr,
  1266   1260   				const Tcl_Filesystem *fsPtr);
  1267   1261   /* 466 */
  1268   1262   EXTERN Tcl_Obj *	Tcl_FSGetTranslatedPath(Tcl_Interp *interp,
  1269   1263   				Tcl_Obj *pathPtr);
  1270   1264   /* 467 */
  1271   1265   EXTERN int		Tcl_FSEvalFile(Tcl_Interp *interp, Tcl_Obj *fileName);
  1272   1266   /* 468 */
  1273   1267   EXTERN Tcl_Obj *	Tcl_FSNewNativePath(
  1274   1268   				const Tcl_Filesystem *fromFilesystem,
  1275         -				ClientData clientData);
         1269  +				void *clientData);
  1276   1270   /* 469 */
  1277   1271   EXTERN const void *	Tcl_FSGetNativePath(Tcl_Obj *pathPtr);
  1278   1272   /* 470 */
  1279   1273   EXTERN Tcl_Obj *	Tcl_FSFileSystemInfo(Tcl_Obj *pathPtr);
  1280   1274   /* 471 */
  1281   1275   EXTERN Tcl_Obj *	Tcl_FSPathSeparator(Tcl_Obj *pathPtr);
  1282   1276   /* 472 */
  1283   1277   EXTERN Tcl_Obj *	Tcl_FSListVolumes(void);
  1284   1278   /* 473 */
  1285         -EXTERN int		Tcl_FSRegister(ClientData clientData,
         1279  +EXTERN int		Tcl_FSRegister(void *clientData,
  1286   1280   				const Tcl_Filesystem *fsPtr);
  1287   1281   /* 474 */
  1288   1282   EXTERN int		Tcl_FSUnregister(const Tcl_Filesystem *fsPtr);
  1289   1283   /* 475 */
  1290         -EXTERN ClientData	Tcl_FSData(const Tcl_Filesystem *fsPtr);
         1284  +EXTERN void *		Tcl_FSData(const Tcl_Filesystem *fsPtr);
  1291   1285   /* 476 */
  1292   1286   EXTERN const char *	Tcl_FSGetTranslatedStringPath(Tcl_Interp *interp,
  1293   1287   				Tcl_Obj *pathPtr);
  1294   1288   /* 477 */
  1295   1289   EXTERN const Tcl_Filesystem * Tcl_FSGetFileSystemForPath(Tcl_Obj *pathPtr);
  1296   1290   /* 478 */
  1297   1291   EXTERN Tcl_PathType	Tcl_FSGetPathType(Tcl_Obj *pathPtr);
  1298   1292   /* 479 */
  1299   1293   EXTERN int		Tcl_OutputBuffered(Tcl_Channel chan);
  1300   1294   /* 480 */
  1301   1295   EXTERN void		Tcl_FSMountsChanged(const Tcl_Filesystem *fsPtr);
  1302   1296   /* 481 */
  1303   1297   EXTERN int		Tcl_EvalTokensStandard(Tcl_Interp *interp,
  1304         -				Tcl_Token *tokenPtr, int count);
         1298  +				Tcl_Token *tokenPtr, size_t count);
  1305   1299   /* 482 */
  1306   1300   EXTERN void		Tcl_GetTime(Tcl_Time *timeBuf);
  1307   1301   /* 483 */
  1308   1302   EXTERN Tcl_Trace	Tcl_CreateObjTrace(Tcl_Interp *interp, int level,
  1309   1303   				int flags, Tcl_CmdObjTraceProc *objProc,
  1310         -				ClientData clientData,
         1304  +				void *clientData,
  1311   1305   				Tcl_CmdObjTraceDeleteProc *delProc);
  1312   1306   /* 484 */
  1313   1307   EXTERN int		Tcl_GetCommandInfoFromToken(Tcl_Command token,
  1314   1308   				Tcl_CmdInfo *infoPtr);
  1315   1309   /* 485 */
  1316   1310   EXTERN int		Tcl_SetCommandInfoFromToken(Tcl_Command token,
  1317   1311   				const Tcl_CmdInfo *infoPtr);
................................................................................
  1374   1368   /* 505 */
  1375   1369   EXTERN void		Tcl_RegisterConfig(Tcl_Interp *interp,
  1376   1370   				const char *pkgName,
  1377   1371   				const Tcl_Config *configuration,
  1378   1372   				const char *valEncoding);
  1379   1373   /* 506 */
  1380   1374   EXTERN Tcl_Namespace *	Tcl_CreateNamespace(Tcl_Interp *interp,
  1381         -				const char *name, ClientData clientData,
         1375  +				const char *name, void *clientData,
  1382   1376   				Tcl_NamespaceDeleteProc *deleteProc);
  1383   1377   /* 507 */
  1384   1378   EXTERN void		Tcl_DeleteNamespace(Tcl_Namespace *nsPtr);
  1385   1379   /* 508 */
  1386   1380   EXTERN int		Tcl_AppendExportList(Tcl_Interp *interp,
  1387   1381   				Tcl_Namespace *nsPtr, Tcl_Obj *objPtr);
  1388   1382   /* 509 */
................................................................................
  1415   1409   EXTERN int		Tcl_FSEvalFileEx(Tcl_Interp *interp,
  1416   1410   				Tcl_Obj *fileName, const char *encodingName);
  1417   1411   /* 519 */
  1418   1412   EXTERN Tcl_ExitProc *	Tcl_SetExitProc(TCL_NORETURN1 Tcl_ExitProc *proc);
  1419   1413   /* 520 */
  1420   1414   EXTERN void		Tcl_LimitAddHandler(Tcl_Interp *interp, int type,
  1421   1415   				Tcl_LimitHandlerProc *handlerProc,
  1422         -				ClientData clientData,
         1416  +				void *clientData,
  1423   1417   				Tcl_LimitHandlerDeleteProc *deleteProc);
  1424   1418   /* 521 */
  1425   1419   EXTERN void		Tcl_LimitRemoveHandler(Tcl_Interp *interp, int type,
  1426   1420   				Tcl_LimitHandlerProc *handlerProc,
  1427         -				ClientData clientData);
         1421  +				void *clientData);
  1428   1422   /* 522 */
  1429   1423   EXTERN int		Tcl_LimitReady(Tcl_Interp *interp);
  1430   1424   /* 523 */
  1431   1425   EXTERN int		Tcl_LimitCheck(Tcl_Interp *interp);
  1432   1426   /* 524 */
  1433   1427   EXTERN int		Tcl_LimitExceeded(Tcl_Interp *interp);
  1434   1428   /* 525 */
................................................................................
  1503   1497   /* 551 */
  1504   1498   EXTERN int		Tcl_GetEnsembleNamespace(Tcl_Interp *interp,
  1505   1499   				Tcl_Command token,
  1506   1500   				Tcl_Namespace **namespacePtrPtr);
  1507   1501   /* 552 */
  1508   1502   EXTERN void		Tcl_SetTimeProc(Tcl_GetTimeProc *getProc,
  1509   1503   				Tcl_ScaleTimeProc *scaleProc,
  1510         -				ClientData clientData);
         1504  +				void *clientData);
  1511   1505   /* 553 */
  1512   1506   EXTERN void		Tcl_QueryTimeProc(Tcl_GetTimeProc **getProc,
  1513   1507   				Tcl_ScaleTimeProc **scaleProc,
  1514         -				ClientData *clientData);
         1508  +				void **clientData);
  1515   1509   /* 554 */
  1516   1510   EXTERN Tcl_DriverThreadActionProc * Tcl_ChannelThreadActionProc(
  1517   1511   				const Tcl_ChannelType *chanTypePtr);
  1518   1512   /* 555 */
  1519   1513   EXTERN Tcl_Obj *	Tcl_NewBignumObj(mp_int *value);
  1520   1514   /* 556 */
  1521   1515   EXTERN Tcl_Obj *	Tcl_DbNewBignumObj(mp_int *value, const char *file,
................................................................................
  1568   1562   				const char *name, int objc,
  1569   1563   				Tcl_Obj *const objv[], void *clientDataPtr);
  1570   1564   /* 574 */
  1571   1565   EXTERN void		Tcl_AppendObjToErrorInfo(Tcl_Interp *interp,
  1572   1566   				Tcl_Obj *objPtr);
  1573   1567   /* 575 */
  1574   1568   EXTERN void		Tcl_AppendLimitedToObj(Tcl_Obj *objPtr,
  1575         -				const char *bytes, int length, int limit,
  1576         -				const char *ellipsis);
         1569  +				const char *bytes, size_t length,
         1570  +				size_t limit, const char *ellipsis);
  1577   1571   /* 576 */
  1578   1572   EXTERN Tcl_Obj *	Tcl_Format(Tcl_Interp *interp, const char *format,
  1579   1573   				int objc, Tcl_Obj *const objv[]);
  1580   1574   /* 577 */
  1581   1575   EXTERN int		Tcl_AppendFormatToObj(Tcl_Interp *interp,
  1582   1576   				Tcl_Obj *objPtr, const char *format,
  1583   1577   				int objc, Tcl_Obj *const objv[]);
................................................................................
  1584   1578   /* 578 */
  1585   1579   EXTERN Tcl_Obj *	Tcl_ObjPrintf(const char *format, ...) TCL_FORMAT_PRINTF(1, 2);
  1586   1580   /* 579 */
  1587   1581   EXTERN void		Tcl_AppendPrintfToObj(Tcl_Obj *objPtr,
  1588   1582   				const char *format, ...) TCL_FORMAT_PRINTF(2, 3);
  1589   1583   /* 580 */
  1590   1584   EXTERN int		Tcl_CancelEval(Tcl_Interp *interp,
  1591         -				Tcl_Obj *resultObjPtr, ClientData clientData,
         1585  +				Tcl_Obj *resultObjPtr, void *clientData,
  1592   1586   				int flags);
  1593   1587   /* 581 */
  1594   1588   EXTERN int		Tcl_Canceled(Tcl_Interp *interp, int flags);
  1595   1589   /* 582 */
  1596   1590   EXTERN int		Tcl_CreatePipe(Tcl_Interp *interp,
  1597   1591   				Tcl_Channel *rchan, Tcl_Channel *wchan,
  1598   1592   				int flags);
  1599   1593   /* 583 */
  1600   1594   EXTERN Tcl_Command	Tcl_NRCreateCommand(Tcl_Interp *interp,
  1601   1595   				const char *cmdName, Tcl_ObjCmdProc *proc,
  1602         -				Tcl_ObjCmdProc *nreProc,
  1603         -				ClientData clientData,
         1596  +				Tcl_ObjCmdProc *nreProc, void *clientData,
  1604   1597   				Tcl_CmdDeleteProc *deleteProc);
  1605   1598   /* 584 */
  1606   1599   EXTERN int		Tcl_NREvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
  1607   1600   				int flags);
  1608   1601   /* 585 */
  1609   1602   EXTERN int		Tcl_NREvalObjv(Tcl_Interp *interp, int objc,
  1610   1603   				Tcl_Obj *const objv[], int flags);
  1611   1604   /* 586 */
  1612   1605   EXTERN int		Tcl_NRCmdSwap(Tcl_Interp *interp, Tcl_Command cmd,
  1613   1606   				int objc, Tcl_Obj *const objv[], int flags);
  1614   1607   /* 587 */
  1615   1608   EXTERN void		Tcl_NRAddCallback(Tcl_Interp *interp,
  1616         -				Tcl_NRPostProc *postProcPtr,
  1617         -				ClientData data0, ClientData data1,
  1618         -				ClientData data2, ClientData data3);
         1609  +				Tcl_NRPostProc *postProcPtr, void *data0,
         1610  +				void *data1, void *data2, void *data3);
  1619   1611   /* 588 */
  1620   1612   EXTERN int		Tcl_NRCallObjProc(Tcl_Interp *interp,
  1621         -				Tcl_ObjCmdProc *objProc,
  1622         -				ClientData clientData, int objc,
  1623         -				Tcl_Obj *const objv[]);
         1613  +				Tcl_ObjCmdProc *objProc, void *clientData,
         1614  +				int objc, Tcl_Obj *const objv[]);
  1624   1615   /* 589 */
  1625   1616   EXTERN unsigned		Tcl_GetFSDeviceFromStat(const Tcl_StatBuf *statPtr);
  1626   1617   /* 590 */
  1627   1618   EXTERN unsigned		Tcl_GetFSInodeFromStat(const Tcl_StatBuf *statPtr);
  1628   1619   /* 591 */
  1629   1620   EXTERN unsigned		Tcl_GetModeFromStat(const Tcl_StatBuf *statPtr);
  1630   1621   /* 592 */
................................................................................
  1671   1662   EXTERN void		Tcl_BackgroundException(Tcl_Interp *interp, int code);
  1672   1663   /* 610 */
  1673   1664   EXTERN int		Tcl_ZlibDeflate(Tcl_Interp *interp, int format,
  1674   1665   				Tcl_Obj *data, int level,
  1675   1666   				Tcl_Obj *gzipHeaderDictObj);
  1676   1667   /* 611 */
  1677   1668   EXTERN int		Tcl_ZlibInflate(Tcl_Interp *interp, int format,
  1678         -				Tcl_Obj *data, int buffers