| 881 | } |
| 882 | |
| 883 | static const char *undef_macro(cmd_parms * cmd, void *dummy, const char *arg) |
| 884 | { |
| 885 | char *name; |
| 886 | ap_macro_t *macro; |
| 887 | |
| 888 | /* must be initialized, or no macros has been defined */ |
| 889 | if (ap_macros == NULL) { |
| 890 | return "no macro defined before " UNDEF_MACRO; |
| 891 | } |
| 892 | |
| 893 | if (empty_string_p(arg)) { |
| 894 | return "no macro name specified with " UNDEF_MACRO; |
| 895 | } |
| 896 | |
| 897 | /* check that the macro is defined */ |
| 898 | name = apr_pstrdup(cmd->temp_pool, arg); |
| 899 | ap_str_tolower(name); |
| 900 | macro = apr_hash_get(ap_macros, name, APR_HASH_KEY_STRING); |
| 901 | if (macro == NULL) { |
| 902 | /* could be a warning? */ |
| 903 | return apr_psprintf(cmd->temp_pool, |
| 904 | "cannot remove undefined macro '%s'", name); |
| 905 | } |
| 906 | |
| 907 | /* free macro: cannot do that */ |
| 908 | /* remove macro from hash table */ |
| 909 | apr_hash_set(ap_macros, name, APR_HASH_KEY_STRING, NULL); |
| 910 | |
| 911 | return NULL; |
| 912 | } |
| 913 | |
| 914 | /************************************************************* EXPORT MODULE */ |
| 915 |
nothing calls this directly
no test coverage detected