diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-09-07 17:51:22 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-09-07 17:51:22 (GMT) |
commit | c17a596a46276be330a0cc30a7c1d4c638847f93 (patch) | |
tree | 2b9510fab457ba32d587585c2032068f9a38d58c | |
parent | aecfb1bc250e184c07f234d7df9e9a7234911078 (diff) | |
download | tk-c17a596a46276be330a0cc30a7c1d4c638847f93.zip tk-c17a596a46276be330a0cc30a7c1d4c638847f93.tar.gz tk-c17a596a46276be330a0cc30a7c1d4c638847f93.tar.bz2 |
Use Tk_AllocColorFromObj() in stead of Tk_GetColor() where possible: it's more efficient (see documentation)
-rw-r--r-- | generic/tkCmds.c | 4 | ||||
-rw-r--r-- | generic/tkImgPhoto.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXDialog.c | 2 | ||||
-rw-r--r-- | win/tkWinDialog.c | 2 | ||||
-rw-r--r-- | win/tkWinWm.c | 4 |
5 files changed, 8 insertions, 8 deletions
diff --git a/generic/tkCmds.c b/generic/tkCmds.c index a642137..22e489d 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -1754,11 +1754,11 @@ Tk_WinfoObjCmd( { Colormap temp = Tk_Colormap(tkwin); Tk_Colormap(tkwin) = TK_DYNAMIC_COLORMAP; - colorPtr = Tk_GetColor(interp, tkwin, Tcl_GetString(objv[3])); + colorPtr = Tk_AllocColorFromObj(interp, tkwin, objv[3]); Tk_Colormap(tkwin) = temp; } #else - colorPtr = Tk_GetColor(interp, tkwin, Tcl_GetString(objv[3])); + colorPtr = Tk_AllocColorFromObj(interp, tkwin, objv[3]); #endif if (colorPtr == NULL) { return TCL_ERROR; diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index d1a5f6c..54e92b3 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -1577,8 +1577,8 @@ ParseSubcommandOptions( goto oneValueRequired; } *optIndexPtr = ++index; - optPtr->background = Tk_GetColor(interp, Tk_MainWindow(interp), - Tk_GetUid(Tcl_GetString(objv[index]))); + optPtr->background = Tk_AllocColorFromObj(interp, Tk_MainWindow(interp), + objv[index]); if (!optPtr->background) { return TCL_ERROR; } diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index a6d3c44..8b53f97 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -462,7 +462,7 @@ Tk_ChooseColorObjCmd( case COLOR_INITIAL: { XColor *colorPtr; - colorPtr = Tk_GetColor(interp, tkwin, value); + colorPtr = Tk_AllocColorFromObj(interp, tkwin, objv[i + 1]); if (colorPtr == NULL) { goto end; } diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index fca6cf1..e2cc773 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -816,7 +816,7 @@ Tk_ChooseColorObjCmd( case COLOR_INITIAL: { XColor *colorPtr; - colorPtr = Tk_GetColor(interp, tkwin, string); + colorPtr = Tk_AllocColorFromObj(interp, tkwin, valuePtr); if (colorPtr == NULL) { return TCL_ERROR; } diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 60554c4..b0459d4 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -3137,7 +3137,7 @@ WmAttributesCmd( } wmPtr->alpha = dval; } else { /* -transparentcolor */ - const char *crefstr = Tcl_GetStringFromObj(objv[i+1], &length); + (void)Tcl_GetStringFromObj(objv[i+1], &length); if (length == 0) { /* reset to no transparent color */ @@ -3147,7 +3147,7 @@ WmAttributesCmd( } } else { XColor *cPtr = - Tk_GetColor(interp, tkwin, Tk_GetUid(crefstr)); + Tk_AllocColorFromObj(interp, tkwin, objv[i+1]); if (cPtr == NULL) { return TCL_ERROR; } |