]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
kr_module_load(): don't pass the_engine in module->data docs-develop-kr-m-flu34d/deployments/5925
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 20 Dec 2024 12:27:41 +0000 (13:27 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 20 Dec 2024 12:27:41 +0000 (13:27 +0100)
It was a confusing way of repurposing the field.

My comment from over five years ago (129002fc0d) said that
some external C modules might be relying on this.
But that certainly sounds moot nowadays.  To get more confidence,
I rechecked all kr_module::data references (as found by libclang).

daemon/engine.c
lib/module.c
lib/module.h

index 509915df36f2626fc9b8cd1b5af3b87a91d49492..a0da529be40c78972e0dadf4ba2dabc4c969eeaf 100644 (file)
@@ -741,8 +741,6 @@ int engine_register(const char *name, const char *precedence, const char* ref)
        if (!module) {
                return kr_error(ENOMEM);
        }
-       module->data = the_engine; /*< some outside modules may still use this value */
-
        int ret = kr_module_load(module, name, LIBDIR "/kres_modules");
        if (ret == 0) {
                /* We have a C module, loaded and init() was called.
index 2427c7b6c32c6f6cc355694dd57e4b5532a79cb6..df9a1f5e76761f26218ef41a64bbb7b44b88ba93 100644 (file)
@@ -103,10 +103,8 @@ int kr_module_load(struct kr_module *module, const char *name, const char *path)
                return kr_error(EINVAL);
        }
 
-       /* Initialize, keep userdata */
-       void *data = module->data;
+       /* Initialize */
        memset(module, 0, sizeof(struct kr_module));
-       module->data = data;
        module->name = strdup(name);
        if (module->name == NULL) {
                return kr_error(ENOMEM);
index 507b2df1c897c3a2044af97285a266f7f601934c..4dd5a4907e4d7cfc51afa3eced85fec982d6149b 100644 (file)
@@ -86,7 +86,7 @@ struct kr_prop {
 /**
  * Load a C module instance into memory.  And call its init().
  *
- * @param module module structure.  Will be overwritten except for ->data on success.
+ * @param module module structure.  Will be overwritten.
  * @param name module name
  * @param path module search path
  * @return 0 or an error