summaryrefslogtreecommitdiffstats
path: root/generic/tkTextMark.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/tkTextMark.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/tkTextMark.c')
-rw-r--r--generic/tkTextMark.c63
1 files changed, 30 insertions, 33 deletions
diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c
index 6a41c77..dcd7008 100644
--- a/generic/tkTextMark.c
+++ b/generic/tkTextMark.c
@@ -19,7 +19,7 @@
* Macro that determines the size of a mark segment:
*/
-#define MSEG_SIZE ((unsigned) (Tk_Offset(TkTextSegment, body) \
+#define MSEG_SIZE ((unsigned)(Tk_Offset(TkTextSegment, body) \
+ sizeof(TkTextMark)))
/*
@@ -93,7 +93,7 @@ const Tk_SegType tkTextLeftMarkType = {
int
TkTextMarkCmd(
- register TkText *textPtr, /* Information about text widget. */
+ TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
@@ -147,7 +147,7 @@ TkTextMarkCmd(
NULL);
return TCL_ERROR;
}
- markPtr = Tcl_GetHashValue(hPtr);
+ markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
}
if (objc == 4) {
const char *typeStr;
@@ -162,10 +162,10 @@ TkTextMarkCmd(
}
str = Tcl_GetStringFromObj(objv[4],&length);
c = str[0];
- if ((c == 'l') && (strncmp(str, "left", (unsigned) length) == 0)) {
+ if ((c == 'l') && (strncmp(str, "left", length) == 0)) {
newTypePtr = &tkTextLeftMarkType;
} else if ((c == 'r') &&
- (strncmp(str, "right", (unsigned) length) == 0)) {
+ (strncmp(str, "right", length) == 0)) {
newTypePtr = &tkTextRightMarkType;
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -194,7 +194,7 @@ TkTextMarkCmd(
for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->markTable,
&search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
- Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
+ (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
-1));
}
Tcl_SetObjResult(interp, resultObj);
@@ -229,7 +229,7 @@ TkTextMarkCmd(
hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable,
Tcl_GetString(objv[i]));
if (hPtr != NULL) {
- markPtr = Tcl_GetHashValue(hPtr);
+ markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
/*
* Special case not needed with peer widgets.
@@ -290,7 +290,7 @@ TkTextSetMark(
widgetSpecific = 0;
hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->markTable, name,
&isNew);
- markPtr = Tcl_GetHashValue(hPtr);
+ markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
}
if (!isNew) {
/*
@@ -330,7 +330,7 @@ TkTextSetMark(
}
TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr);
} else {
- markPtr = ckalloc(MSEG_SIZE);
+ markPtr = (TkTextSegment *)ckalloc(MSEG_SIZE);
markPtr->typePtr = &tkTextRightMarkType;
markPtr->size = 0;
markPtr->body.mark.textPtr = textPtr;
@@ -452,7 +452,7 @@ TkTextMarkNameToIndex(
if (hPtr == NULL) {
return TCL_ERROR;
}
- segPtr = Tcl_GetHashValue(hPtr);
+ segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
}
TkTextMarkSegToIndex(textPtr, segPtr, indexPtr);
@@ -499,12 +499,11 @@ TkTextMarkNameToIndex(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
MarkDeleteProc(
- TkTextSegment *segPtr, /* Segment being deleted. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextSegment *), /* Segment being deleted. */
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
@@ -559,18 +558,18 @@ MarkCleanupProc(
static int
MarkLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *segPtr, /* Segment corresponding to indexPtr. */
- int offset, /* Offset within segPtr corresponding to
+ TCL_UNUSED(int), /* Offset within segPtr corresponding to
* indexPtr (always 0). */
- int maxX, /* Chunk must not occupy pixels at this
+ TCL_UNUSED(int), /* Chunk must not occupy pixels at this
* position or higher. */
- int maxChars, /* Chunk must not include more than this many
+ TCL_UNUSED(int), /* Chunk must not include more than this many
* characters. */
- int noCharsYet, /* Non-zero means no characters have been
+ TCL_UNUSED(int), /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode, /* Not used. */
- register TkTextDispChunk *chunkPtr)
+ TCL_UNUSED(TkWrapMode), /* Not used. */
+ TkTextDispChunk *chunkPtr)
/* Structure to fill in with information about
* this chunk. The x field has already been
* set by the caller. */
@@ -615,19 +614,18 @@ MarkLayoutProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
void
TkTextInsertDisplayProc(
TkText *textPtr, /* The current text widget. */
- TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
+ TCL_UNUSED(TkTextDispChunk *), /* Chunk that is to be drawn. */
int x, /* X-position in dst at which to draw this
* chunk (may differ from the x-position in
* the chunk because of scrolling). */
int y, /* Y-position at which to draw this chunk in
* dst (x-position is in the chunk itself). */
int height, /* Total height of line. */
- int baseline, /* Offset of baseline from y. */
- Display *display, /* Display to use for drawing. */
+ TCL_UNUSED(int), /* Offset of baseline from y. */
+ TCL_UNUSED(Display *), /* Display to use for drawing. */
Drawable dst, /* Pixmap or window in which to draw chunk. */
int screenY) /* Y-coordinate in text window that
* corresponds to y. */
@@ -721,11 +719,10 @@ TkTextInsertDisplayProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static void
InsertUndisplayProc(
- TkText *textPtr, /* Overall information about text widget. */
- TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
+ TCL_UNUSED(TkText *), /* Overall information about text widget. */
+ TCL_UNUSED(TkTextDispChunk *)) /* Chunk that is about to be freed. */
{
return;
}
@@ -809,7 +806,7 @@ MarkFindNext(
{
TkTextIndex index;
Tcl_HashEntry *hPtr;
- register TkTextSegment *segPtr;
+ TkTextSegment *segPtr;
int offset;
const char *string = Tcl_GetString(obj);
@@ -830,7 +827,7 @@ MarkFindNext(
* position.
*/
- segPtr = Tcl_GetHashValue(hPtr);
+ segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
TkTextMarkSegToIndex(textPtr, segPtr, &index);
segPtr = segPtr->nextPtr;
} else {
@@ -900,7 +897,7 @@ MarkFindPrev(
{
TkTextIndex index;
Tcl_HashEntry *hPtr;
- register TkTextSegment *segPtr, *seg2Ptr, *prevPtr;
+ TkTextSegment *segPtr, *seg2Ptr, *prevPtr;
int offset;
const char *string = Tcl_GetString(obj);
@@ -919,7 +916,7 @@ MarkFindPrev(
* position.
*/
- segPtr = Tcl_GetHashValue(hPtr);
+ segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
TkTextMarkSegToIndex(textPtr, segPtr, &index);
} else {
/*
@@ -1012,7 +1009,7 @@ GetMarkName(
return NULL;
} else {
- markName = Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
+ markName = (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
segPtr->body.mark.hPtr);
}
return Tcl_NewStringObj(markName, -1);