diff options
author | Vladimír Čunát <vladimir.cunat@nic.cz> | 2019-03-14 13:09:48 +0100 |
---|---|---|
committer | Tomas Krizek <tomas.krizek@nic.cz> | 2019-04-17 18:44:29 +0200 |
commit | 176b1c282a54b2547b5795238120e842fcaeb6bd (patch) | |
tree | 984a4d1a1b9f347ee6daf344d8dd2a1d13ee0d74 /modules/dnstap | |
parent | Merge branch 'dnstap-turris' into 'master' (diff) | |
download | knot-resolver-176b1c282a54b2547b5795238120e842fcaeb6bd.tar.xz knot-resolver-176b1c282a54b2547b5795238120e842fcaeb6bd.zip |
module API+ABI: remove one level of indirection
... for layers and props. This breaks C module API+ABI.
It seemed weird to repeatedly call a function that returns a pointer
to a structure in which we find the function we want to actually call.
We've never used changing these functions AFAIK, and the target
functions could easily be written to change their behavior instead
(i.e. move the indirection *inside* the function).
When breaking this, I also removed these two (_layers and _props)
from the dynamic symbols (to be) exported from the C modules.
They always pointed to memory belonging inside the module,
and they seem quite sensible to be set up by the _init symbol instead.
Diffstat (limited to 'modules/dnstap')
-rw-r--r-- | modules/dnstap/dnstap.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/modules/dnstap/dnstap.c b/modules/dnstap/dnstap.c index 09184260..57c22c18 100644 --- a/modules/dnstap/dnstap.c +++ b/modules/dnstap/dnstap.c @@ -211,6 +211,13 @@ static int dnstap_log(kr_layer_t *ctx) { KR_EXPORT int dnstap_init(struct kr_module *module) { + static kr_layer_api_t layer = { + .finish = &dnstap_log, + }; + /* Store module reference */ + layer.data = module; + module->layer = &layer; + /* allocated memory for internal data */ struct dnstap_data *data = malloc(sizeof(*data)); if (!data) { @@ -368,15 +375,5 @@ int dnstap_config(struct kr_module *module, const char *conf) { return kr_ok(); } -KR_EXPORT -const kr_layer_api_t *dnstap_layer(struct kr_module *module) { - static kr_layer_api_t _layer = { - .finish = &dnstap_log, - }; - /* Store module reference */ - _layer.data = module; - return &_layer; -} - KR_MODULE_EXPORT(dnstap) |