1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Fixes some BFD bugs and makes logging thread-safe.

This commit is contained in:
Ondrej Zajicek
2013-10-05 20:12:28 +02:00
parent 6a8d3f1c1f
commit 0e175f9f0f
18 changed files with 326 additions and 237 deletions

View File

@@ -132,3 +132,37 @@ same_tree(struct f_tree *t1, struct f_tree *t2)
return 0;
return 1;
}
static void
tree_node_format(struct f_tree *t, buffer *buf)
{
if (t == NULL)
return;
tree_node_format(t->left, buf);
val_format(t->from, buf);
if (val_compare(t->from, t->to) != 0)
{
buffer_puts(buf, "..");
val_format(t->to, buf);
}
buffer_puts(buf, ", ");
tree_node_format(t->right, buf);
}
void
tree_format(struct f_tree *t, buffer *buf)
{
buffer_puts(buf, "[");
tree_node_format(t, buf);
/* Undo last separator */
if (buf->pos[-1] != '[')
buf->pos -= 2;
buffer_puts(buf, "]");
}