This is better than plain void pointer, since now the iterator can be
embedded as part of some other struct. This simplifies the design.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
{
int direction, count = 0;
{
int direction, count = 0;
- direction = it->direction(head, it->ptr);
+ direction = it->direction(head, (struct quadtree_iterator *)it);
if ((direction & QUADTREE_UPLEFT) && head->child[0])
count += _walk_tree(head->child[0], it);
if ((direction & QUADTREE_UPLEFT) && head->child[0])
count += _walk_tree(head->child[0], it);
count += _walk_tree(head->child[3], it);
if ((direction & QUADTREE_SELF) && it->callback) {
count += _walk_tree(head->child[3], it);
if ((direction & QUADTREE_SELF) && it->callback) {
- it->callback(head, it->ptr);
+ it->callback(head, (struct quadtree_iterator *)it);
struct quadtree *head;
void *ptr;
struct quadtree *head;
void *ptr;
- int (*direction)(struct quadtree *head, void *ptr);
- void (*callback)(struct quadtree *head, void *ptr);
+ int (*direction)(struct quadtree *head, struct quadtree_iterator *it);
+ void (*callback)(struct quadtree *head, struct quadtree_iterator *it);
};
struct quadtree *quadtree_add(struct quadtree *parent,
};
struct quadtree *quadtree_add(struct quadtree *parent,