diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-11 14:23:14 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-11 14:23:14 (GMT) |
| commit | 278837f261adb88e6a802f3ebaf63e232c12e77f (patch) | |
| tree | b6a9653503ead5496a456e1301cc2244c8fba4a0 | |
| parent | d16f803f15be4e185b584faf662863362cfffe5c (diff) | |
| download | tcl-278837f261adb88e6a802f3ebaf63e232c12e77f.zip tcl-278837f261adb88e6a802f3ebaf63e232c12e77f.tar.gz tcl-278837f261adb88e6a802f3ebaf63e232c12e77f.tar.bz2 | |
More usage for TclNewWideIntObjFromSize(), TCL_IO_FAILURE -> TCL_INDEX_NONE where appropriate
| -rw-r--r-- | generic/tclCmdIL.c | 2 | ||||
| -rw-r--r-- | generic/tclStringObj.c | 12 | ||||
| -rw-r--r-- | unix/tclUnixInit.c | 4 | ||||
| -rw-r--r-- | win/tclWinInit.c | 4 | ||||
| -rw-r--r-- | win/tclWinPipe.c | 4 |
5 files changed, 11 insertions, 15 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index c88b4d2..7bad8b5 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -3835,7 +3835,7 @@ Tcl_LsearchObjCmd( } Tcl_SetObjResult(interp, itemPtr); } else { - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); + Tcl_SetObjResult(interp, TclNewWideIntObjFromSize((size_t)index)); } } else if (index < 0) { /* diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index f9b2775..7ba20ec 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3454,8 +3454,7 @@ TclStringFirst( size_t start) { size_t lh = 0, ln = Tcl_GetCharLength(needle); - Tcl_Obj *result; - size_t value = TCL_IO_FAILURE; + size_t value = TCL_INDEX_NONE; Tcl_UniChar *check, *end, *uh, *un; if (start == TCL_INDEX_NONE) { @@ -3532,8 +3531,7 @@ TclStringFirst( } } firstEnd: - TclNewIntObj(result, TclWideIntFromSize(value)); - return result; + return TclNewWideIntObjFromSize(value); } /* @@ -3561,8 +3559,7 @@ TclStringLast( size_t last) { size_t lh = 0, ln = Tcl_GetCharLength(needle); - Tcl_Obj *result; - size_t value = TCL_IO_FAILURE; + size_t value = TCL_INDEX_NONE; Tcl_UniChar *check, *uh, *un; if (ln == 0) { @@ -3619,8 +3616,7 @@ TclStringLast( check--; } lastEnd: - TclNewIntObj(result, TclWideIntFromSize(value)); - return result; + return TclNewWideIntObjFromSize(value); } /* diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index a0a2c30..98c37f5 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -988,7 +988,7 @@ TclpSetVariables( * * Results: * The return value is the index in environ of an entry with the name - * "name", or TCL_IO_FAILURE if there is no such entry. The integer at *lengthPtr is + * "name", or TCL_INDEX_NONE if there is no such entry. The integer at *lengthPtr is * filled in with the length of name (if a matching entry is found) or * the length of the environ array (if no matching entry is found). * @@ -1007,7 +1007,7 @@ TclpFindVariable( * entries in environ (for unsuccessful * searches). */ { - size_t i, result = TCL_IO_FAILURE; + size_t i, result = TCL_INDEX_NONE; const char *env, *p1, *p2; Tcl_DString envString; diff --git a/win/tclWinInit.c b/win/tclWinInit.c index f6c9f83..4726bb3 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -614,7 +614,7 @@ TclpSetVariables( * * Results: * The return value is the index in environ of an entry with the name - * "name", or TCL_IO_FAILURE if there is no such entry. The integer + * "name", or TCL_INDEX_NONE if there is no such entry. The integer * at *lengthPtr is filled in with the length of name (if a matching * entry is found) or the length of the environ array (if no * matching entry is found). @@ -637,7 +637,7 @@ TclpFindVariable( * entries in environ (for unsuccessful * searches). */ { - size_t i, length, result = TCL_IO_FAILURE; + size_t i, length, result = TCL_INDEX_NONE; const WCHAR *env; const char *p1, *p2; char *envUpper, *nameUpper; diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index d0fa84b..2576028 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -851,7 +851,7 @@ TclpCloseFile( * Results: * Returns the process id for the child process. If the pid was not known * by Tcl, either because the pid was not created by Tcl or the child - * process has already been reaped, TCL_IO_FAILURE is returned. + * process has already been reaped, TCL_INDEX_NONE is returned. * * Side effects: * None. @@ -875,7 +875,7 @@ TclpGetPid( } } Tcl_MutexUnlock(&pipeMutex); - return TCL_IO_FAILURE; + return TCL_INDEX_NONE; } /* |
