summaryrefslogtreecommitdiffstats
path: root/generic/tkTextDisp.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-25 12:52:45 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-25 12:52:45 (GMT)
commite49c53fa60a2329599dc7dbd69ee4f841be994c8 (patch)
treede370306d5c18cf0e0217eb884ea8b6a01024080 /generic/tkTextDisp.c
parent5a024656faa09acb77aa34603e41b1cd5e38fbe5 (diff)
downloadtk-e49c53fa60a2329599dc7dbd69ee4f841be994c8.zip
tk-e49c53fa60a2329599dc7dbd69ee4f841be994c8.tar.gz
tk-e49c53fa60a2329599dc7dbd69ee4f841be994c8.tar.bz2
More usage of TCL_UNUSED() and implicit type-casts. Eliminate "register" keyword
Diffstat (limited to 'generic/tkTextDisp.c')
-rw-r--r--generic/tkTextDisp.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 0eae4a9..a02544d 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -1072,8 +1072,7 @@ FreeStyle(
TextStyle *stylePtr)
/* Information about style to free. */
{
- stylePtr->refCount--;
- if (stylePtr->refCount == 0) {
+ if (stylePtr->refCount-- <= 1) {
if (stylePtr->bgGC != NULL) {
Tk_FreeGC(textPtr->display, stylePtr->bgGC);
}
@@ -3164,8 +3163,8 @@ GenerateWidgetViewSyncEvent(
} else {
textPtr->dInfoPtr->flags |= OUT_OF_SYNC;
}
- TkSendVirtualEvent(textPtr->tkwin, "WidgetViewSync",
- Tcl_NewBooleanObj(NewSyncState));
+ TkSendVirtualEvent(textPtr->tkwin, "WidgetViewSync",
+ Tcl_NewBooleanObj(NewSyncState));
}
}
@@ -8811,24 +8810,25 @@ TextGetScrollInfoObj(
}
switch ((enum viewUnits) index) {
case VIEW_SCROLL_PAGES:
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
- return TKTEXT_SCROLL_ERROR;
+ if (Tcl_GetIntFromObj(interp, objv[3], intPtr) == TCL_OK) {
+ return TKTEXT_SCROLL_PAGES;
}
- return TKTEXT_SCROLL_PAGES;
+ break;
case VIEW_SCROLL_PIXELS:
if (Tk_GetPixelsFromObj(interp, textPtr->tkwin, objv[3],
- intPtr) != TCL_OK) {
- return TKTEXT_SCROLL_ERROR;
+ intPtr) == TCL_OK) {
+ return TKTEXT_SCROLL_PIXELS;
}
- return TKTEXT_SCROLL_PIXELS;
+ break;
case VIEW_SCROLL_UNITS:
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
- return TKTEXT_SCROLL_ERROR;
+ if (Tcl_GetIntFromObj(interp, objv[3], intPtr) == TCL_OK) {
+ return TKTEXT_SCROLL_UNITS;
}
- return TKTEXT_SCROLL_UNITS;
+ break;
+ default:
+ Tcl_Panic("unexpected switch fallthrough");
}
}
- Tcl_Panic("unexpected switch fallthrough");
return TKTEXT_SCROLL_ERROR;
}