| 622 | |
| 623 | |
| 624 | static void destroy_module(struct sr_module *m, int skip_others) |
| 625 | { |
| 626 | struct sr_module_dep *dep; |
| 627 | |
| 628 | if (!m) |
| 629 | return; |
| 630 | |
| 631 | /* destroy the modules in script load order using backwards iteration */ |
| 632 | if (!skip_others) |
| 633 | destroy_module(m->next, 0); |
| 634 | |
| 635 | if (m->destroy_done || !m->exports) |
| 636 | return; |
| 637 | |
| 638 | /* make sure certain modules get destroyed before this one */ |
| 639 | for (dep = m->sr_deps_destroy; dep; dep = dep->next) |
| 640 | if (!dep->mod->destroy_done) |
| 641 | destroy_module(dep->mod, 1); |
| 642 | |
| 643 | if (m->init_done && m->exports->destroy_f) |
| 644 | m->exports->destroy_f(); |
| 645 | |
| 646 | m->destroy_done = 1; |
| 647 | } |
| 648 | |
| 649 | |
| 650 | void destroy_modules(void) |