summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibor Peltan <libor.peltan@nic.cz>2024-11-12 16:54:56 +0100
committerDaniel Salzman <daniel.salzman@nic.cz>2024-11-15 08:07:19 +0100
commitc7dcb13c6c92764fe05b9ba290e82e5e77c49dcd (patch)
treeffaa134ec3b57042e64fcd98a8939bf557fc3a28
parentnameserver: add sanity assert to get_next_closer() (diff)
downloadknot-c7dcb13c6c92764fe05b9ba290e82e5e77c49dcd.tar.xz
knot-c7dcb13c6c92764fe05b9ba290e82e5e77c49dcd.zip
contents: refactor zone_contents_find_dname()
-rw-r--r--src/knot/zone/contents.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/knot/zone/contents.c b/src/knot/zone/contents.c
index 262136b17..e0f4e581c 100644
--- a/src/knot/zone/contents.c
+++ b/src/knot/zone/contents.c
@@ -301,22 +301,17 @@ int zone_contents_find_dname(const zone_contents_t *zone,
if (found < 0) {
// error
return found;
- } else if (found == 1 && previous != NULL) {
+ } else if (found == 1) {
// exact match
-
- assert(node && prev);
-
- *match = node;
- *closest = node;
- *previous = prev;
-
- return ZONE_NAME_FOUND;
- } else if (found == 1 && previous == NULL) {
- // exact match, zone not adjusted yet
+ // if previous==NULL, zone not adjusted yet
assert(node);
*match = node;
*closest = node;
+ if (previous != NULL) {
+ assert(prev);
+ *previous = prev;
+ }
return ZONE_NAME_FOUND;
} else {