diff --git a/src/__internal/rbtree.h b/src/__internal/rbtree.h index 3cdde2b..0b2dc6a 100644 --- a/src/__internal/rbtree.h +++ b/src/__internal/rbtree.h @@ -21,10 +21,10 @@ extern void* libcdsb_builtin_rbtree_node_create(void* value, rbnode_t* paren extern void libcdsb_builtin_rbtree_node_fixup (rbnode_t** root, rbnode_t* node) Nonnull__(1,2); extern rbnode_t* libcdsb_builtin_rbtree_node_delete(rbnode_t** root, rbnode_t* node) Nonnull__(1,2); -extern stack_t libcdsb_builtin_rbtree_iter_inorder (rbnode_t** root, bool reverse); -extern stack_t libcdsb_builtin_rbtree_iter_preorder (rbnode_t** root, bool reverse); -extern stack_t libcdsb_builtin_rbtree_iter_postorder (rbnode_t** root, bool reverse); -extern stack_t libcdsb_builtin_rbtree_iter_breath_first(rbnode_t** root, bool reverse); +extern stack_t libcdsb_builtin_rbtree_iter_inorder (rbnode_t** root, bool reverse); +extern stack_t libcdsb_builtin_rbtree_iter_preorder (rbnode_t** root, bool reverse); +extern stack_t libcdsb_builtin_rbtree_iter_postorder (rbnode_t** root, bool reverse); +extern stack_t libcdsb_builtin_rbtree_iter_breadth_first(rbnode_t** root, bool reverse); #define rbnode_empty ((rbnode_t*)LIBCDSB_BUILTIN_RBTREE_NODE_EMPTY) #define rbnode_create(v, p, c) ((rbnode_t*)libcdsb_builtin_rbtree_node_create(v, p, c, sizeof(rbnode_t))) @@ -34,9 +34,9 @@ extern stack_t libcdsb_builtin_rbtree_iter_breath_first(rbnode_t** root, bool re #define rbnode_is_empty(n) ((n) == rbnode_empty) #define rbnode_is_root(n) rbnode_is_empty((n)->parent) -#define rbiter_inorder libcdsb_builtin_rbtree_iter_inorder -#define rbiter_preorder libcdsb_builtin_rbtree_iter_preorder -#define rbiter_postorder libcdsb_builtin_rbtree_iter_postorder -#define rbiter_breath_first libcdsb_builtin_rbtree_iter_breath_first +#define rbiter_inorder libcdsb_builtin_rbtree_iter_inorder +#define rbiter_preorder libcdsb_builtin_rbtree_iter_preorder +#define rbiter_postorder libcdsb_builtin_rbtree_iter_postorder +#define rbiter_breadth_first libcdsb_builtin_rbtree_iter_breadth_first #endif /* LIBCDSB_SRC_INTERNAL_RBTREE_H */ diff --git a/src/map/access.c b/src/map/access.c index d3b62cc..72fed74 100644 --- a/src/map/access.c +++ b/src/map/access.c @@ -89,7 +89,7 @@ int libcdsb_map_foreach(map_t* x, void* data, map_access_callback callback, rbfo default: case RBFOREACH_BREADTH_FIRST: if (reverse || flush) { - iter = miter_breath_first(&x->root, type&RBFOREACH_REVERSE); + iter = miter_breadth_first(&x->root, type&RBFOREACH_REVERSE); break; } else return libcdsb_builtin_foreach(x, data, callback); } diff --git a/src/map/include.h b/src/map/include.h index 5587d97..051c284 100644 --- a/src/map/include.h +++ b/src/map/include.h @@ -35,9 +35,9 @@ static_assert(offsetof(struct libcdsb_set, type) == offsetof(struct l #define mnode_is_empty(n) ((n) == mnode_empty) #define mnode_is_root(n) mnode_is_empty((n)->parent) -#define miter_inorder(x, reverse) rbiter_inorder((void*)x, reverse) -#define miter_preorder(x, reverse) rbiter_preorder((void*)x, reverse) -#define miter_postorder(x, reverse) rbiter_postorder((void*)x, reverse) -#define miter_breath_first(x, reverse) rbiter_breath_first((void*)x, reverse) +#define miter_inorder(x, reverse) rbiter_inorder((void*)x, reverse) +#define miter_preorder(x, reverse) rbiter_preorder((void*)x, reverse) +#define miter_postorder(x, reverse) rbiter_postorder((void*)x, reverse) +#define miter_breadth_first(x, reverse) rbiter_breadth_first((void*)x, reverse) #endif /* LIBCDSB_SRC_MAP_INCLUDE_H */ diff --git a/src/rbtree.c b/src/rbtree.c index 025ff6d..bd8c6b1 100644 --- a/src/rbtree.c +++ b/src/rbtree.c @@ -316,7 +316,7 @@ stack_t libcdsb_builtin_rbtree_iter_postorder(rbnode_t** root, bool reverse) { } -stack_t libcdsb_builtin_rbtree_iter_breath_first(rbnode_t** root, bool reverse) { +stack_t libcdsb_builtin_rbtree_iter_breadth_first(rbnode_t** root, bool reverse) { stack_t z, *top, *bot, *cur; rbnode_t* n; diff --git a/src/set/access.c b/src/set/access.c index 2e5a4c4..25633fd 100644 --- a/src/set/access.c +++ b/src/set/access.c @@ -86,10 +86,10 @@ int libcdsb_vset_foreach(set_t* x, void* data, vset_access_callback callback, rb case RBFOREACH_INORDER: iter = rbiter_inorder (&x->root, reverse); break; case RBFOREACH_PREORDER: iter = rbiter_preorder (&x->root, reverse); break; case RBFOREACH_POSTORDER: iter = rbiter_postorder(&x->root, reverse); break; - + default: case RBFOREACH_BREADTH_FIRST: if (reverse || flush) { - iter = rbiter_breath_first(&x->root, type&RBFOREACH_REVERSE); + iter = rbiter_breadth_first(&x->root, type&RBFOREACH_REVERSE); break; } else return libcdsb_builtin_foreach(x, data, callback); }