ap_directive_t *parent;
};
-#define AP_MODULE_FLAGS_MMN_MAJOR 20161018
-#define AP_MODULE_FLAGS_MMN_MINOR 7
-#define AP_MODULE_HAS_FLAGS(m) \
- AP_MODULE_MAGIC_AT_LEAST(AP_MODULE_FLAGS_MMN_MAJOR, \
- AP_MODULE_FLAGS_MMN_MINOR)
-#if AP_MODULE_HAS_FLAGS
/**
* Flags associated with a module.
*/
#define AP_MODULE_FLAG_NONE (0)
#define AP_MODULE_FLAG_ALWAYS_MERGE (1 << 0)
-#endif
/**
* Module structures. Just about everything is dispatched through
*/
void (*register_hooks) (apr_pool_t *p);
-#if AP_MODULE_HAS_FLAGS
/** A bitmask of AP_MODULE_FLAG_* */
int flags;
-#endif
};
/**
AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
void *val);
+/**
+ * When module flags have been introduced, and a way to check this.
+ */
+#define AP_MODULE_FLAGS_MMN_MAJOR 20161018
+#define AP_MODULE_FLAGS_MMN_MINOR 7
+#define AP_MODULE_HAS_FLAGS(m) \
+ AP_MODULE_MAGIC_AT_LEAST(AP_MODULE_FLAGS_MMN_MAJOR, \
+ AP_MODULE_FLAGS_MMN_MINOR)
+/**
+ * Generic accessor for the module's flags
+ * @param m The module to get the flags from.
+ * @return The module-specific flags
+ */
+AP_DECLARE(int) ap_get_module_flags(const module *m);
+
#if !defined(AP_DEBUG)
#define ap_get_module_config(v,m) \
int i = modp->module_index;
if (!virt_vector[i]) {
-#if AP_MODULE_HAS_FLAGS
- if (df
- && modp->create_server_config
- && (modp->version > AP_MODULE_FLAGS_MMN_MAJOR
- || (modp->version == AP_MODULE_FLAGS_MMN_MAJOR
- && (modp->minor_version >=
- AP_MODULE_FLAGS_MMN_MINOR)))
- /* keep this after version checks (flags out-of-bound) */
- && (modp->flags & AP_MODULE_FLAG_ALWAYS_MERGE)) {
+ if (df && modp->create_server_config
+ && (ap_get_module_flags(modp) &
+ AP_MODULE_FLAG_ALWAYS_MERGE)) {
virt_vector[i] = (*modp->create_server_config)(p, virt);
}
- else
-#endif
- {
+ else {
virt_vector[i] = base_vector[i];
df = NULL;
}
return ((void **)cv)[m->module_index];
}
+AP_DECLARE(int) ap_get_module_flags(const module *m)
+{
+ if (m->version < AP_MODULE_FLAGS_MMN_MAJOR
+ || (m->version == AP_MODULE_FLAGS_MMN_MAJOR
+ && (m->minor_version < AP_MODULE_FLAGS_MMN_MINOR))) {
+ return 0;
+ }
+
+ return m->flags;
+}
+
#if defined(ap_get_core_module_config)
#undef ap_get_core_module_config
AP_DECLARE(void *) ap_get_core_module_config(const ap_conf_vector_t *cv);