static WMPropList *retainPropListByCount(WMPropList * plist, int count) { WMPropList *key, *value; WMHashEnumerator e; int i; plist->retainCount += count; switch (plist->type) { case WPLString: case WPLData: break; case WPLArray: for (i = 0; i < WMGetArrayItemCount(plist->d.array); i++) { retainPropListByCount(WMGetFromArray(plist->d.array, i), count); } break; case WPLDictionary: e = WMEnumerateHashTable(plist->d.dict); while (WMNextHashEnumeratorItemAndKey(&e, (void **)&value, (void **)&key)) { retainPropListByCount(key, count); retainPropListByCount(value, count); } break; default: wwarning(_("Used proplist functions on non-WMPropLists objects")); wassertrv(False, NULL); break; } return plist; }
static void releasePropListByCount(WMPropList * plist, int count) { WMPropList *key, *value; WMHashEnumerator e; int i; plist->retainCount -= count; switch (plist->type) { case WPLString: if (plist->retainCount < 1) { wfree(plist->d.string); wfree(plist); } break; case WPLData: if (plist->retainCount < 1) { WMReleaseData(plist->d.data); wfree(plist); } break; case WPLArray: for (i = 0; i < WMGetArrayItemCount(plist->d.array); i++) { releasePropListByCount(WMGetFromArray(plist->d.array, i), count); } if (plist->retainCount < 1) { WMFreeArray(plist->d.array); wfree(plist); } break; case WPLDictionary: e = WMEnumerateHashTable(plist->d.dict); while (WMNextHashEnumeratorItemAndKey(&e, (void **)&value, (void **)&key)) { releasePropListByCount(key, count); releasePropListByCount(value, count); } if (plist->retainCount < 1) { WMFreeHashTable(plist->d.dict); wfree(plist); } break; default: wwarning(_("Used proplist functions on non-WMPropLists objects")); wassertr(False); break; } }
static void destroyBalloon(Balloon * bPtr) { WMHashEnumerator e; char *str; e = WMEnumerateHashTable(bPtr->table); while ((str = WMNextHashEnumeratorItem(&e))) { wfree(str); } WMFreeHashTable(bPtr->table); if (bPtr->textColor) WMReleaseColor(bPtr->textColor); if (bPtr->font) WMReleaseFont(bPtr->font); wfree(bPtr); }