| 642 | } |
| 643 | |
| 644 | AP_CORE_DECLARE(const char *) ap_add_if_conf(apr_pool_t *p, |
| 645 | core_dir_config *conf, |
| 646 | void *if_config) |
| 647 | { |
| 648 | void **new_space; |
| 649 | core_dir_config *new = ap_get_module_config(if_config, &core_module); |
| 650 | |
| 651 | if (!conf->sec_if) { |
| 652 | conf->sec_if = apr_array_make(p, 2, sizeof(ap_conf_vector_t *)); |
| 653 | } |
| 654 | if (new->condition_ifelse & AP_CONDITION_ELSE) { |
| 655 | int have_if = 0; |
| 656 | if (conf->sec_if->nelts > 0) { |
| 657 | core_dir_config *last; |
| 658 | ap_conf_vector_t *lastelt = APR_ARRAY_IDX(conf->sec_if, |
| 659 | conf->sec_if->nelts - 1, |
| 660 | ap_conf_vector_t *); |
| 661 | last = ap_get_module_config(lastelt, &core_module); |
| 662 | if (last->condition_ifelse & AP_CONDITION_IF) |
| 663 | have_if = 1; |
| 664 | } |
| 665 | if (!have_if) |
| 666 | return "<Else> or <ElseIf> section without previous <If> or " |
| 667 | "<ElseIf> section in same scope"; |
| 668 | } |
| 669 | |
| 670 | new_space = (void **)apr_array_push(conf->sec_if); |
| 671 | *new_space = if_config; |
| 672 | return NULL; |
| 673 | } |
| 674 | |
| 675 | |
| 676 | /* We need to do a stable sort, qsort isn't stable. So to make it stable |
no test coverage detected