File: dtsize.c

package info (click to toggle)
graphviz 14.1.1-2
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 139,440 kB
  • sloc: ansic: 142,129; cpp: 11,960; python: 7,770; makefile: 4,043; yacc: 3,030; xml: 2,972; tcl: 2,495; sh: 1,388; objc: 1,159; java: 560; lex: 423; perl: 243; awk: 156; pascal: 139; php: 58; ruby: 49; cs: 31; sed: 1
file content (22 lines) | stat: -rw-r--r-- 432 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include	<cdt/dthdr.h>

/*	Return the # of objects in the dictionary
**
**	Written by Kiem-Phong Vo (5/25/96)
*/

static int treecount(Dtlink_t* e)
{	return e ? treecount(e->left) + treecount(e->right) + 1 : 0;
}

int dtsize(Dt_t* dt)
{
	UNFLATTEN(dt);

	if (dt->data.size < 0) // !(dt->data.type & (DT_SET|DT_BAG))
	{	if (dt->data.type & (DT_OSET|DT_OBAG))
			dt->data.size = treecount(dt->data.here);
	}

	return dt->data.size;
}