From 02b7fc064fe51c7ec01f8977ae28ccfb38e84e62 Mon Sep 17 00:00:00 2001 From: andreas_kupries Date: Mon, 6 Aug 2001 22:17:58 +0000 Subject: 2001-08-06 Andreas Kupries * generic/tclIOCmd.c (Tcl_GetsObjCmd): Applied patch from SF item [442665] to fix the bug reported by it. --- ChangeLog | 5 +++++ generic/tclIOCmd.c | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 03d9af2..47be923 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-08-06 Andreas Kupries + + * generic/tclIOCmd.c (Tcl_GetsObjCmd): Applied patch from SF item + [442665] to fix the bug reported by it. + 2001-08-06 Don Porter * doc/tclsh.1: Added note that the tclsh program is frequently diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 78ab3cf..5fb3a15 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.8 2001/07/31 19:12:06 vincentdarley Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.9 2001/08/06 22:17:58 andreas_kupries Exp $ */ #include "tclInt.h" @@ -228,8 +228,6 @@ Tcl_GetsObjCmd(dummy, interp, objc, objv) return TCL_ERROR; } - resultPtr = Tcl_GetObjResult(interp); - linePtr = resultPtr; if (objc == 3) { /* * Variable gets line, interp get bytecount. @@ -237,11 +235,14 @@ Tcl_GetsObjCmd(dummy, interp, objc, objv) linePtr = Tcl_NewObj(); } + else { + linePtr = Tcl_GetObjResult(interp); + } lineLen = Tcl_GetsObj(chan, linePtr); if (lineLen < 0) { if (!Tcl_Eof(chan) && !Tcl_InputBlocked(chan)) { - if (linePtr != resultPtr) { + if (objc == 3) { Tcl_DecrRefCount(linePtr); } Tcl_ResetResult(interp); @@ -257,6 +258,7 @@ Tcl_GetsObjCmd(dummy, interp, objc, objv) Tcl_DecrRefCount(linePtr); return TCL_ERROR; } + resultPtr = Tcl_GetObjResult(interp); Tcl_SetIntObj(resultPtr, lineLen); return TCL_OK; } -- cgit v0.12