From: John L. <mov...@us...> - 2003-03-03 02:20:05
|
Update of /cvsroot/oprofile/oprofile/pp In directory sc8-pr-cvs1:/tmp/cvs-serv30514/pp Modified Files: counter_profile.cpp op_merge.cpp Log Message: Chris Mollers libdb patch + some changes on top Index: counter_profile.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/pp/counter_profile.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- counter_profile.cpp 2 Mar 2003 03:28:56 -0000 1.6 +++ counter_profile.cpp 3 Mar 2003 02:20:01 -0000 1.7 @@ -79,8 +79,16 @@ void counter_profile_t::build_ordered_samples(string const & filename) { samples_db_t samples_db; + char * err_msg; - db_open(&samples_db, filename.c_str(), DB_RDONLY, sizeof(struct opd_header)); + int rc = db_open(&samples_db, filename.c_str(), DB_RDONLY, + sizeof(struct opd_header), &err_msg); + + if (rc != EXIT_SUCCESS) { + cerr << err_msg << endl; + free(err_msg); + exit(EXIT_FAILURE); + } opd_header const & head = *static_cast<opd_header *>(samples_db.base_memory); Index: op_merge.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/pp/op_merge.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- op_merge.cpp 8 Dec 2002 05:12:28 -0000 1.34 +++ op_merge.cpp 3 Mar 2003 02:20:01 -0000 1.35 @@ -157,7 +157,11 @@ { samples_db_t * dest = (samples_db_t *)data; - db_insert(dest, key, value); + int rc = db_insert(dest, key, value); + if (rc != EXIT_SUCCESS) { + cerr << "db_insert() failure !" << endl; + exit(EXIT_FAILURE); + } } /** @@ -185,15 +189,26 @@ } samples_db_t dest; + char * err_msg; - db_open(&dest, filename.c_str(), DB_RDWR, - sizeof(struct opd_header)); + int rc = db_open(&dest, filename.c_str(), DB_RDWR, + sizeof(struct opd_header), &err_msg); + if (rc != EXIT_SUCCESS) { + cerr << err_msg << endl; + free(err_msg); + exit(EXIT_FAILURE); + } for (++it ; it != filenames.end() ; ++it) { samples_db_t src; - db_open(&src, it->c_str(), DB_RDONLY, - sizeof(struct opd_header)); + rc = db_open(&src, it->c_str(), DB_RDONLY, + sizeof(struct opd_header), &err_msg); + if (rc != EXIT_SUCCESS) { + cerr << err_msg << endl; + free(err_msg); + exit(EXIT_FAILURE); + } samples_db_travel(&src, 0, ~0, copy_callback, &dest); |