diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-11-18 10:29:41 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-11-18 10:29:41 (GMT) |
commit | b2a63152cbf72e7a23e9870d94bbf551373ef84b (patch) | |
tree | 7edbe522c18e704c6481c96aaa17f1163c688ca7 /unix | |
parent | f1dbfbf21581370d5dad9cbeb4c8ac09f93fb30c (diff) | |
download | tcl-b2a63152cbf72e7a23e9870d94bbf551373ef84b.zip tcl-b2a63152cbf72e7a23e9870d94bbf551373ef84b.tar.gz tcl-b2a63152cbf72e7a23e9870d94bbf551373ef84b.tar.bz2 |
Now that we have TCL_AUTO_LENGTH/TCL_IO_FAILURE macro's, use them to make code and documentation more readable.
Shifted to feature branch as a temporary measure since it doesn't build.
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tclUnixFCmd.c | 6 | ||||
-rw-r--r-- | unix/tclUnixInit.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index fadf18d..7a79f3e 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -613,18 +613,18 @@ TclUnixCopyFile( buffer = Tcl_Alloc(blockSize); while (1) { nread = (size_t) read(srcFd, buffer, blockSize); - if ((nread == (size_t) -1) || (nread == 0)) { + if ((nread == TCL_IO_FAILURE) || (nread == 0)) { break; } if ((size_t) write(dstFd, buffer, nread) != nread) { - nread = (size_t) -1; + nread = TCL_IO_FAILURE; break; } } Tcl_Free(buffer); close(srcFd); - if ((close(dstFd) != 0) || (nread == (size_t) -1)) { + if ((close(dstFd) != 0) || (nread == TCL_IO_FAILURE)) { unlink(dst); /* INTL: Native. */ return TCL_ERROR; } diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 21e8f20..eacf157 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -981,7 +981,7 @@ TclpSetVariables( * * Results: * The return value is the index in environ of an entry with the name - * "name", or (size_t)-1 if there is no such entry. The integer at *lengthPtr is + * "name", or TCL_IO_FAILURE 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). * @@ -1000,7 +1000,7 @@ TclpFindVariable( * entries in environ (for unsuccessful * searches). */ { - size_t i, result = (size_t)-1; + size_t i, result = TCL_IO_FAILURE; register const char *env, *p1, *p2; Tcl_DString envString; |