xpath MAINTENANCE simplify node replace in moveto_node_hash
diff --git a/src/xpath.c b/src/xpath.c
index a096674..0b73a6b 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -5502,7 +5502,6 @@
 {
     LY_ERR ret = LY_SUCCESS;
     uint32_t i;
-    int replaced;
     const struct lyd_node *siblings;
     struct lyd_node *sub, *inst = NULL;
 
@@ -5532,7 +5531,6 @@
     }
 
     for (i = 0; i < set->used; ) {
-        replaced = 0;
         siblings = NULL;
 
         if ((set->val.nodes[i].type == LYXP_NODE_ROOT_CONFIG) || (set->val.nodes[i].type == LYXP_NODE_ROOT)) {
@@ -5560,16 +5558,9 @@
 
         if (sub) {
             /* pos filled later */
-            if (!replaced) {
-                set_replace_node(set, sub, 0, LYXP_NODE_ELEM, i);
-                replaced = 1;
-            } else {
-                set_insert_node(set, sub, 0, LYXP_NODE_ELEM, i);
-            }
+            set_replace_node(set, sub, 0, LYXP_NODE_ELEM, i);
             ++i;
-        }
-
-        if (!replaced) {
+        } else {
             /* no match */
             set_remove_node(set, i);
         }