mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
Cleanup some minor things in dynlibmod
This commit is contained in:
parent
f177dc974c
commit
f79811435b
1 changed files with 3 additions and 12 deletions
|
|
@ -25,12 +25,12 @@ void log_dlerror() {
|
||||||
NULL
|
NULL
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
DWORD dwBytesWritten;
|
|
||||||
log_err("dynlibmod: %s (%ld)", MessageBuffer, dwLastError);
|
log_err("dynlibmod: %s (%ld)", MessageBuffer, dwLastError);
|
||||||
LocalFree(MessageBuffer);
|
LocalFree(MessageBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HMODULE open_library(const char* fname) {
|
HMODULE open_library(const char* fname) {
|
||||||
return LoadLibrary(fname);
|
return LoadLibrary(fname);
|
||||||
}
|
}
|
||||||
|
|
@ -42,6 +42,7 @@ HMODULE open_library(const char* fname) {
|
||||||
void log_dlerror() {
|
void log_dlerror() {
|
||||||
log_err("dynlibmod: %s", dlerror());
|
log_err("dynlibmod: %s", dlerror());
|
||||||
}
|
}
|
||||||
|
|
||||||
void* open_library(const char* fname) {
|
void* open_library(const char* fname) {
|
||||||
return dlopen(fname, RTLD_LAZY | RTLD_GLOBAL);
|
return dlopen(fname, RTLD_LAZY | RTLD_GLOBAL);
|
||||||
}
|
}
|
||||||
|
|
@ -60,10 +61,8 @@ typedef void (*func_clear_t)(struct module_qstate*, int);
|
||||||
typedef size_t (*func_get_mem_t)(struct module_env*, int);
|
typedef size_t (*func_get_mem_t)(struct module_env*, int);
|
||||||
|
|
||||||
struct dynlibmod_env {
|
struct dynlibmod_env {
|
||||||
|
|
||||||
/** Dynamic library filename. */
|
/** Dynamic library filename. */
|
||||||
const char* fname;
|
const char* fname;
|
||||||
|
|
||||||
/** Module init function */
|
/** Module init function */
|
||||||
func_init_t func_init;
|
func_init_t func_init;
|
||||||
/** Module deinit function */
|
/** Module deinit function */
|
||||||
|
|
@ -76,19 +75,11 @@ struct dynlibmod_env {
|
||||||
func_clear_t func_clear;
|
func_clear_t func_clear;
|
||||||
/** Module get_mem function */
|
/** Module get_mem function */
|
||||||
func_get_mem_t func_get_mem;
|
func_get_mem_t func_get_mem;
|
||||||
|
|
||||||
/** Module qstate. */
|
|
||||||
struct module_qstate* qstate;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* counter for dynamic library module instances
|
|
||||||
* incremeted by dynlibmod_init
|
|
||||||
*/
|
|
||||||
int dynlib_mod_count = 0;
|
|
||||||
|
|
||||||
/** dynlib module init */
|
/** dynlib module init */
|
||||||
int dynlibmod_init(struct module_env* env, int id) {
|
int dynlibmod_init(struct module_env* env, int id) {
|
||||||
|
static int dynlib_mod_count;
|
||||||
int dynlib_mod_idx = dynlib_mod_count++;
|
int dynlib_mod_idx = dynlib_mod_count++;
|
||||||
struct config_strlist* cfg_item = env->cfg->dynlib_file;
|
struct config_strlist* cfg_item = env->cfg->dynlib_file;
|
||||||
struct dynlibmod_env* de = (struct dynlibmod_env*)calloc(1, sizeof(struct dynlibmod_env));
|
struct dynlibmod_env* de = (struct dynlibmod_env*)calloc(1, sizeof(struct dynlibmod_env));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue