From 204b456c7c08bc40ffe1f21575461d92a544e92b Mon Sep 17 00:00:00 2001 From: hunt Date: Wed, 9 Mar 2005 21:30:05 +0000 Subject: Initial runtime checkin. --- runtime/docs/examples/foreach.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 runtime/docs/examples/foreach.c (limited to 'runtime/docs/examples/foreach.c') diff --git a/runtime/docs/examples/foreach.c b/runtime/docs/examples/foreach.c new file mode 100644 index 00000000..fc110674 --- /dev/null +++ b/runtime/docs/examples/foreach.c @@ -0,0 +1,9 @@ +/* example showing how to print all the stats in a map using foreach() */ + +struct map_node_stat *ptr; + +foreach (map, ptr) + printf ("map[%s,%ld] = [c=%lld s=%lld min=%lld max=%lld]\n", key1str(ptr), + key2int(ptr), ptr->stats.count, ptr->stats.sum, ptr->stats.min, + ptr->stats.max); + -- cgit