summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdIL.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclCmdIL.c')
-rw-r--r--generic/tclCmdIL.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index ef7a42c..c11534e 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -56,7 +56,7 @@ typedef int (*SortMemCmpFn_t) (const void *, const void *, size_t);
* The following structure is used to pass this information.
*/
-typedef struct SortInfo {
+typedef struct {
int isIncreasing; /* Nonzero means sort in increasing order. */
int sortMode; /* The sort mode. One of SORTMODE_* values
* defined below. */
@@ -566,7 +566,7 @@ InfoBodyCmd(
* the object do not invalidate the internal rep.
*/
- bytes = Tcl_GetStringFromObj(procPtr->bodyPtr, &numBytes);
+ bytes = TclGetStringFromObj(procPtr->bodyPtr, &numBytes);
Tcl_SetObjResult(interp, Tcl_NewStringObj(bytes, numBytes));
return TCL_OK;
}
@@ -1047,7 +1047,7 @@ InfoErrorStackCmd(
target = interp;
if (objc == 2) {
- target = Tcl_GetSlave(interp, Tcl_GetString(objv[1]));
+ target = Tcl_GetSlave(interp, TclGetString(objv[1]));
if (target == NULL) {
return TCL_ERROR;
}
@@ -2155,7 +2155,7 @@ InfoCmdTypeCmd(
Tcl_WrongNumArgs(interp, 1, objv, "commandName");
return TCL_ERROR;
}
- command = Tcl_FindCommand(interp, Tcl_GetString(objv[1]), NULL,
+ command = Tcl_FindCommand(interp, TclGetString(objv[1]), NULL,
TCL_LEAVE_ERR_MSG);
if (command == NULL) {
return TCL_ERROR;
@@ -2231,7 +2231,7 @@ Tcl_JoinObjCmd(
joinObjPtr = (objc == 2) ? Tcl_NewStringObj(" ", 1) : objv[2];
Tcl_IncrRefCount(joinObjPtr);
- (void) Tcl_GetStringFromObj(joinObjPtr, &length);
+ (void) TclGetStringFromObj(joinObjPtr, &length);
if (length == 0) {
resObjPtr = TclStringCat(interp, listLen, elemPtrs, 0);
} else {
@@ -2721,15 +2721,13 @@ Tcl_LrangeObjCmd(
*----------------------------------------------------------------------
*/
-typedef int list_index_t;
-
static int
LremoveIndexCompare(
const void *el1Ptr,
const void *el2Ptr)
{
- list_index_t idx1 = *((const list_index_t *) el1Ptr);
- list_index_t idx2 = *((const list_index_t *) el2Ptr);
+ int idx1 = *((const int *) el1Ptr);
+ int idx2 = *((const int *) el2Ptr);
/*
* This will put the larger element first.
@@ -2746,7 +2744,7 @@ Tcl_LremoveObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int i, idxc;
- list_index_t listLen, *idxv, prevIdx, first, num;
+ int listLen, *idxv, prevIdx, first, num;
Tcl_Obj *listObj;
/*
@@ -2768,7 +2766,7 @@ Tcl_LremoveObjCmd(
Tcl_SetObjResult(interp, listObj);
return TCL_OK;
}
- idxv = ckalloc((objc - 2) * sizeof(list_index_t));
+ idxv = ckalloc((objc - 2) * sizeof(int));
for (i = 2; i < objc; i++) {
if (TclGetIntForIndexM(interp, objv[i], /*endValue*/ listLen - 1,
&idxv[i - 2]) != TCL_OK) {
@@ -2783,7 +2781,7 @@ Tcl_LremoveObjCmd(
*/
if (idxc > 1) {
- qsort(idxv, idxc, sizeof(list_index_t), LremoveIndexCompare);
+ qsort(idxv, idxc, sizeof(int), LremoveIndexCompare);
}
/*
@@ -2796,7 +2794,7 @@ Tcl_LremoveObjCmd(
num = 0;
first = listLen;
for (i = 0, prevIdx = -1 ; i < idxc ; i++) {
- list_index_t idx = idxv[i];
+ int idx = idxv[i];
/*
* Repeated index and sanity check.
@@ -3003,7 +3001,7 @@ Tcl_LreplaceObjCmd(
return result;
}
- if (first < 0) {
+ if (first == TCL_INDEX_NONE) {
first = 0;
}
if (first > listLen) {
@@ -3382,10 +3380,10 @@ Tcl_LsearchObjCmd(
TCL_INDEX_NONE, &encoded) != TCL_OK) {
result = TCL_ERROR;
}
- if (encoded == TCL_INDEX_NONE) {
+ if (encoded == (int)TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"index \"%s\" cannot select an element "
- "from any list", Tcl_GetString(indices[j])));
+ "from any list", TclGetString(indices[j])));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX"
"OUTOFRANGE", NULL);
result = TCL_ERROR;
@@ -3515,8 +3513,8 @@ Tcl_LsearchObjCmd(
if (result != TCL_OK) {
goto done;
}
- if (start < 0) {
- start = 0;
+ if (start == TCL_INDEX_NONE) {
+ start = TCL_INDEX_START;
}
/*
@@ -4099,10 +4097,10 @@ Tcl_LsortObjCmd(
int result = TclIndexEncode(interp, indexv[j],
TCL_INDEX_NONE, TCL_INDEX_NONE, &encoded);
- if ((result == TCL_OK) && (encoded == TCL_INDEX_NONE)) {
+ if ((result == TCL_OK) && (encoded == (int)TCL_INDEX_NONE)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"index \"%s\" cannot select an element "
- "from any list", Tcl_GetString(indexv[j])));
+ "from any list", TclGetString(indexv[j])));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX"
"OUTOFRANGE", NULL);
result = TCL_ERROR;
@@ -4859,7 +4857,7 @@ SelectObjFromSublist(
return NULL;
}
if (currentObj == NULL) {
- if (index == TCL_INDEX_NONE) {
+ if (index == (int)TCL_INDEX_NONE) {
index = TCL_INDEX_END - infoPtr->indexv[i];
Tcl_SetObjResult(infoPtr->interp, Tcl_ObjPrintf(
"element end-%d missing from sublist \"%s\"",