]> git.ipfire.org Git - thirdparty/bind9.git/commit
refactoring of `named_config_getipandkeylist`
authorColin Vidal <colin@isc.org>
Tue, 25 Nov 2025 12:56:37 +0000 (13:56 +0100)
committerColin Vidal <colin@isc.org>
Fri, 28 Nov 2025 14:15:46 +0000 (15:15 +0100)
commitf2b46d8a6aa16926e94425c2f8bfddf098c42331
tree342efae0d4df9a73cd2fe3449e0d8fb27dd799ba
parent5d64b3a440209ed30ac87e3f8b6a693d5de1e0c3
refactoring of `named_config_getipandkeylist`

Function `named_config_getipandkeylist()` processes the nested lists by
overriding the current local variable of the function, jumping back to
the beginning of the list processing. Of course, in order to go back to
the previous state and process the remaining items of the current list,
a "stack" array is used in order to put and get back the next list
element and associated values.

This makes the logic quite complex and error prone. Instead, this commit
changes the logic by recursing into the nested list (while sharing a
state between all the invocations). The processing is fundamentally
identical, but instead of "manually" handling the stack to go back to
the previous state (and process remaining elements of the current list),
takes advantage of recursion.

(cherry picked from commit ccb82ea85d34f8f3802e5f5c93c8bc7c825757bd)
bin/named/config.c