Debian Codegraph @

lib/cdt/dtsize.c

raw
1 #include "config.h"
2
3 #include <cdt/dthdr.h>
4
5 /* Return the # of objects in the dictionary
6 **
7 ** Written by Kiem-Phong Vo (5/25/96)
8 */
9
10 static int treecount(Dtlink_t* e)
11 { return e ? treecount(e->left) + treecount(e->right) + 1 : 0;
12 }
13
14 int dtsize(Dt_t* dt)
15 {
16 UNFLATTEN(dt);
17
18 if (dt->data.size < 0) // !(dt->data.type & (DT_SET|DT_BAG))
19 { if (dt->data.type & (DT_OSET|DT_OBAG))
20 dt->data.size = treecount(dt->data.here);
21 }
22
23 return dt->data.size;
24 }