diff options
author | donal.k.fellows@manchester.ac.uk <dkf> | 2011-03-12 17:45:37 (GMT) |
---|---|---|
committer | donal.k.fellows@manchester.ac.uk <dkf> | 2011-03-12 17:45:37 (GMT) |
commit | 05f05325f061f4b18f35ac1a5a5a475f16ad7565 (patch) | |
tree | 08a6b50f74f697e9ebc1f689f06d7318c0aa83a2 /generic/ttk | |
parent | a2bc491898c2a9afbec24c110a8631f436e617cb (diff) | |
download | tk-05f05325f061f4b18f35ac1a5a5a475f16ad7565.zip tk-05f05325f061f4b18f35ac1a5a5a475f16ad7565.tar.gz tk-05f05325f061f4b18f35ac1a5a5a475f16ad7565.tar.bz2 |
Remove casts from uses of ckalloc/ckfree/... now that Tcl declares them to be
using useful casts internally.
Diffstat (limited to 'generic/ttk')
-rw-r--r-- | generic/ttk/ttkBlink.c | 4 | ||||
-rw-r--r-- | generic/ttk/ttkCache.c | 4 | ||||
-rw-r--r-- | generic/ttk/ttkImage.c | 14 | ||||
-rw-r--r-- | generic/ttk/ttkLayout.c | 12 | ||||
-rw-r--r-- | generic/ttk/ttkManager.c | 13 | ||||
-rw-r--r-- | generic/ttk/ttkScroll.c | 4 | ||||
-rw-r--r-- | generic/ttk/ttkTagSet.c | 20 | ||||
-rw-r--r-- | generic/ttk/ttkTheme.c | 30 | ||||
-rw-r--r-- | generic/ttk/ttkTrace.c | 6 | ||||
-rw-r--r-- | generic/ttk/ttkTrack.c | 2 | ||||
-rw-r--r-- | generic/ttk/ttkTreeview.c | 35 |
11 files changed, 70 insertions, 74 deletions
diff --git a/generic/ttk/ttkBlink.c b/generic/ttk/ttkBlink.c index 2476fcd..3829619 100644 --- a/generic/ttk/ttkBlink.c +++ b/generic/ttk/ttkBlink.c @@ -51,10 +51,10 @@ static void CursorManagerDeleteProc(ClientData clientData, Tcl_Interp *interp) static CursorManager *GetCursorManager(Tcl_Interp *interp) { static const char *cm_key = "ttk::CursorManager"; - CursorManager *cm = (CursorManager *) Tcl_GetAssocData(interp, cm_key,0); + CursorManager *cm = Tcl_GetAssocData(interp, cm_key,0); if (!cm) { - cm = (CursorManager*)ckalloc(sizeof(*cm)); + cm = ckalloc(sizeof(*cm)); cm->timer = 0; cm->owner = 0; cm->onTime = DEF_CURSOR_ON_TIME; diff --git a/generic/ttk/ttkCache.c b/generic/ttk/ttkCache.c index 8bb54ec..9163beb 100644 --- a/generic/ttk/ttkCache.c +++ b/generic/ttk/ttkCache.c @@ -50,7 +50,7 @@ struct Ttk_ResourceCache_ { */ Ttk_ResourceCache Ttk_CreateResourceCache(Tcl_Interp *interp) { - Ttk_ResourceCache cache = (Ttk_ResourceCache)ckalloc(sizeof(*cache)); + Ttk_ResourceCache cache = ckalloc(sizeof(*cache)); cache->tkwin = NULL; /* initialized later */ cache->interp = interp; @@ -161,7 +161,7 @@ void Ttk_FreeResourceCache(Ttk_ResourceCache cache) } Tcl_DeleteHashTable(&cache->namedColors); - ckfree((ClientData)cache); + ckfree(cache); } /* diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c index 6f84d9a..e9428ec 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -47,7 +47,7 @@ TtkGetImageSpec(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr) int i = 0, n = 0, objc; Tcl_Obj **objv; - imageSpec = (Ttk_ImageSpec *)ckalloc(sizeof(*imageSpec)); + imageSpec = ckalloc(sizeof(*imageSpec)); imageSpec->baseImage = 0; imageSpec->mapCount = 0; imageSpec->states = 0; @@ -67,8 +67,8 @@ TtkGetImageSpec(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr) } n = (objc - 1) / 2; - imageSpec->states = (Ttk_StateSpec*)ckalloc(n * sizeof(Ttk_StateSpec)); - imageSpec->images = (Tk_Image*)ckalloc(n * sizeof(Tk_Image *)); + imageSpec->states = ckalloc(n * sizeof(Ttk_StateSpec)); + imageSpec->images = ckalloc(n * sizeof(Tk_Image *)); /* Get base image: */ @@ -117,10 +117,10 @@ void TtkFreeImageSpec(Ttk_ImageSpec *imageSpec) } if (imageSpec->baseImage) { Tk_FreeImage(imageSpec->baseImage); } - if (imageSpec->states) { ckfree((ClientData)imageSpec->states); } - if (imageSpec->images) { ckfree((ClientData)imageSpec->images); } + if (imageSpec->states) { ckfree(imageSpec->states); } + if (imageSpec->images) { ckfree(imageSpec->images); } - ckfree((ClientData)imageSpec); + ckfree(imageSpec); } /* TtkSelectImage -- @@ -333,7 +333,7 @@ Ttk_CreateImageElement( return TCL_ERROR; } - imageData = (ImageData*)ckalloc(sizeof(*imageData)); + imageData = ckalloc(sizeof(*imageData)); imageData->imageSpec = imageSpec; imageData->minWidth = imageData->minHeight = -1; imageData->sticky = TTK_FILL_BOTH; diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index e3f6a02..6eaf6bb 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -526,7 +526,7 @@ struct Ttk_LayoutNode_ static Ttk_LayoutNode *Ttk_NewLayoutNode( unsigned flags, Ttk_ElementClass *elementClass) { - Ttk_LayoutNode *node = (Ttk_LayoutNode*)ckalloc(sizeof(*node)); + Ttk_LayoutNode *node = ckalloc(sizeof(*node)); node->flags = flags; node->eclass = elementClass; @@ -542,7 +542,7 @@ static void Ttk_FreeLayoutNode(Ttk_LayoutNode *node) while (node) { Ttk_LayoutNode *next = node->next; Ttk_FreeLayoutNode(node->child); - ckfree((ClientData)node); + ckfree(node); node = next; } } @@ -559,7 +559,7 @@ struct Ttk_TemplateNode_ { static Ttk_TemplateNode *Ttk_NewTemplateNode(const char *name, unsigned flags) { - Ttk_TemplateNode *op = (Ttk_TemplateNode*)ckalloc(sizeof(*op)); + Ttk_TemplateNode *op = ckalloc(sizeof(*op)); op->name = ckalloc(strlen(name) + 1); strcpy(op->name, name); op->flags = flags; op->next = op->child = 0; @@ -572,7 +572,7 @@ void Ttk_FreeLayoutTemplate(Ttk_LayoutTemplate op) Ttk_LayoutTemplate next = op->next; Ttk_FreeLayoutTemplate(op->child); ckfree(op->name); - ckfree((ClientData)op); + ckfree(op); op = next; } } @@ -841,7 +841,7 @@ static Ttk_Layout TTKNewLayout( void *recordPtr,Tk_OptionTable optionTable, Tk_Window tkwin, Ttk_LayoutNode *root) { - Ttk_Layout layout = (Ttk_Layout)ckalloc(sizeof(*layout)); + Ttk_Layout layout = ckalloc(sizeof(*layout)); layout->style = style; layout->recordPtr = recordPtr; layout->optionTable = optionTable; @@ -853,7 +853,7 @@ static Ttk_Layout TTKNewLayout( void Ttk_FreeLayout(Ttk_Layout layout) { Ttk_FreeLayoutNode(layout->root); - ckfree((ClientData)layout); + ckfree(layout); } /* diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c index 1238638..cd10711 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -189,7 +189,7 @@ static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr) static Ttk_Slave *NewSlave( Ttk_Manager *mgr, Tk_Window slaveWindow, void *slaveData) { - Ttk_Slave *slave = (Ttk_Slave*)ckalloc(sizeof(*slave)); + Ttk_Slave *slave = ckalloc(sizeof(*slave)); slave->slaveWindow = slaveWindow; slave->manager = mgr; @@ -201,7 +201,7 @@ static Ttk_Slave *NewSlave( static void DeleteSlave(Ttk_Slave *slave) { - ckfree((ClientData)slave); + ckfree(slave); } /*------------------------------------------------------------------------ @@ -211,7 +211,7 @@ static void DeleteSlave(Ttk_Slave *slave) Ttk_Manager *Ttk_CreateManager( Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window masterWindow) { - Ttk_Manager *mgr = (Ttk_Manager*)ckalloc(sizeof(*mgr)); + Ttk_Manager *mgr = ckalloc(sizeof(*mgr)); mgr->managerSpec = managerSpec; mgr->managerData = managerData; @@ -235,12 +235,12 @@ void Ttk_DeleteManager(Ttk_Manager *mgr) Ttk_ForgetSlave(mgr, mgr->nSlaves - 1); } if (mgr->slaves) { - ckfree((ClientData)mgr->slaves); + ckfree(mgr->slaves); } Tk_CancelIdleCall(ManagerIdleProc, mgr); - ckfree((ClientData)mgr); + ckfree(mgr); } /*------------------------------------------------------------------------ @@ -253,8 +253,7 @@ void Ttk_DeleteManager(Ttk_Manager *mgr) static void InsertSlave(Ttk_Manager *mgr, Ttk_Slave *slave, int index) { int endIndex = mgr->nSlaves++; - mgr->slaves = (Ttk_Slave**)ckrealloc( - (ClientData)mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *)); + mgr->slaves = ckrealloc(mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *)); while (endIndex > index) { mgr->slaves[endIndex] = mgr->slaves[endIndex - 1]; diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c index dc9317e..a25a2f3 100644 --- a/generic/ttk/ttkScroll.c +++ b/generic/ttk/ttkScroll.c @@ -56,7 +56,7 @@ struct ScrollHandleRec */ ScrollHandle TtkCreateScrollHandle(WidgetCore *corePtr, Scrollable *scrollPtr) { - ScrollHandle h = (ScrollHandle)ckalloc(sizeof(*h)); + ScrollHandle h = ckalloc(sizeof(*h)); h->flags = 0; h->corePtr = corePtr; @@ -248,6 +248,6 @@ void TtkFreeScrollHandle(ScrollHandle h) if (h->flags & SCROLL_UPDATE_PENDING) { Tcl_CancelIdleCall(UpdateScrollbarBG, (ClientData)h); } - ckfree((ClientData)h); + ckfree(h); } diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c index dbf6a5c..84e9ea2 100644 --- a/generic/ttk/ttkTagSet.c +++ b/generic/ttk/ttkTagSet.c @@ -35,7 +35,7 @@ struct TtkTagTable { */ static Ttk_Tag NewTag(Ttk_TagTable tagTable, const char *tagName) { - Ttk_Tag tag = (Ttk_Tag)ckalloc(sizeof(*tag)); + Ttk_Tag tag = ckalloc(sizeof(*tag)); tag->tagRecord = ckalloc(tagTable->recordSize); memset(tag->tagRecord, 0, tagTable->recordSize); /* Don't need Tk_InitOptions() here, all defaults should be NULL. */ @@ -48,7 +48,7 @@ static void DeleteTag(Ttk_TagTable tagTable, Ttk_Tag tag) { Tk_FreeConfigOptions(tag->tagRecord,tagTable->optionTable,tagTable->tkwin); ckfree(tag->tagRecord); - ckfree((void*)tag); + ckfree(tag); } /*------------------------------------------------------------------------ @@ -59,7 +59,7 @@ Ttk_TagTable Ttk_CreateTagTable( Tcl_Interp *interp, Tk_Window tkwin, Tk_OptionSpec optionSpecs[], int recordSize) { - Ttk_TagTable tagTable = (Ttk_TagTable)ckalloc(sizeof(*tagTable)); + Ttk_TagTable tagTable = ckalloc(sizeof(*tagTable)); tagTable->tkwin = tkwin; tagTable->optionSpecs = optionSpecs; tagTable->optionTable = Tk_CreateOptionTable(interp, optionSpecs); @@ -81,7 +81,7 @@ void Ttk_DeleteTagTable(Ttk_TagTable tagTable) } Tcl_DeleteHashTable(&tagTable->tags); - ckfree((void*)tagTable); + ckfree(tagTable); } Ttk_Tag Ttk_GetTag(Ttk_TagTable tagTable, const char *tagName) @@ -117,7 +117,7 @@ Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable tagTable, Tcl_Obj *objPtr) Ttk_TagSet Ttk_GetTagSetFromObj( Tcl_Interp *interp, Ttk_TagTable tagTable, Tcl_Obj *objPtr) { - Ttk_TagSet tagset = (Ttk_TagSet)(ckalloc(sizeof *tagset)); + Ttk_TagSet tagset = ckalloc(sizeof(*tagset)); Tcl_Obj **objv; int i, objc; @@ -128,11 +128,11 @@ Ttk_TagSet Ttk_GetTagSetFromObj( } if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) { - ckfree((ClientData)tagset); + ckfree(tagset); return NULL; } - tagset->tags = (Ttk_Tag*)ckalloc((objc+1) * sizeof(Ttk_Tag)); + tagset->tags = ckalloc((objc+1) * sizeof(Ttk_Tag)); for (i=0; i<objc; ++i) { tagset->tags[i] = Ttk_GetTagFromObj(tagTable, objv[i]); } @@ -159,8 +159,8 @@ Tcl_Obj *Ttk_NewTagSetObj(Ttk_TagSet tagset) void Ttk_FreeTagSet(Ttk_TagSet tagset) { - ckfree((ClientData)tagset->tags); - ckfree((ClientData)tagset); + ckfree(tagset->tags); + ckfree(tagset); } /* Ttk_TagSetContains -- test if tag set contains a tag. @@ -189,7 +189,7 @@ int Ttk_TagSetAdd(Ttk_TagSet tagset, Ttk_Tag tag) return 0; } } - tagset->tags = (void*)ckrealloc((void*)tagset->tags, + tagset->tags = ckrealloc(tagset->tags, (tagset->nTags+1)*sizeof(tagset->tags[0])); tagset->tags[tagset->nTags++] = tag; return 1; diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index e0d1971..2b98eaf 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -42,7 +42,7 @@ typedef struct Ttk_Style_ static Style *NewStyle() { - Style *stylePtr = (Style*)ckalloc(sizeof(Style)); + Style *stylePtr = ckalloc(sizeof(Style)); stylePtr->styleName = NULL; stylePtr->parentStyle = NULL; @@ -77,7 +77,7 @@ static void FreeStyle(Style *stylePtr) Ttk_FreeLayoutTemplate(stylePtr->layoutTemplate); - ckfree((ClientData)stylePtr); + ckfree(stylePtr); } /* @@ -181,7 +181,7 @@ static const Tk_OptionSpec *TTKGetOptionSpec( static OptionMap BuildOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) { - OptionMap optionMap = (OptionMap)ckalloc( + OptionMap optionMap = ckalloc( sizeof(const Tk_OptionSpec) * elementClass->nResources + 1); int i; @@ -223,8 +223,7 @@ GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) static Ttk_ElementClass * NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData) { - Ttk_ElementClass *elementClass = - (Ttk_ElementClass*)ckalloc(sizeof(Ttk_ElementClass)); + Ttk_ElementClass *elementClass = ckalloc(sizeof(Ttk_ElementClass)); int i; elementClass->name = name; @@ -240,7 +239,7 @@ NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData) /* Initialize default values: */ - elementClass->defaultValues = (Tcl_Obj**) + elementClass->defaultValues = ckalloc(elementClass->nResources * sizeof(Tcl_Obj *) + 1); for (i=0; i < elementClass->nResources; ++i) { const char *defaultValue = specPtr->options[i].defaultValue; @@ -277,7 +276,7 @@ static void FreeElementClass(Ttk_ElementClass *elementClass) Tcl_DecrRefCount(elementClass->defaultValues[i]); } } - ckfree((ClientData)elementClass->defaultValues); + ckfree(elementClass->defaultValues); /* * Free option map cache: @@ -290,7 +289,7 @@ static void FreeElementClass(Ttk_ElementClass *elementClass) Tcl_DeleteHashTable(&elementClass->optMapCache); ckfree(elementClass->elementRecord); - ckfree((ClientData)elementClass); + ckfree(elementClass); } /*------------------------------------------------------------------------ @@ -313,7 +312,7 @@ typedef struct Ttk_Theme_ static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent) { - Theme *themePtr = (Theme*)ckalloc(sizeof(Theme)); + Theme *themePtr = ckalloc(sizeof(Theme)); Tcl_HashEntry *entryPtr; int unused; @@ -367,7 +366,7 @@ static void FreeTheme(Theme *themePtr) /* * Free theme record: */ - ckfree((ClientData)themePtr); + ckfree(themePtr); return; } @@ -456,11 +455,11 @@ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp) while (cleanup) { Cleanup *next = cleanup->next; cleanup->cleanupProc(cleanup->clientData); - ckfree((ClientData)cleanup); + ckfree(cleanup); cleanup = next; } - ckfree((ClientData)pkgPtr); + ckfree(pkgPtr); } /* @@ -486,7 +485,7 @@ void Ttk_RegisterCleanup( Tcl_Interp *interp, ClientData clientData, Ttk_CleanupProc *cleanupProc) { StylePackageData *pkgPtr = GetStylePackageData(interp); - Cleanup *cleanup = (Cleanup*)ckalloc(sizeof(*cleanup)); + Cleanup *cleanup = ckalloc(sizeof(*cleanup)); cleanup->clientData = clientData; cleanup->cleanupProc = cleanupProc; @@ -802,7 +801,7 @@ int Ttk_RegisterElementFactory( Ttk_ElementFactory factory, void *clientData) { StylePackageData *pkgPtr = GetStylePackageData(interp); - FactoryRec *recPtr = (FactoryRec*)ckalloc(sizeof(*recPtr)); + FactoryRec *recPtr = ckalloc(sizeof(*recPtr)); Tcl_HashEntry *entryPtr; int newEntry; @@ -1697,8 +1696,7 @@ void Ttk_StylePkgInit(Tcl_Interp *interp) { Tcl_Namespace *nsPtr; - StylePackageData *pkgPtr = (StylePackageData *) - ckalloc(sizeof(StylePackageData)); + StylePackageData *pkgPtr = ckalloc(sizeof(StylePackageData)); pkgPtr->interp = interp; Tcl_InitHashTable(&pkgPtr->themeTable, TCL_STRING_KEYS); diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c index cb2f1c7..c8cceaf 100644 --- a/generic/ttk/ttkTrace.c +++ b/generic/ttk/ttkTrace.c @@ -76,7 +76,7 @@ Ttk_TraceHandle *Ttk_TraceVariable( Ttk_TraceProc callback, void *clientData) { - Ttk_TraceHandle *h = (Ttk_TraceHandle*)ckalloc(sizeof(*h)); + Ttk_TraceHandle *h = ckalloc(sizeof(*h)); int status; h->interp = interp; @@ -91,7 +91,7 @@ Ttk_TraceHandle *Ttk_TraceVariable( if (status != TCL_OK) { Tcl_DecrRefCount(h->varnameObj); - ckfree((ClientData)h); + ckfree(h); return NULL; } @@ -109,7 +109,7 @@ void Ttk_UntraceVariable(Ttk_TraceHandle *h) TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, VarTraceProc, (ClientData)h); Tcl_DecrRefCount(h->varnameObj); - ckfree((ClientData)h); + ckfree(h); } } diff --git a/generic/ttk/ttkTrack.c b/generic/ttk/ttkTrack.c index a392d94..74b34e0 100644 --- a/generic/ttk/ttkTrack.c +++ b/generic/ttk/ttkTrack.c @@ -173,7 +173,7 @@ ElementStateEventProc(ClientData clientData, XEvent *ev) void TtkTrackElementState(WidgetCore *corePtr) { - ElementStateTracker *es = (ElementStateTracker*)ckalloc(sizeof(*es)); + ElementStateTracker *es = ckalloc(sizeof(*es)); es->corePtr = corePtr; es->tracking = 0; es->activeElement = es->pressedElement = 0; diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index d7afb3c..b9fe913 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -86,7 +86,7 @@ static Tk_OptionSpec ItemOptionSpecs[] = { */ static TreeItem *NewItem(void) { - TreeItem *item = (TreeItem*)ckalloc(sizeof(*item)); + TreeItem *item = ckalloc(sizeof(*item)); item->entryPtr = 0; item->parent = item->children = item->next = item->prev = NULL; @@ -118,7 +118,7 @@ static void FreeItem(TreeItem *item) if (item->tagset) { Ttk_FreeTagSet(item->tagset); } if (item->imagespec) { TtkFreeImageSpec(item->imagespec); } - ckfree((ClientData)item); + ckfree(item); } static void FreeItemCB(void *clientData) { FreeItem(clientData); } @@ -613,11 +613,11 @@ static TreeItem **GetItemListFromObj( return NULL; } - items = (TreeItem**)ckalloc((nElements + 1)*sizeof(TreeItem*)); + items = ckalloc((nElements + 1)*sizeof(TreeItem*)); for (i = 0; i < nElements; ++i) { items[i] = FindItem(interp, tv, elements[i]); if (!items[i]) { - ckfree((ClientData)items); + ckfree(items); return NULL; } } @@ -659,7 +659,7 @@ static void TreeviewFreeColumns(Treeview *tv) if (tv->tree.columns) { for (i = 0; i < tv->tree.nColumns; ++i) FreeColumn(tv->tree.columns + i); - ckfree((ClientData)tv->tree.columns); + ckfree(tv->tree.columns); tv->tree.columns = 0; } } @@ -688,8 +688,7 @@ static int TreeviewInitColumns(Tcl_Interp *interp, Treeview *tv) * Initialize columns array and columnNames hash table: */ tv->tree.nColumns = ncols; - tv->tree.columns = - (TreeColumn*)ckalloc(tv->tree.nColumns * sizeof(TreeColumn)); + tv->tree.columns = ckalloc(tv->tree.nColumns * sizeof(TreeColumn)); for (i = 0; i < ncols; ++i) { int isNew; @@ -734,16 +733,16 @@ static int TreeviewInitDisplayColumns(Tcl_Interp *interp, Treeview *tv) if (!strcmp(Tcl_GetString(tv->tree.displayColumnsObj), "#all")) { ndcols = tv->tree.nColumns; - displayColumns = (TreeColumn**)ckalloc((ndcols+1)*sizeof(TreeColumn*)); + displayColumns = ckalloc((ndcols+1) * sizeof(TreeColumn*)); for (index = 0; index < ndcols; ++index) { displayColumns[index+1] = tv->tree.columns + index; } } else { - displayColumns = (TreeColumn**)ckalloc((ndcols+1)*sizeof(TreeColumn*)); + displayColumns = ckalloc((ndcols+1) * sizeof(TreeColumn*)); for (index = 0; index < ndcols; ++index) { displayColumns[index+1] = GetColumn(interp, tv, dcolumns[index]); if (!displayColumns[index+1]) { - ckfree((ClientData)displayColumns); + ckfree(displayColumns); return TCL_ERROR; } } @@ -751,7 +750,7 @@ static int TreeviewInitDisplayColumns(Tcl_Interp *interp, Treeview *tv) displayColumns[0] = &tv->tree.column0; if (tv->tree.displayColumns) - ckfree((ClientData)tv->tree.displayColumns); + ckfree(tv->tree.displayColumns); tv->tree.displayColumns = displayColumns; tv->tree.nDisplayColumns = ndcols + 1; @@ -1987,7 +1986,7 @@ static int TreeviewChildrenCommand( */ for (i=0; newChildren[i]; ++i) { if (!AncestryCheck(interp, tv, newChildren[i], item)) { - ckfree((ClientData)newChildren); + ckfree(newChildren); return TCL_ERROR; } } @@ -2023,7 +2022,7 @@ static int TreeviewChildrenCommand( child = newChildren[i]; } - ckfree((ClientData)newChildren); + ckfree(newChildren); TtkRedisplayWidget(&tv->core); } @@ -2649,7 +2648,7 @@ static int TreeviewDetachCommand( for (i = 0; items[i]; ++i) { if (items[i] == tv->tree.root) { Tcl_AppendResult(interp, "Cannot detach root item", NULL); - ckfree((ClientData)items); + ckfree(items); return TCL_ERROR; } } @@ -2659,7 +2658,7 @@ static int TreeviewDetachCommand( } TtkRedisplayWidget(&tv->core); - ckfree((ClientData)items); + ckfree(items); return TCL_OK; } @@ -2695,7 +2694,7 @@ static int TreeviewDeleteCommand( */ for (i=0; items[i]; ++i) { if (items[i] == tv->tree.root) { - ckfree((ClientData)items); + ckfree(items); Tcl_AppendResult(interp, "Cannot delete root item", NULL); return TCL_ERROR; } @@ -2720,7 +2719,7 @@ static int TreeviewDeleteCommand( delq = next; } - ckfree((ClientData)items); + ckfree(items); TtkRedisplayWidget(&tv->core); return TCL_OK; } @@ -2989,7 +2988,7 @@ static int TreeviewSelectionCommand( break; } - ckfree((ClientData)items); + ckfree(items); TtkSendVirtualEvent(tv->core.tkwin, "TreeviewSelect"); TtkRedisplayWidget(&tv->core); |