Skip to content

Commit

Permalink
Refactor rbnode_update (more concise)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zdenek Grof committed Sep 9, 2023
1 parent e8d184b commit 77a0c99
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/rbnode_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,7 @@ subroutine rbnode_update(node, newdata, cfun, tree, was_updated)
if (mode==REINSERTED) then
if (present(tree)) then
found => rbnode_find(tree%root, newdata, cfun)
if (associated(found)) then
mode = DUPLICATE
else
call rbnode_delete(tree, node, deleted_output=updated)
end if
if (associated(found)) mode = DUPLICATE
else
error stop 'update: node must be moved, but root of tree not provided'
end if
Expand All @@ -226,7 +222,7 @@ subroutine rbnode_update(node, newdata, cfun, tree, was_updated)
case(ISOLATED, NOTMOVED)
updated => node
case(REINSERTED)
continue ! updated is already set via "rbnode_delete"
call rbnode_delete(tree, node, deleted_output=updated)
case(DUPLICATE)
! node can not be updated
if (present(was_updated)) then
Expand Down

0 comments on commit 77a0c99

Please sign in to comment.