* Fixed various valgrind warnings.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1189 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2010-11-10 11:40:28 +00:00
parent 649248c909
commit 7e554e8b1b
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ public:
void construct (pointer p, const T& value) { new((void*)p)T(value); }
void destroy (pointer p) { p->~T(); }
void deallocate (pointer p, size_type num) { ::operator delete((void*)p); }
void deallocate (pointer p, size_type num) { free((void*)p); }
};
+1 -1
View File
@@ -472,7 +472,7 @@ p_call_target(const torrent::Object::list_type& args) {
// New download commands and macros:
//
torrent::Object
torrent::Object&
download_get_variable(core::Download* download, const char* first_key, const char* second_key = NULL) {
if (second_key == NULL)
return download->bencode()->get_key(first_key);
+1
View File
@@ -177,6 +177,7 @@ main(int argc, char** argv) {
SignalHandler::set_handler(SIGTERM, sigc::mem_fun(control, &Control::receive_quick_shutdown));
SignalHandler::set_handler(SIGWINCH, sigc::mem_fun(control->display(), &display::Manager::force_redraw));
SignalHandler::set_handler(SIGSEGV, sigc::bind(sigc::ptr_fun(&do_panic), SIGSEGV));
SignalHandler::set_handler(SIGILL, sigc::bind(sigc::ptr_fun(&do_panic), SIGILL));
SignalHandler::set_handler(SIGBUS, sigc::bind(sigc::ptr_fun(&do_panic), SIGBUS));
SignalHandler::set_handler(SIGFPE, sigc::bind(sigc::ptr_fun(&do_panic), SIGFPE));
+2 -3
View File
@@ -61,7 +61,7 @@ public:
static const unsigned int max_size = 32;
thread_queue_hack() { std::memset(m_queue, 0, sizeof(thread_queue_hack)); }
thread_queue_hack() { std::memset(this, 0, sizeof(thread_queue_hack)); }
void lock() { while (!__sync_bool_compare_and_swap(&m_lock, 0, 1)) usleep(0); }
void unlock() { __sync_bool_compare_and_swap(&m_lock, 1, 0); }
@@ -94,8 +94,7 @@ public:
}
void clear_and_unlock() {
std::memset(m_queue, 0, sizeof(value_type) * (max_size + 1));
m_lock = 0;
std::memset(this, 0, sizeof(thread_queue_hack));
__sync_synchronize();
}