]> 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 08:10:53 +0000 (09:10 +0100)
commitccb82ea85d34f8f3802e5f5c93c8bc7c825757bd
tree2f762fb6fda5e6a82af9a1670a1e69e3c0420f8e
parente732a8d25a8cbb78eed50b33d2569e8e9ea6e038
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.
bin/named/config.c