From af5dd76bca996577262e447fd8bff1bd0df30db7 Mon Sep 17 00:00:00 2001 From: hunt Date: Wed, 26 Oct 2005 08:29:38 +0000 Subject: 2005-10-26 Martin Hunt * map.c (_new_map_create, _new_map_del_node, _new_map_del_node, _new_map_set_int64, _new_map_set_str,_new_map_get_int64, _new_map_get_str, _new_map_get_stat, _new_map_set_stat): New internal functions for the new API. * map-int.c (__stp_map_set_int64): Modify to return an error code. * map-stat.c (_stp_map_add_stat): Ditto. * map-str (_stp_map_set_str): Ditto. * Doxyfile: Remove predefines NEED_STRING_VALS, NEED_STATS, NEED_INT64. * map-keys.c: Ditto. * list.c (_stp_list_new): Ditto. Also set map->list. * map-values.c: Ditto. --- runtime/map.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'runtime/map.h') diff --git a/runtime/map.h b/runtime/map.h index 857751d2..9c0b1fc3 100644 --- a/runtime/map.h +++ b/runtime/map.h @@ -73,7 +73,10 @@ struct map_root { int num; /* when more than maxnum elements, wrap or discard? */ - int no_wrap; + int wrap; + + /* is this a list? */ + int list; /* linked list of current entries */ struct list_head head; @@ -218,12 +221,10 @@ char * _stp_get_str(struct map_node *m); stat * _stp_get_stat(struct map_node *m); unsigned int str_hash(const char *key1); static MAP _stp_map_new(unsigned max_entries, int type, int key_size, int data_size); -#ifdef NEED_STAT_VALS static int msb64(int64_t x); static MAP _stp_map_new_hstat_log(unsigned max_entries, int key_size, int buckets); static MAP _stp_map_new_hstat_linear(unsigned max_entries, int ksize, int start, int stop, int interval); static void _stp_map_print_histogram(MAP map, stat *s); -#endif void _stp_map_key_del(MAP map); struct map_node * _stp_map_start(MAP map); struct map_node * _stp_map_iter(MAP map, struct map_node *m); @@ -231,6 +232,14 @@ void _stp_map_del(MAP map); void _stp_map_print(MAP map, const char *fmt); static struct map_node * __stp_map_create(MAP map); +static struct map_node *_new_map_create (MAP map, struct hlist_head *head); +static int _new_map_set_int64 (MAP map, struct map_node *n, int64_t val, int add); +static int64_t _new_map_get_int64 (MAP map, struct map_node *n); +static char *_new_map_get_str (MAP map, struct map_node *n); +static int _new_map_set_str (MAP map, struct map_node *n, char *val, int add); +static stat *_new_map_get_stat (MAP map, struct map_node *n); +static int _new_map_set_stat (MAP map, struct map_node *n, int64_t val, int add, int new); + /* these prototypes suppress warnings from macros */ void _stp_map_key_str(MAP, char *); void _stp_map_set_str(MAP, char *); -- cgit