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).
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.
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);
/**
* 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