diff --git a/src/cluster.c b/src/cluster.c index 20f56dc..c79addc 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -60,6 +60,7 @@ static long tree_alloc_node(struct b_tree *p) fseek(table->t_storage, pos, SEEK_SET); len /= sizeof *n; + table->t_nr_groups++; return (long)len; } @@ -165,6 +166,8 @@ void cluster_table_init(struct cluster_table *table, FILE *storage) &table->t_base); node_init(root); tree_put_node(&table->t_base, 0, (b_tree_node *)root); + table->t_nr_groups++; + b_tree_cache_release_node(&table->t_base, (b_tree_node *)root); } diff --git a/src/cluster.h b/src/cluster.h index 25a1e72..0df9a61 100644 --- a/src/cluster.h +++ b/src/cluster.h @@ -1,12 +1,13 @@ #ifndef CLUSTER_H_ #define CLUSTER_H_ -#include - #include "b-tree.h" +#include + struct cluster_table { struct b_tree t_base; + size_t t_nr_groups; FILE *t_storage; }; @@ -21,7 +22,12 @@ struct cluster { extern void cluster_table_init(struct cluster_table *table, FILE *storage); extern void cluster_table_finish(struct cluster_table *table); -extern int cluster_table_get(struct cluster_table *table, unsigned long id, struct cluster *out); -extern int cluster_table_put(struct cluster_table *table, const struct cluster *in); +extern int cluster_table_get( + struct cluster_table *table, + unsigned long id, + struct cluster *out); +extern int cluster_table_put( + struct cluster_table *table, + const struct cluster *in); -#endif \ No newline at end of file +#endif