Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset c1b8ad4 in mainline


Ignore:
Timestamp:
2016-03-11T13:12:24Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
c064b58
Parents:
d4d8255
git-author:
Umute P. Fletcher <conti.ma@…> (2016-03-11 13:12:24)
git-committer:
Jiri Svoboda <jiri@…> (2016-03-11 13:12:24)
Message:

Add btree_count()

Location:
kernel/generic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/adt/btree.h

    rd4d8255 rc1b8ad4  
    108108
    109109extern void btree_print(btree_t *t);
     110
     111extern unsigned long btree_count(btree_t *t);
     112
    110113#endif
    111114
  • kernel/generic/src/adt/btree.c

    rd4d8255 rc1b8ad4  
    10451045}
    10461046
     1047/** Return number of B-tree elements.
     1048 *
     1049 * @param t    B-tree to count.
     1050 * @return Return number of B-tree elements.
     1051 *
     1052 */
     1053unsigned long btree_count(btree_t *t)
     1054{
     1055        unsigned long count = 0;
     1056
     1057        list_foreach(t->leaf_list, leaf_link, btree_node_t, node) {
     1058                count += node->keys;
     1059        }
     1060
     1061        return count;
     1062}
     1063
    10471064/** @}
    10481065 */
Note: See TracChangeset for help on using the changeset viewer.