| 660 | */ |
| 661 | |
| 662 | AP_DECLARE(void) ap_remove_module(module *m) |
| 663 | { |
| 664 | module *modp; |
| 665 | |
| 666 | modp = ap_top_module; |
| 667 | if (modp == m) { |
| 668 | /* We are the top module, special case */ |
| 669 | ap_top_module = modp->next; |
| 670 | m->next = NULL; |
| 671 | } |
| 672 | else { |
| 673 | /* Not the top module, find use. When found modp will |
| 674 | * point to the module _before_ us in the list |
| 675 | */ |
| 676 | |
| 677 | while (modp && modp->next != m) { |
| 678 | modp = modp->next; |
| 679 | } |
| 680 | |
| 681 | if (!modp) { |
| 682 | /* Uh-oh, this module doesn't exist */ |
| 683 | ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, APLOGNO(00525) |
| 684 | "Cannot remove module %s: not found in module list", |
| 685 | m->name); |
| 686 | return; |
| 687 | } |
| 688 | |
| 689 | /* Eliminate us from the module list */ |
| 690 | modp->next = modp->next->next; |
| 691 | } |
| 692 | |
| 693 | free(ap_module_short_names[m->module_index]); |
| 694 | ap_module_short_names[m->module_index] = NULL; |
| 695 | merger_func_cache[m->module_index] = NULL; |
| 696 | |
| 697 | m->module_index = -1; /* simulate being unloaded, should |
| 698 | * be unnecessary */ |
| 699 | dynamic_modules--; |
| 700 | total_modules--; |
| 701 | } |
| 702 | |
| 703 | AP_DECLARE(const char *) ap_add_loaded_module(module *mod, apr_pool_t *p, |
| 704 | const char *short_name) |
no test coverage detected