You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2017/09/22 13:13:44 UTC
svn commit: r1809311 - in /httpd/httpd/trunk: include/http_config.h
server/config.c server/util_debug.c
Author: ylavic
Date: Fri Sep 22 13:13:44 2017
New Revision: 1809311
URL: http://svn.apache.org/viewvc?rev=1809311&view=rev
Log:
config: follow up to r1809302.
Provide a convenient function to get module flags, and remove useless
AP_MODULE_HAS_FLAGS checks in the core, core's version is at current MMN.
Modified:
httpd/httpd/trunk/include/http_config.h
httpd/httpd/trunk/server/config.c
httpd/httpd/trunk/server/util_debug.c
Modified: httpd/httpd/trunk/include/http_config.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_config.h?rev=1809311&r1=1809310&r2=1809311&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_config.h (original)
+++ httpd/httpd/trunk/include/http_config.h Fri Sep 22 13:13:44 2017
@@ -333,18 +333,11 @@ struct cmd_parms_struct {
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
@@ -426,10 +419,8 @@ struct module_struct {
*/
void (*register_hooks) (apr_pool_t *p);
-#if AP_MODULE_HAS_FLAGS
/** A bitmask of AP_MODULE_FLAG_* */
int flags;
-#endif
};
/**
@@ -542,6 +533,21 @@ AP_DECLARE(void *) ap_get_module_config(
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) \
Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=1809311&r1=1809310&r2=1809311&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Fri Sep 22 13:13:44 2017
@@ -338,20 +338,12 @@ static void merge_server_configs(apr_poo
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;
}
Modified: httpd/httpd/trunk/server/util_debug.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_debug.c?rev=1809311&r1=1809310&r2=1809311&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_debug.c (original)
+++ httpd/httpd/trunk/server/util_debug.c Fri Sep 22 13:13:44 2017
@@ -107,6 +107,17 @@ AP_DECLARE(void *) ap_get_module_config(
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);