void sha_clearLocalData(ShmemArray *array, unsigned int elementNumber) { int i; if (elementNumber < array->elementCount) { if (array->elements[elementNumber].localData) { if (array->elements[elementNumber].localDataCleanupCallbacks != NULL) { for (i=wolist_count(array->elements[elementNumber].localDataCleanupCallbacks)-1; i>=0; i--) { sha_clearLocalDataCallback clear_func = (sha_clearLocalDataCallback) wolist_elementAt(array->elements[elementNumber].localDataCleanupCallbacks, i); if (clear_func) clear_func(array, elementNumber); wolist_removeAt(array->elements[elementNumber].localDataCleanupCallbacks, i); } wolist_dealloc(array->elements[elementNumber].localDataCleanupCallbacks); array->elements[elementNumber].localDataCleanupCallbacks = NULL; } sd_perform(array->elements[elementNumber].localData, sha_warnAboutLeftoverLocalData, 0); sd_free(array->elements[elementNumber].localData); array->elements[elementNumber].localData = NULL; } } }
/* * This function cleans up all the lists and dictionaries created while parsing the config. */ static void freeWOXMLEdits(WOXMLEdits *config) { int i; for (i=0; i<wolist_count(config->new_apps); i++) st_free(wolist_elementAt(config->new_apps, i)); wolist_dealloc(config->new_apps); for (i=0; i<wolist_count(config->new_app_instances); i++) { int j; list *instances = wolist_elementAt(config->new_app_instances, i); for (j=0; j<wolist_count(instances); j++) st_free(wolist_elementAt(instances, j)); wolist_dealloc(instances); } wolist_dealloc(config->new_app_instances); }