diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-02-27 12:36:56 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-02-27 12:36:56 (GMT) |
commit | 3ce2b87dd5e2937555b28b21c6d40e812e77a3de (patch) | |
tree | c60953cf292d7784e416ed6fd0555d89d2e6f2c3 /generic | |
parent | 80385b31add9a7e4f9d43b78ff46591fb0def3d6 (diff) | |
download | tk-3ce2b87dd5e2937555b28b21c6d40e812e77a3de.zip tk-3ce2b87dd5e2937555b28b21c6d40e812e77a3de.tar.gz tk-3ce2b87dd5e2937555b28b21c6d40e812e77a3de.tar.bz2 |
Eliminate all Tcl_GetIndexFromObj calls, which is only a thin wrapper around Tcl_GetIndexFromObjStruct.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkCanvas.c | 16 | ||||
-rw-r--r-- | generic/tkClipboard.c | 16 | ||||
-rw-r--r-- | generic/tkCmds.c | 24 | ||||
-rw-r--r-- | generic/tkEntry.c | 24 | ||||
-rw-r--r-- | generic/tkEvent.c | 2 | ||||
-rw-r--r-- | generic/tkFont.c | 16 | ||||
-rw-r--r-- | generic/tkGet.c | 8 | ||||
-rw-r--r-- | generic/tkGrab.c | 12 | ||||
-rw-r--r-- | generic/tkImgPhoto.c | 12 | ||||
-rw-r--r-- | generic/tkListbox.c | 15 | ||||
-rw-r--r-- | generic/tkPanedWindow.c | 12 | ||||
-rw-r--r-- | generic/tkSelect.c | 20 | ||||
-rw-r--r-- | generic/tkTextBTree.c | 2 |
13 files changed, 90 insertions, 89 deletions
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 23d8e04..05bc623 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -828,8 +828,8 @@ CanvasWidgetCmd( Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } Tcl_Preserve(canvasPtr); @@ -1887,8 +1887,8 @@ CanvasWidgetCmd( if (objc < 5) { Tcl_WrongNumArgs(interp, 2, objv, "mark|dragto x y ?dragGain?"); result = TCL_ERROR; - } else if (Tcl_GetIndexFromObj(interp, objv[2], optionStrings, - "scan option", 0, &index) != TCL_OK) { + } else if (Tcl_GetIndexFromObjStruct(interp, objv[2], optionStrings, + sizeof(char *), "scan option", 0, &index) != TCL_OK) { result = TCL_ERROR; } else if ((objc != 5) && (objc != 5+index)) { Tcl_WrongNumArgs(interp, 3, objv, index?"x y ?gain?":"x y"); @@ -1959,8 +1959,8 @@ CanvasWidgetCmd( goto done; } } - if (Tcl_GetIndexFromObj(interp, objv[2], optionStrings, - "select option", 0, &optionindex) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[2], optionStrings, + sizeof(char *), "select option", 0, &optionindex) != TCL_OK) { result = TCL_ERROR; goto done; } @@ -4301,8 +4301,8 @@ FindItems( } else { uid = NULL; } - if (Tcl_GetIndexFromObj(interp, objv[first], optionStrings, - "search command", 0, &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[first], optionStrings, + sizeof(char *), "search command", 0, &index) != TCL_OK) { return TCL_ERROR; } switch ((enum options) index) { diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index b902625..a6fa234 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.c @@ -434,8 +434,8 @@ Tk_ClipboardObjCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -464,8 +464,8 @@ Tk_ClipboardObjCmd( i++; break; } - if (Tcl_GetIndexFromObj(interp, objv[i], appendOptionStrings, - "option", 0, &subIndex) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[i], appendOptionStrings, + sizeof(char *), "option", 0, &subIndex) != TCL_OK) { return TCL_ERROR; } @@ -527,8 +527,8 @@ Tk_ClipboardObjCmd( } if (objc == 4) { - if (Tcl_GetIndexFromObj(interp, objv[2], clearOptionStrings, - "option", 0, &subIndex) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[2], clearOptionStrings, + sizeof(char *), "option", 0, &subIndex) != TCL_OK) { return TCL_ERROR; } if ((enum clearOptions) subIndex == CLEAR_DISPLAYOF) { @@ -560,8 +560,8 @@ Tk_ClipboardObjCmd( if (string[0] != '-') { break; } - if (Tcl_GetIndexFromObj(interp, objv[i], getOptionStrings, - "option", 0, &subIndex) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[i], getOptionStrings, + sizeof(char *), "option", 0, &subIndex) != TCL_OK) { return TCL_ERROR; } i++; diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 4933d34..f7fa27c 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -760,8 +760,8 @@ CaretCmd( * Return the current value of the selected option */ - if (Tcl_GetIndexFromObj(interp, objv[2], caretStrings, - "caret option", 0, &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[2], caretStrings, + sizeof(char *), "caret option", 0, &index) != TCL_OK) { return TCL_ERROR; } if (index == TK_CARET_X) { @@ -776,8 +776,8 @@ CaretCmd( int i, value, x = 0, y = 0, height = -1; for (i = 2; i < objc; i += 2) { - if ((Tcl_GetIndexFromObj(interp, objv[i], caretStrings, - "caret option", 0, &index) != TCL_OK) || + if ((Tcl_GetIndexFromObjStruct(interp, objv[i], caretStrings, + sizeof(char *), "caret option", 0, &index) != TCL_OK) || Tcl_GetIntFromObj(interp,objv[i+1],&value) != TCL_OK) { return TCL_ERROR; } @@ -1011,8 +1011,8 @@ Tk_TkwaitObjCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -1192,8 +1192,8 @@ Tk_UpdateObjCmd( if (objc == 1) { flags = TCL_DONT_WAIT; } else if (objc == 2) { - if (Tcl_GetIndexFromObj(interp, objv[1], updateOptions, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], updateOptions, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } flags = TCL_IDLE_EVENTS; @@ -1339,8 +1339,8 @@ Tk_WinfoObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "option ?arg?"); return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -1863,8 +1863,8 @@ Tk_WmObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg?"); return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tkEntry.c b/generic/tkEntry.c index eb94cbd..7ee6ad2 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -602,8 +602,8 @@ EntryWidgetObjCmd( * valid command names. */ - result = Tcl_GetIndexFromObj(interp, objv[1], entryCmdNames, "option", 0, - &cmdIndex); + result = Tcl_GetIndexFromObjStruct(interp, objv[1], entryCmdNames, + sizeof(char *), "option", 0, &cmdIndex); if (result != TCL_OK) { return result; } @@ -782,8 +782,8 @@ EntryWidgetObjCmd( * "selCmdNames" defined above. */ - result = Tcl_GetIndexFromObj(interp, objv[2], selCmdNames, - "selection option", 0, &selIndex); + result = Tcl_GetIndexFromObjStruct(interp, objv[2], selCmdNames, + sizeof(char *), "selection option", 0, &selIndex); if (result != TCL_OK) { goto error; } @@ -3656,8 +3656,8 @@ SpinboxWidgetObjCmd( * valid command names. */ - result = Tcl_GetIndexFromObj(interp, objv[1], sbCmdNames, - "option", 0, &cmdIndex); + result = Tcl_GetIndexFromObjStruct(interp, objv[1], sbCmdNames, + sizeof(char *), "option", 0, &cmdIndex); if (result != TCL_OK) { return result; } @@ -3817,8 +3817,8 @@ SpinboxWidgetObjCmd( Tcl_WrongNumArgs(interp, 2, objv, "elemName"); goto error; } - result = Tcl_GetIndexFromObj(interp, objv[2], - selElementNames, "element", 0, &cmdIndex); + result = Tcl_GetIndexFromObjStruct(interp, objv[2], selElementNames, + sizeof(char *), "element", 0, &cmdIndex); if (result != TCL_OK) { goto error; } @@ -3873,8 +3873,8 @@ SpinboxWidgetObjCmd( * "sbSelCmdNames" defined above. */ - result = Tcl_GetIndexFromObj(interp, objv[2], sbSelCmdNames, - "selection option", 0, &selIndex); + result = Tcl_GetIndexFromObjStruct(interp, objv[2], sbSelCmdNames, + sizeof(char *), "selection option", 0, &selIndex); if (result != TCL_OK) { goto error; } @@ -4003,8 +4003,8 @@ SpinboxWidgetObjCmd( } else { int lastElement = sbPtr->selElement; - result = Tcl_GetIndexFromObj(interp, objv[3], selElementNames, - "selection element", 0, &(sbPtr->selElement)); + result = Tcl_GetIndexFromObjStruct(interp, objv[3], selElementNames, + sizeof(char *), "selection element", 0, &(sbPtr->selElement)); if (result != TCL_OK) { goto error; } diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 463379a..ce0ba23 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -356,7 +356,7 @@ CreateXIC( /* XCreateIC failed. */ return; } - + /* * Adjust the window's event mask if the IM requires it. */ diff --git a/generic/tkFont.c b/generic/tkFont.c index 4485df8..ed9b813 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -486,8 +486,8 @@ Tk_FontObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "option ?arg?"); return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -763,8 +763,8 @@ Tk_FontObjCmd( fmPtr->ascent, fmPtr->descent, fmPtr->ascent + fmPtr->descent, fmPtr->fixed)); } else { - if (Tcl_GetIndexFromObj(interp, objv[3], switches, "metric", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[3], switches, + sizeof(char *), "metric", 0, &index) != TCL_OK) { Tk_FreeFont(tkfont); return TCL_ERROR; } @@ -3368,8 +3368,8 @@ ConfigAttributesObj( optionPtr = objv[i]; valuePtr = objv[i + 1]; - if (Tcl_GetIndexFromObj(interp, optionPtr, fontOpt, "option", 1, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, optionPtr, fontOpt, + sizeof(char *), "option", 1, &index) != TCL_OK) { return TCL_ERROR; } if ((i+2 >= objc) && (objc & 1)) { @@ -3468,8 +3468,8 @@ GetAttributeInfoObj( start = 0; end = FONT_NUMFIELDS; if (objPtr != NULL) { - if (Tcl_GetIndexFromObj(interp, objPtr, fontOpt, "option", TCL_EXACT, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objPtr, fontOpt, + sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) { return TCL_ERROR; } start = index; diff --git a/generic/tkGet.c b/generic/tkGet.c index d58b4a5..c220fdc 100644 --- a/generic/tkGet.c +++ b/generic/tkGet.c @@ -71,8 +71,8 @@ Tk_GetAnchorFromObj( { int index, code; - code = Tcl_GetIndexFromObj(interp, objPtr, anchorStrings, "anchor", 0, - &index); + code = Tcl_GetIndexFromObjStruct(interp, objPtr, anchorStrings, + sizeof(char *), "anchor", 0, &index); if (code == TCL_OK) { *anchorPtr = (Tk_Anchor) index; } @@ -385,8 +385,8 @@ Tk_GetJustifyFromObj( { int index, code; - code = Tcl_GetIndexFromObj(interp, objPtr, justifyStrings, - "justification", 0, &index); + code = Tcl_GetIndexFromObjStruct(interp, objPtr, justifyStrings, + sizeof(char *), "justification", 0, &index); if (code == TCL_OK) { *justifyPtr = (Tk_Justify) index; } diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 2df5552..8644014 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -240,8 +240,8 @@ Tk_GrabObjCmd( } return Tk_Grab(interp, tkwin, 0); } else if (arg[0] == '-' && len > 1) { - if (Tcl_GetIndexFromObj(interp, objv[1], flagStrings, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], flagStrings, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -262,8 +262,8 @@ Tk_GrabObjCmd( * option it is. */ - if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -333,8 +333,8 @@ Tk_GrabObjCmd( * consistant with the rest of Tcl. */ - if (Tcl_GetIndexFromObj(interp, objv[2], flagStrings, "option", - 0, &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[2], flagStrings, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[3]), diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 4fcc3db..7fd84d9 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -420,8 +420,8 @@ ImgPhotoCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], photoOptions, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], photoOptions, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -1145,8 +1145,8 @@ ImgPhotoCmd( Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?"); return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[2], photoTransOptions, "option", - 0, &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[2], photoTransOptions, + sizeof(char *) , "option", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -1565,8 +1565,8 @@ ParseSubcommandOptions( goto oneValueRequired; } index++; - if (Tcl_GetIndexFromObj(interp, objv[index], compositingRules, - "compositing rule", 0, &optPtr->compositingRule) + if (Tcl_GetIndexFromObjStruct(interp, objv[index], compositingRules, + sizeof(char *), "compositing rule", 0, &optPtr->compositingRule) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tkListbox.c b/generic/tkListbox.c index c5460f9..77a2d34 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -615,8 +615,8 @@ ListboxWidgetObjCmd( * valid subcommand names */ - result = Tcl_GetIndexFromObj(interp, objv[1], commandNames, - "option", 0, &cmdIndex); + result = Tcl_GetIndexFromObjStruct(interp, objv[1], commandNames, + sizeof(char *), "option", 0, &cmdIndex); if (result != TCL_OK) { return result; } @@ -969,8 +969,8 @@ ListboxWidgetObjCmd( break; } - result = Tcl_GetIndexFromObj(interp, objv[2], scanCommandNames, - "option", 0, &scanCmdIndex); + result = Tcl_GetIndexFromObjStruct(interp, objv[2], scanCommandNames, + sizeof(char *), "option", 0, &scanCmdIndex); if (result != TCL_OK) { break; } @@ -1164,8 +1164,8 @@ ListboxSelectionSubCmd( return result; } } - result = Tcl_GetIndexFromObj(interp, objv[2], selCommandNames, - "option", 0, &selCmdIndex); + result = Tcl_GetIndexFromObjStruct(interp, objv[2], selCommandNames, + sizeof(char *), "option", 0, &selCmdIndex); if (result != TCL_OK) { return result; } @@ -2709,7 +2709,8 @@ GetListboxIndex( * First see if the index is one of the named indices. */ - result = Tcl_GetIndexFromObj(NULL, indexObj, indexNames, "", 0, &index); + result = Tcl_GetIndexFromObjStruct(NULL, indexObj, indexNames, + sizeof(char *), "", 0, &index); if (result == TCL_OK) { switch (index) { case INDEX_ACTIVE: diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index 733610e..8b242aa 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -540,8 +540,8 @@ PanedWindowWidgetObjCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "command", - 0, &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, + sizeof(char *), "command", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -1084,8 +1084,8 @@ PanedWindowSashCommand( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[2], sashOptionStrings, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[2], sashOptionStrings, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -2778,8 +2778,8 @@ PanedWindowProxyCommand( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[2], optionStrings, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[2], optionStrings, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tkSelect.c b/generic/tkSelect.c index 2414b3d..8afe6ca 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -689,8 +689,8 @@ Tk_SelectionObjCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -715,8 +715,8 @@ Tk_SelectionObjCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objs[0], clearOptionStrings, - "option", 0, &clearIndex) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objs[0], clearOptionStrings, + sizeof(char *), "option", 0, &clearIndex) != TCL_OK) { return TCL_ERROR; } switch ((enum clearOptions) clearIndex) { @@ -775,8 +775,8 @@ Tk_SelectionObjCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objs[0], getOptionStrings, - "option", 0, &getIndex) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objs[0], getOptionStrings, + sizeof(char *), "option", 0, &getIndex) != TCL_OK) { return TCL_ERROR; } @@ -853,8 +853,8 @@ Tk_SelectionObjCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objs[0],handleOptionStrings, - "option", 0, &handleIndex) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objs[0],handleOptionStrings, + sizeof(char *), "option", 0, &handleIndex) != TCL_OK) { return TCL_ERROR; } @@ -940,8 +940,8 @@ Tk_SelectionObjCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objs[0], ownOptionStrings, - "option", 0, &ownIndex) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objs[0], ownOptionStrings, + sizeof(char *), "option", 0, &ownIndex) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index e34dae7..a06d7e9 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -1989,7 +1989,7 @@ TkBTreeLinesTo( } } if (textPtr != NULL) { - /* + /* * The index to return must be relative to textPtr, not to the entire * tree. Take care to never return a negative index when linePtr * denotes a line before -startline, or an index larger than the |