]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] Deconstify hook tables as replacing single entries is allowed
authorMichał Kępień <michal@isc.org>
Fri, 20 Oct 2017 13:07:52 +0000 (15:07 +0200)
committerMichał Kępień <michal@isc.org>
Mon, 23 Oct 2017 12:17:07 +0000 (14:17 +0200)
lib/ns/hooks.h
lib/ns/query.c
lib/ns/tests/nstest.c
lib/ns/tests/query_test.c

index c16cebbf7f95c28b3ac38187c4bf2bcc3dfb3ced..36d148bdfd89bcec13f4eaf0e3f05ed65e39b764 100644 (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 */
index 8c9fa5c0c80eb480d68189b477aca970b2f122c2..fdd2d7aad2d95f2097388e190d44850ec65883b2 100644 (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__)
index a47ee8aea0b656bc4495edefe5b96943b96f83c7..642908e83b16b65561f5f6b4eeba4b5033602095 100644 (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,
index 7906989e54f22beda236f031408d7b6afe3af0fe..ab8def304074808d1927c90e3e9e9b9826401cf1 100644 (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,