[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Add functions to return number of elts in associative conta...



Update of /home/or/cvsroot/tor/src/common
In directory moria:/tmp/cvs-serv16786/src/common

Modified Files:
	container.c container.h 
Log Message:
Add functions to return number of elts in associative containers

Index: container.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/container.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- container.c	23 Nov 2005 04:18:45 -0000	1.48
+++ container.c	23 Nov 2005 07:48:13 -0000	1.49
@@ -859,3 +859,15 @@
   return HT_EMPTY(&map->head);
 }
 
+int
+strmap_size(strmap_t *map)
+{
+  return HT_SIZE(&map->head);
+}
+
+int
+digestmap_size(digestmap_t *map)
+{
+  return HT_SIZE(&map->head);
+}
+

Index: container.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/container.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- container.h	23 Nov 2005 04:18:45 -0000	1.24
+++ container.h	23 Nov 2005 07:48:13 -0000	1.25
@@ -117,6 +117,7 @@
   void* prefix##remove(maptype *map, keytype key);                      \
   void prefix##free(maptype *map, void (*free_val)(void*));             \
   int prefix##isempty(maptype *map);                                    \
+  int prefix##size(maptype *map);                                       \
   prefix##iter_t *prefix##iter_init(maptype *map);                      \
   prefix##iter_t *prefix##iter_next(maptype *map, prefix##iter_t *iter); \
   prefix##iter_t *prefix##iter_next_rmv(maptype *map, prefix##iter_t *iter); \