diff options
author | donal.k.fellows@manchester.ac.uk <dkf> | 2008-10-05 18:22:21 (GMT) |
---|---|---|
committer | donal.k.fellows@manchester.ac.uk <dkf> | 2008-10-05 18:22:21 (GMT) |
commit | a21256d499833c2885e43967cf77be2934dad4e6 (patch) | |
tree | 57b5f8cd5ff8ef866da62495bc435946f4655c50 /unix/tkUnixFont.c | |
parent | 112dd0c62b3fffdeb03e0be53a9dea3920e59f27 (diff) | |
download | tk-a21256d499833c2885e43967cf77be2934dad4e6.zip tk-a21256d499833c2885e43967cf77be2934dad4e6.tar.gz tk-a21256d499833c2885e43967cf77be2934dad4e6.tar.bz2 |
Greatly clean up Tk's handling of the writability of the Tcl result object.
Diffstat (limited to 'unix/tkUnixFont.c')
-rw-r--r-- | unix/tkUnixFont.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index 286ac32..7409f2f 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixFont.c,v 1.34 2008/04/27 22:39:13 dkf Exp $ + * RCS: @(#) $Id: tkUnixFont.c,v 1.35 2008/10/05 18:22:21 dkf Exp $ */ #include "tkUnixInt.h" @@ -847,8 +847,6 @@ TkpGetFontFamilies( Tcl_HashSearch search; Tcl_Obj *resultPtr, *strPtr; - resultPtr = Tcl_GetObjResult(interp); - Tcl_InitHashTable(&familyTable, TCL_STRING_KEYS); nameList = ListFonts(Tk_Display(tkwin), "*", &numNames); for (i = 0; i < numNames; i++) { @@ -876,11 +874,13 @@ TkpGetFontFamilies( XFreeFontNames(nameList); hPtr = Tcl_FirstHashEntry(&familyTable, &search); + resultPtr = Tcl_NewObj(); while (hPtr != NULL) { strPtr = Tcl_NewStringObj(Tcl_GetHashKey(&familyTable, hPtr), -1); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); hPtr = Tcl_NextHashEntry(&search); } + Tcl_SetObjResult(interp, resultPtr); Tcl_DeleteHashTable(&familyTable); } @@ -913,7 +913,7 @@ TkpGetSubFonts( UnixFont *fontPtr; FontFamily *familyPtr; - resultPtr = Tcl_GetObjResult(interp); + resultPtr = Tcl_NewObj(); fontPtr = (UnixFont *) tkfont; for (i = 0; i < fontPtr->numSubFonts; i++) { familyPtr = fontPtr->subFontArray[i].familyPtr; @@ -924,6 +924,7 @@ TkpGetSubFonts( listPtr = Tcl_NewListObj(3, objv); Tcl_ListObjAppendElement(NULL, resultPtr, listPtr); } + Tcl_SetObjResult(interp, resultPtr); } /* |