2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 22:45:39 +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:
*
* ----------------------------------------------------------------------------
* const ns_hook_t *foo_hook_table = NULL;
* ns_hook_t *foo_hook_table = NULL;
*
* isc_result_t
* foo_bar(void) {
@@ -81,7 +81,7 @@
* void
* test_foo_bar(void) {
* 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] = {
* .callback = cause_failure,
* .callback_data = &foo_bar_called,
@@ -136,7 +136,7 @@ typedef struct ns_hook {
#define NS_PROCESS_HOOK_VOID(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_H */

View File

@@ -247,7 +247,7 @@ log_noexistnodata(void *val, int level, const char *fmt, ...)
#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(...) \
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
create_qctx_for_client(ns_client_t *client, query_ctx_t **qctxp) {
const ns_hook_t *saved_hook_table;
const ns_hook_t query_hooks[NS_QUERY_HOOKS_COUNT] = {
ns_hook_t *saved_hook_table;
ns_hook_t query_hooks[NS_QUERY_HOOKS_COUNT] = {
[NS_QUERY_SETUP_QCTX_INITIALIZED] = {
.callback = extract_qctx,
.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.
*/
const ns_hook_t query_hooks[NS_QUERY_HOOKS_COUNT] = {
ns_hook_t query_hooks[NS_QUERY_HOOKS_COUNT] = {
[NS_QUERY_DONE_BEGIN] = {
.callback = ns_test_hook_catch_call,
.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.
*/
const ns_hook_t query_hooks[NS_QUERY_HOOKS_COUNT] = {
ns_hook_t query_hooks[NS_QUERY_HOOKS_COUNT] = {
[NS_QUERY_LOOKUP_BEGIN] = {
.callback = ns_test_hook_catch_call,
.callback_data = NULL,