/* * Destroy a type. */ static void DestroyType(ILDocType *type) { if(type->name) { ILFree(type->name); } if(type->fullName) { ILFree(type->fullName); } if(type->assembly) { ILFree(type->assembly); } if(type->ilasmSignature) { ILFree(type->ilasmSignature); } if(type->csSignature) { ILFree(type->csSignature); } if(type->baseType) { ILFree(type->baseType); } if(type->excludedBaseType) { ILFree(type->excludedBaseType); } DESTROY_LIST(ILDocInterface, type->interfaces, DestroyInterface); DESTROY_LIST(ILDocAttribute, type->attributes, DestroyAttribute); DESTROY_LIST(ILDocText, type->doc, DestroyDoc); DESTROY_LIST(ILDocMember, type->members, DestroyMember); }
static void dispose_host_config(h2o_host_configuration_t *host_config) { free(host_config->hostname.base); DESTROY_LIST(h2o_handler_t, host_config->handlers); DESTROY_LIST(h2o_filter_t, host_config->filters); DESTROY_LIST(h2o_logger_t, host_config->loggers); h2o_dispose_mimemap(&host_config->mimemap); }
void h2o_config_dispose(h2o_global_configuration_t *config) { while (! h2o_linklist_is_empty(&config->virtual_hosts)) { h2o_host_configuration_t *host_config = H2O_STRUCT_FROM_MEMBER(h2o_host_configuration_t, _link, config->virtual_hosts.next); h2o_linklist_unlink(&host_config->_link); dispose_host_config(host_config); free(host_config); } dispose_host_config(&config->default_host); DESTROY_LIST(h2o_configurator_t, config->global_configurators); DESTROY_LIST(h2o_configurator_t, config->host_configurators); }
/* * Destroy a documentation object. */ static void DestroyDoc(ILDocText *doc) { if(doc->children) { DESTROY_LIST(ILDocText, doc->children, DestroyDoc); } }
void ILDocTreeDestroy(ILDocTree *tree) { if(tree) { DESTROY_LIST(ILDocLibrary, tree->libraries, DestroyLibrary); ILFree(tree); } }
/* * Destroy a library. */ static void DestroyLibrary(ILDocLibrary *library) { if(library->name) { ILFree(library->name); } DESTROY_LIST(ILDocType, library->types, DestroyType); }
void h2o_config_dispose_pathconf(h2o_pathconf_t *pathconf) { #define DESTROY_LIST(type, list) \ do { \ size_t i; \ for (i = 0; i != list.size; ++i) { \ type *e = list.entries[i]; \ if (e->dispose != NULL) \ e->dispose(e); \ free(e); \ } \ free(list.entries); \ } while (0) DESTROY_LIST(h2o_handler_t, pathconf->handlers); DESTROY_LIST(h2o_filter_t, pathconf->filters); DESTROY_LIST(h2o_logger_t, pathconf->loggers); #undef DESTROY_LIST if (pathconf->mimemap != NULL) h2o_mem_release_shared(pathconf->mimemap); }
/* * Destroy a member. */ static void DestroyMember(ILDocMember *member) { if(member->name) { ILFree(member->name); } if(member->ilasmSignature) { ILFree(member->ilasmSignature); } if(member->csSignature) { ILFree(member->csSignature); } if(member->returnType) { ILFree(member->returnType); } DESTROY_LIST(ILDocParameter, member->parameters, DestroyParameter); DESTROY_LIST(ILDocAttribute, member->attributes, DestroyAttribute); DESTROY_LIST(ILDocText, member->doc, DestroyDoc); }