SGbool SG_CALL _sgViewportDeinit(void) { //sgViewportDestroy(_sg_viewMain); SGListNode* node; SGListNode* next; for(node = _sg_viewList->head; node != NULL; node = next) { next = node->next; sgViewportDestroy(node->item); } sgListDestroy(_sg_viewList); return SG_TRUE; }
void SG_EXPORT _sgJSONFreeValue(SGJSONValue* value) { if(!value) return; SGJSONSetItem* titem; switch(value->type) { case SG_JSON_TYPE_NULL: case SG_JSON_TYPE_BOOLEAN: case SG_JSON_TYPE_NUMBER: break; // nothing to do! case SG_JSON_TYPE_STRING: case SG_JSON_TYPE_COMMENT: free(value->v.string); break; case SG_JSON_TYPE_ARRAY: while(value->v.array->head) _sgJSONFreeValue(sgListPopFirst(value->v.array)); sgListDestroy(value->v.array); break; case SG_JSON_TYPE_OBJECT: while(value->v.object->root) { titem = sgSetPopRoot(value->v.object); free(titem->key); _sgJSONFreeValue(titem->val); free(titem); } sgSetDestroy(value->v.object); break; } free(value->strbuf); free(value); }