2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 15:45:25 +00:00

[master] Deconstify hook tables as replacing single entries is allowed

This commit is contained in:
Michał Kępień
2017-10-20 15:07:52 +02:00
parent 2e662cf514
commit 6853af8fc5
4 changed files with 8 additions and 8 deletions

View File

@@ -57,7 +57,7 @@
* Consider the following sample code: * Consider the following sample code:
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* const ns_hook_t *foo_hook_table = NULL; * ns_hook_t *foo_hook_table = NULL;
* *
* isc_result_t * isc_result_t
* foo_bar(void) { * foo_bar(void) {
@@ -81,7 +81,7 @@
* void * void
* test_foo_bar(void) { * test_foo_bar(void) {
* isc_boolean_t foo_bar_called = ISC_FALSE; * isc_boolean_t foo_bar_called = ISC_FALSE;
* const ns_hook_t my_hooks[FOO_HOOKS_COUNT] = { * ns_hook_t my_hooks[FOO_HOOKS_COUNT] = {
* [FOO_EXTRACT_VAL] = { * [FOO_EXTRACT_VAL] = {
* .callback = cause_failure, * .callback = cause_failure,
* .callback_data = &foo_bar_called, * .callback_data = &foo_bar_called,
@@ -136,7 +136,7 @@ typedef struct ns_hook {
#define NS_PROCESS_HOOK_VOID(table, id, data) \ #define NS_PROCESS_HOOK_VOID(table, id, data) \
_NS_PROCESS_HOOK(table, id, data) _NS_PROCESS_HOOK(table, id, data)
LIBNS_EXTERNAL_DATA extern const ns_hook_t *ns__hook_table; LIBNS_EXTERNAL_DATA extern ns_hook_t *ns__hook_table;
#endif /* NS_HOOKS_ENABLE */ #endif /* NS_HOOKS_ENABLE */
#endif /* NS_HOOKS_H */ #endif /* NS_HOOKS_H */

View File

@@ -247,7 +247,7 @@ log_noexistnodata(void *val, int level, const char *fmt, ...)
#ifdef NS_HOOKS_ENABLE #ifdef NS_HOOKS_ENABLE
LIBNS_EXTERNAL_DATA const ns_hook_t *ns__hook_table = NULL; LIBNS_EXTERNAL_DATA ns_hook_t *ns__hook_table = NULL;
#define PROCESS_HOOK(...) \ #define PROCESS_HOOK(...) \
NS_PROCESS_HOOK(ns__hook_table, __VA_ARGS__) NS_PROCESS_HOOK(ns__hook_table, __VA_ARGS__)

View File

@@ -679,8 +679,8 @@ extract_qctx(void *hook_data, void *callback_data, isc_result_t *resultp) {
*/ */
static isc_result_t static isc_result_t
create_qctx_for_client(ns_client_t *client, query_ctx_t **qctxp) { create_qctx_for_client(ns_client_t *client, query_ctx_t **qctxp) {
const ns_hook_t *saved_hook_table; ns_hook_t *saved_hook_table;
const ns_hook_t query_hooks[NS_QUERY_HOOKS_COUNT] = { ns_hook_t query_hooks[NS_QUERY_HOOKS_COUNT] = {
[NS_QUERY_SETUP_QCTX_INITIALIZED] = { [NS_QUERY_SETUP_QCTX_INITIALIZED] = {
.callback = extract_qctx, .callback = extract_qctx,
.callback_data = qctxp, .callback_data = qctxp,

View File

@@ -57,7 +57,7 @@ ns__query_sfcache_test(const ns__query_sfcache_test_params_t *test) {
/* /*
* Interrupt execution if query_done() is called. * Interrupt execution if query_done() is called.
*/ */
const ns_hook_t query_hooks[NS_QUERY_HOOKS_COUNT] = { ns_hook_t query_hooks[NS_QUERY_HOOKS_COUNT] = {
[NS_QUERY_DONE_BEGIN] = { [NS_QUERY_DONE_BEGIN] = {
.callback = ns_test_hook_catch_call, .callback = ns_test_hook_catch_call,
.callback_data = NULL, .callback_data = NULL,
@@ -264,7 +264,7 @@ ns__query_start_test(const ns__query_start_test_params_t *test) {
/* /*
* Interrupt execution if query_lookup() or query_done() is called. * Interrupt execution if query_lookup() or query_done() is called.
*/ */
const ns_hook_t query_hooks[NS_QUERY_HOOKS_COUNT] = { ns_hook_t query_hooks[NS_QUERY_HOOKS_COUNT] = {
[NS_QUERY_LOOKUP_BEGIN] = { [NS_QUERY_LOOKUP_BEGIN] = {
.callback = ns_test_hook_catch_call, .callback = ns_test_hook_catch_call,
.callback_data = NULL, .callback_data = NULL,