From 2ee65349c997ec60a0e3def277a24c0f638fed78 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 2 Jul 2015 12:29:43 +0000 Subject: Revert some refcount changes on I/O structs. These are refcounts on structs, not Tcl_Obj's. Their scheme doesn't suffer the same difficulties and histories as Tcl_Obj's, and they need not copy every detail, appropriate or not, from Tcl_Obj refcount management. The "significant value" -- as dkf puts it -- for the struct refcounting scheme is 0 not 1. --- generic/tclIO.c | 4 ++-- generic/tclIOGT.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index eb924d1..8b2e149 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -1930,7 +1930,7 @@ TclChannelRelease( if (chanPtr->refCount == 0) { Tcl_Panic("Channel released more than preserved"); } - if (chanPtr->refCount-- > 1) { + if (--chanPtr->refCount) { return; } if (chanPtr->typePtr == NULL) { @@ -2426,7 +2426,7 @@ static void ReleaseChannelBuffer( ChannelBuffer *bufPtr) { - if (bufPtr->refCount-- > 1) { + if (--bufPtr->refCount) { return; } ckfree(bufPtr); diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index c1ce485..7f61def 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -225,7 +225,7 @@ static void ReleaseData( TransformChannelData *dataPtr) { - if (dataPtr->refCount-- > 1) { + if (--dataPtr->refCount) { return; } ResultClear(&dataPtr->result); -- cgit v0.12