summaryrefslogtreecommitdiffstats
path: root/generic/tkTextDisp.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-01-18 12:44:22 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-01-18 12:44:22 (GMT)
commitc558898981a43637a64c17a40fd816ae41991961 (patch)
treef00289fc7ee4cef9794d712add3048d86320a16e /generic/tkTextDisp.c
parentec5e2f38d3eb0132822396f9b105d4cc5c78e86b (diff)
downloadtk-c558898981a43637a64c17a40fd816ae41991961.zip
tk-c558898981a43637a64c17a40fd816ae41991961.tar.gz
tk-c558898981a43637a64c17a40fd816ae41991961.tar.bz2
Change more refCount checks to the form "(...refCount-- <= 1)", so no separate decrement and compare is necessary. This allows (in the future) the same code to work when refCount becomes unsigned (which at least doubles the range). No functional change.
Diffstat (limited to 'generic/tkTextDisp.c')
-rw-r--r--generic/tkTextDisp.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 1be26c4..704d47d 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -3005,7 +3005,7 @@ AsyncUpdateLineMetrics(
* The widget has been deleted, or is not mapped. Don't do anything.
*/
- if (--textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
return;
@@ -3080,8 +3080,7 @@ AsyncUpdateLineMetrics(
GenerateWidgetViewSyncEvent(textPtr, 1);
- textPtr->refCount--;
- if (textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
return;
@@ -4163,7 +4162,7 @@ DisplayText(
textPtr->refCount++;
dInfoPtr->flags &= ~REPICK_NEEDED;
TkTextPickCurrent(textPtr, &textPtr->pickEvent);
- if (--textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
goto end;
}
@@ -6752,7 +6751,7 @@ AsyncUpdateYScrollbar(
GetYView(textPtr->interp, textPtr, 1);
}
- if (--textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
}