summaryrefslogtreecommitdiffstats
path: root/generic/tclIOCmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclIOCmd.c')
-rw-r--r--generic/tclIOCmd.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c
index 1c6c8ae..73af20a 100644
--- a/generic/tclIOCmd.c
+++ b/generic/tclIOCmd.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIOCmd.c,v 1.20 2004/07/16 22:37:28 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclIOCmd.c,v 1.21 2004/10/06 15:59:24 dgp Exp $
*/
#include "tclInt.h"
@@ -263,8 +263,7 @@ Tcl_GetsObjCmd(dummy, interp, objc, objv)
Tcl_DecrRefCount(linePtr);
return TCL_ERROR;
}
- resultPtr = Tcl_GetObjResult(interp);
- Tcl_SetIntObj(resultPtr, lineLen);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(lineLen));
return TCL_OK;
} else {
Tcl_SetObjResult(interp, linePtr);
@@ -497,7 +496,7 @@ Tcl_TellObjCmd(clientData, interp, objc, objv)
if (chan == (Tcl_Channel) NULL) {
return TCL_ERROR;
}
- Tcl_SetWideIntObj(Tcl_GetObjResult(interp), Tcl_Tell(chan));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tcl_Tell(chan)));
return TCL_OK;
}
@@ -557,6 +556,10 @@ Tcl_CloseObjCmd(clientData, interp, objc, objv)
int len;
resultPtr = Tcl_GetObjResult(interp);
+ if (Tcl_IsShared(resultPtr)) {
+ resultPtr = Tcl_DuplicateObj(resultPtr);
+ Tcl_SetObjResult(interp, resultPtr);
+ }
string = Tcl_GetStringFromObj(resultPtr, &len);
if ((len > 0) && (string[len - 1] == '\n')) {
Tcl_SetObjLength(resultPtr, len - 1);
@@ -679,7 +682,7 @@ Tcl_EofObjCmd(unused, interp, objc, objv)
return TCL_ERROR;
}
- Tcl_SetBooleanObj(Tcl_GetObjResult(interp), Tcl_Eof(chan));
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(Tcl_Eof(chan)));
return TCL_OK;
}
@@ -831,8 +834,7 @@ Tcl_ExecObjCmd(dummy, interp, objc, objv)
*/
result = Tcl_Close(interp, chan);
- string = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &length);
- Tcl_AppendToObj(resultPtr, string, length);
+ Tcl_AppendObjToObj(resultPtr, Tcl_GetObjResult(interp));
/*
* If the last character of the result is a newline, then remove
@@ -891,12 +893,12 @@ Tcl_FblockedObjCmd(unused, interp, objc, objv)
return TCL_ERROR;
}
if ((mode & TCL_READABLE) == 0) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "channel \"",
+ Tcl_AppendResult(interp, "channel \"",
arg, "\" wasn't opened for reading", (char *) NULL);
return TCL_ERROR;
}
- Tcl_SetBooleanObj(Tcl_GetObjResult(interp), Tcl_InputBlocked(chan));
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(Tcl_InputBlocked(chan)));
return TCL_OK;
}
@@ -1497,8 +1499,7 @@ Tcl_FcopyObjCmd(dummy, interp, objc, objv)
return TCL_ERROR;
}
if ((mode & TCL_READABLE) == 0) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "channel \"",
- arg,
+ Tcl_AppendResult(interp, "channel \"", arg,
"\" wasn't opened for reading", (char *) NULL);
return TCL_ERROR;
}
@@ -1508,8 +1509,7 @@ Tcl_FcopyObjCmd(dummy, interp, objc, objv)
return TCL_ERROR;
}
if ((mode & TCL_WRITABLE) == 0) {
- Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "channel \"",
- arg,
+ Tcl_AppendResult(interp, "channel \"", arg,
"\" wasn't opened for writing", (char *) NULL);
return TCL_ERROR;
}