]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/openbsd-tree.c
Merge pull request #4847 from vivek-cumulus/evpn-route-import-fix
[mirror_frr.git] / lib / openbsd-tree.c
index 35bfce3a890d73e9cd9acd080bef56c7a2f39ee4..ddcc59fa8f5920d0e832a400c24128c90c46639a 100644 (file)
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <stdlib.h>
 
 #include <lib/openbsd-tree.h>
@@ -341,7 +345,7 @@ rbe_remove(const struct rb_type *t, struct rbt_tree *rbt, struct rb_entry *rbe)
                        else
                                RBE_RIGHT(tmp) = rbe;
 
-                       rbe_if_augment(t, parent);
+                       rbe_if_augment(t, tmp);
                } else
                        RBH_ROOT(rbt) = rbe;
 
@@ -431,7 +435,8 @@ void *_rb_insert(const struct rb_type *t, struct rbt_tree *rbt, void *elm)
 }
 
 /* Finds the node with the same key as elm */
-void *_rb_find(const struct rb_type *t, struct rbt_tree *rbt, const void *key)
+void *_rb_find(const struct rb_type *t, const struct rbt_tree *rbt,
+              const void *key)
 {
        struct rb_entry *tmp = RBH_ROOT(rbt);
        void *node;
@@ -452,7 +457,8 @@ void *_rb_find(const struct rb_type *t, struct rbt_tree *rbt, const void *key)
 }
 
 /* Finds the first node greater than or equal to the search key */
-void *_rb_nfind(const struct rb_type *t, struct rbt_tree *rbt, const void *key)
+void *_rb_nfind(const struct rb_type *t, const struct rbt_tree *rbt,
+               const void *key)
 {
        struct rb_entry *tmp = RBH_ROOT(rbt);
        void *node;
@@ -518,14 +524,14 @@ void *_rb_prev(const struct rb_type *t, void *elm)
        return (rbe == NULL ? NULL : rb_e2n(t, rbe));
 }
 
-void *_rb_root(const struct rb_type *t, struct rbt_tree *rbt)
+void *_rb_root(const struct rb_type *t, const struct rbt_tree *rbt)
 {
        struct rb_entry *rbe = RBH_ROOT(rbt);
 
        return (rbe == NULL ? rbe : rb_e2n(t, rbe));
 }
 
-void *_rb_min(const struct rb_type *t, struct rbt_tree *rbt)
+void *_rb_min(const struct rb_type *t, const struct rbt_tree *rbt)
 {
        struct rb_entry *rbe = RBH_ROOT(rbt);
        struct rb_entry *parent = NULL;
@@ -538,7 +544,7 @@ void *_rb_min(const struct rb_type *t, struct rbt_tree *rbt)
        return (parent == NULL ? NULL : rb_e2n(t, parent));
 }
 
-void *_rb_max(const struct rb_type *t, struct rbt_tree *rbt)
+void *_rb_max(const struct rb_type *t, const struct rbt_tree *rbt)
 {
        struct rb_entry *rbe = RBH_ROOT(rbt);
        struct rb_entry *parent = NULL;