From: Philippe E. <ph...@us...> - 2003-09-26 02:16:27
|
Update of /cvsroot/oprofile/oprofile/libdb In directory sc8-pr-cvs1:/tmp/cvs-serv24171/libdb Modified Files: Makefile.am db_debug.c db_travel.c odb_hash.h Removed Files: db_test.c Log Message: populate libdb/tests and libregex/tests. Remove some useless interface in libdb Index: Makefile.am =================================================================== RCS file: /cvsroot/oprofile/oprofile/libdb/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -u -p -d -r1.9 -r1.10 --- Makefile.am 21 May 2003 19:36:17 -0000 1.9 +++ Makefile.am 26 Sep 2003 02:16:22 -0000 1.10 @@ -1,3 +1,5 @@ +SUBDIRS=. tests + AM_CPPFLAGS = \ -I ${top_srcdir}/libop \ -I ${top_srcdir}/libutil @@ -14,7 +16,3 @@ libodb_a_SOURCES = \ db_stat.c \ odb_hash.h -noinst_PROGRAMS = db_test - -db_test_SOURCES = db_test.c -db_test_LDADD = libodb.a Index: db_debug.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/libdb/db_debug.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -p -d -r1.4 -r1.5 --- db_debug.c 31 Mar 2003 16:39:41 -0000 1.4 +++ db_debug.c 26 Sep 2003 02:16:22 -0000 1.5 @@ -14,28 +14,6 @@ #include "odb_hash.h" -static void display_callback(odb_key_t key, odb_value_t value, void * data) -{ - printf("%x %d\n", key, value); - data = data; -} - -void odb_display_hash(samples_odb_t const * hash) -{ - if (!odb_check_hash(hash)) { - samples_odb_travel(hash, 0, ~0, display_callback, 0); - } -} - -void odb_raw_display_hash(samples_odb_t const * hash) -{ - odb_node_nr_t pos; - for (pos = 1 ; pos < hash->descr->current_size ; ++pos) { - odb_node_t const * node = &hash->node_base[pos]; - printf("%x %d %d\n", node->key, node->value, node->next); - } -} - static int check_circular_list(samples_odb_t const * hash) { odb_node_nr_t pos; @@ -149,13 +127,6 @@ int odb_check_hash(samples_odb_t const * if (ret == 0) { ret = check_redundant_key(hash, max); - } - - if (ret == 0) { - odb_hash_stat_t * stats; - stats = odb_hash_stat(hash); - odb_hash_display_stat(stats); - odb_hash_free_stat(stats); } return ret; Index: db_travel.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/libdb/db_travel.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -p -d -r1.3 -r1.4 --- db_travel.c 31 Mar 2003 16:39:41 -0000 1.3 +++ db_travel.c 26 Sep 2003 02:16:22 -0000 1.4 @@ -10,28 +10,6 @@ #include "odb_hash.h" -static void do_travel(samples_odb_t const * hash, odb_key_t first, odb_key_t last, - samples_odb_travel_callback callback, void * data) -{ - size_t pos; - for (pos = 1; pos < hash->descr->current_size ; ++pos) { - odb_node_t const * node = &hash->node_base[pos]; - /* look odb_insert about locking rationale and the need - * to never pass to callback() a 0 key */ - if (node->key >= first && node->key < last && node->key) { - callback(node->key, node->value, data); - } - } -} - - -void samples_odb_travel(samples_odb_t const * hash, odb_key_t first, odb_key_t last, - samples_odb_travel_callback callback, void * data) -{ - do_travel(hash, first, last, callback, data); -} - - odb_node_t * odb_get_iterator(samples_odb_t const * hash, odb_node_nr_t * nr) { /* node zero is unused */ Index: odb_hash.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/libdb/odb_hash.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -p -d -r1.7 -r1.8 --- odb_hash.h 24 Sep 2003 21:53:50 -0000 1.7 +++ odb_hash.h 26 Sep 2003 02:16:22 -0000 1.8 @@ -128,36 +128,24 @@ odb_node_nr_t odb_hash_add_node(samples_ /** "immpossible" node number to indicate an error from odb_hash_add_node() */ #define ODB_NODE_NR_INVALID ((odb_node_nr_t)-1) -/* odb_debug.c */ +/* db_debug.c */ /** check than the hash is well build */ int odb_check_hash(const samples_odb_t * hash); -/** display the item in hash table */ -void odb_display_hash(samples_odb_t const * hash); -/** same as above, do not travel through the hash table but display raw node */ -void odb_raw_display_hash(samples_odb_t const * hash); -/* odb_stat.c */ +/* db_stat.c */ typedef struct odb_hash_stat_t odb_hash_stat_t; odb_hash_stat_t * odb_hash_stat(samples_odb_t const * hash); void odb_hash_display_stat(odb_hash_stat_t const * stats); void odb_hash_free_stat(odb_hash_stat_t * stats); -/* odb_insert.c */ +/* db_insert.c */ /** insert info at key, if key already exist the info is added to the * existing samples * returns EXIT_SUCCESS on success, EXIT_FAILURE on failure */ int odb_insert(samples_odb_t * hash, odb_key_t key, odb_value_t value); -/* odb_travel.c */ -/** the call back type to pass to travel() */ -typedef void (*samples_odb_travel_callback)(odb_key_t key, odb_value_t value, void * data); -/** iterate through key in range [first, last[ passing it to callback, - * data is optional user data to pass to the callback */ -/* caller would use the more efficient odb_get_iterator() interface. This - * interface is for debug purpose and is likely to be removed in future */ -void samples_odb_travel(samples_odb_t const * hash, odb_key_t first, odb_key_t last, - samples_odb_travel_callback callback, void * data); +/* db_travel.c */ /** * return a base pointer to the node array and number of node in this array * caller then will iterate through: --- db_test.c DELETED --- |