diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-01-28 11:24:03 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-01-28 11:24:03 (GMT) |
commit | f5cd036029ec84c3e42c672341d77ca013afbc71 (patch) | |
tree | 65123df923e2cd33f1a897da5b4a37c2e704270f | |
parent | 13e6c44129865089d8680474141354555450ae04 (diff) | |
download | tk-f5cd036029ec84c3e42c672341d77ca013afbc71.zip tk-f5cd036029ec84c3e42c672341d77ca013afbc71.tar.gz tk-f5cd036029ec84c3e42c672341d77ca013afbc71.tar.bz2 |
Convert all Tcl_SetResult calls to Tcl_SetObjResult calls.
Convert Tcl_GetStringFromObj to Tcl_GetString when possible.
-rw-r--r-- | generic/tkConfig.c | 4 | ||||
-rw-r--r-- | generic/tkObj.c | 10 | ||||
-rw-r--r-- | generic/tkOldConfig.c | 2 | ||||
-rw-r--r-- | generic/tkPanedWindow.c | 2 | ||||
-rw-r--r-- | generic/tkTest.c | 10 | ||||
-rw-r--r-- | generic/tkUtil.c | 2 | ||||
-rw-r--r-- | win/tkWinDialog.c | 2 | ||||
-rw-r--r-- | win/tkWinMenu.c | 2 | ||||
-rw-r--r-- | win/tkWinTest.c | 10 |
9 files changed, 21 insertions, 23 deletions
diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 375bca7..2503f31 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -1347,7 +1347,7 @@ Tk_SetOptions( if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "value for \"%s\" missing", - Tcl_GetStringFromObj(*objv, NULL))); + Tcl_GetString(*objv))); Tcl_SetErrorCode(interp, "TK", "VALUE_MISSING", NULL); goto error; } @@ -1372,7 +1372,7 @@ Tk_SetOptions( : NULL) != TCL_OK) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (processing \"%.40s\" option)", - Tcl_GetStringFromObj(*objv, NULL))); + Tcl_GetString(*objv))); goto error; } if (savePtr != NULL) { diff --git a/generic/tkObj.c b/generic/tkObj.c index ed947d3..1ccf3c5 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -447,7 +447,7 @@ SetPixelFromAny( double d; int i, units; - string = Tcl_GetStringFromObj(objPtr, NULL); + string = Tcl_GetString(objPtr); d = strtod(string, &rest); if (rest == string) { @@ -719,13 +719,13 @@ SetMMFromAny( * ints again from mm obj types. */ - (void) Tcl_GetStringFromObj(objPtr, NULL); + (void) Tcl_GetString(objPtr); } else { /* * It wasn't a known int or double, so parse it. */ - string = Tcl_GetStringFromObj(objPtr, NULL); + string = Tcl_GetString(objPtr); d = strtod(string, &rest); if (rest == string) { @@ -834,7 +834,7 @@ TkGetWindowFromObj( */ winPtr->tkwin = Tk_NameToWindow(interp, - Tcl_GetStringFromObj(objPtr, NULL), tkwin); + Tcl_GetString(objPtr), tkwin); if (winPtr->tkwin == NULL) { /* ASSERT: Tk_NameToWindow has left error message in interp */ return TCL_ERROR; @@ -880,7 +880,7 @@ SetWindowFromAny( * Free the old internalRep before setting the new one. */ - Tcl_GetStringFromObj(objPtr, NULL); + Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index 5496076..f9a69de 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -122,7 +122,7 @@ Tk_ConfigureWidget( const char *arg; if (flags & TK_CONFIG_OBJS) { - arg = Tcl_GetStringFromObj((Tcl_Obj *) *argv, NULL); + arg = Tcl_GetString((Tcl_Obj *) *argv); } else { arg = *argv; } diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index 4a4af53..eb92aae 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -384,7 +384,7 @@ Tk_PanedWindowObjCmd( } tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp), - Tcl_GetStringFromObj(objv[1], NULL), NULL); + Tcl_GetString(objv[1]), NULL); if (tkwin == NULL) { return TCL_ERROR; } diff --git a/generic/tkTest.c b/generic/tkTest.c index e084a52..13415c4 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -1734,8 +1734,7 @@ TestmenubarCmd( return TCL_OK; #else - Tcl_SetResult(interp, "testmenubar is supported only under Unix", - TCL_STATIC); + Tcl_AppendResult(interp, "testmenubar is supported only under Unix", NULL); return TCL_ERROR; #endif } @@ -1868,7 +1867,7 @@ TestpropCmd( *p = '\n'; } } - Tcl_SetResult(interp, (/*!unsigned*/char*)property, TCL_VOLATILE); + Tcl_SetObjResult(interp, Tcl_NewStringObj((/*!unsigned*/char*)property, -1)); } else { for (p = property; length > 0; length--) { if (actualFormat == 32) { @@ -1939,7 +1938,7 @@ TestwrapperCmd( char buf[TCL_INTEGER_SPACE]; TkpPrintWindowId(buf, Tk_WindowId(wrapperPtr)); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1)); } return TCL_OK; } @@ -2013,8 +2012,7 @@ CustomOptionSet( string = Tcl_GetStringFromObj((*value), &length); Tcl_UtfToUpper(string); if (strcmp(string, "BAD") == 0) { - Tcl_SetResult(interp, "expected good value, got \"BAD\"", - TCL_STATIC); + Tcl_SetObjResult(interp, Tcl_NewStringObj("expected good value, got \"BAD\"", -1)); return TCL_ERROR; } } diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 385d1cb..0290c94 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -970,7 +970,7 @@ TkFindStateNumObj( * Not there. Look in the state map. */ - key = Tcl_GetStringFromObj(keyPtr, NULL); + key = Tcl_GetString(keyPtr); for (mPtr = mapPtr; mPtr->strKey != NULL; mPtr++) { if (strcmp(key, mPtr->strKey) == 0) { typePtr = keyPtr->typePtr; diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 069247e..3b1351e 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -1134,7 +1134,7 @@ MakeFilter( FileFilter *filterPtr; if (initialPtr) { - initial = Tcl_GetStringFromObj(initialPtr, NULL); + initial = Tcl_GetString(initialPtr); } TkInitFileFilters(&flist); if (TkGetFileFilters(interp, &flist, valuePtr, 1) != TCL_OK) { diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 26f08f4..b7b5598 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -1948,7 +1948,7 @@ DrawMenuUnderline( if (mePtr->underline < len) { const char *label, *start, *end; - label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL); + label = Tcl_GetString(mePtr->labelPtr); start = Tcl_UtfAtIndex(label, mePtr->underline); end = Tcl_UtfNext(start); Tk_UnderlineChars(menuPtr->display, d, diff --git a/win/tkWinTest.c b/win/tkWinTest.c index 3dd7d7a..6036995 100644 --- a/win/tkWinTest.c +++ b/win/tkWinTest.c @@ -286,7 +286,7 @@ TestwineventCmd( if (rest == argv[1]) { hwnd = FindWindowA(NULL, argv[1]); if (hwnd == NULL) { - Tcl_SetResult(interp, "no such window", TCL_STATIC); + Tcl_SetObjResult(interp, Tcl_NewStringObj("no such window", -1)); return TCL_ERROR; } } @@ -341,7 +341,7 @@ TestwineventCmd( result = SetDlgItemTextA(hwnd, id, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); if (result == 0) { - Tcl_SetResult(interp, "failed to send text to dialog: ", TCL_STATIC); + Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to send text to dialog: ", -1)); AppendSystemError(interp, GetLastError()); return TCL_ERROR; } @@ -354,7 +354,7 @@ TestwineventCmd( lParam = (LPARAM)child; } sprintf(buf, "%d", (int) SendMessageA(hwnd, message, wParam, lParam)); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1)); break; } default: { @@ -362,7 +362,7 @@ TestwineventCmd( sprintf(buf, "%d", (int) SendDlgItemMessageA(hwnd, id, message, wParam, lParam)); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1)); break; } } @@ -455,7 +455,7 @@ TestgetwindowinfoObjCmd( cch = GetClassName(INT2PTR(hwnd), buf, cchBuf); if (cch == 0) { - Tcl_SetResult(interp, "failed to get class name: ", TCL_STATIC); + Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to get class name: ", -1)); AppendSystemError(interp, GetLastError()); return TCL_ERROR; } else { |