From 8bdbaec87201bc5b82af8344952cdc2d8ed3487e Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Mon, 24 Oct 2016 20:19:01 -0400 Subject: [PATCH] minor cleanup refactor (#1252) --- include/libtorrent/block_cache.hpp | 5 ----- include/libtorrent/disk_io_thread.hpp | 1 - include/libtorrent/settings_pack.hpp | 2 +- src/block_cache.cpp | 3 --- src/disk_io_thread.cpp | 13 +++---------- 5 files changed, 4 insertions(+), 20 deletions(-) diff --git a/include/libtorrent/block_cache.hpp b/include/libtorrent/block_cache.hpp index ecab70c55..b07c03a60 100644 --- a/include/libtorrent/block_cache.hpp +++ b/include/libtorrent/block_cache.hpp @@ -33,10 +33,6 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_BLOCK_CACHE #define TORRENT_BLOCK_CACHE -#include "libtorrent/aux_/disable_warnings_push.hpp" -#include -#include "libtorrent/aux_/disable_warnings_pop.hpp" - #include #include #include @@ -47,7 +43,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/io_service_fwd.hpp" #include "libtorrent/hasher.hpp" #include "libtorrent/sliding_average.hpp" -#include "libtorrent/time.hpp" #include "libtorrent/tailqueue.hpp" #include "libtorrent/linked_list.hpp" #include "libtorrent/disk_buffer_pool.hpp" diff --git a/include/libtorrent/disk_io_thread.hpp b/include/libtorrent/disk_io_thread.hpp index db241d717..1a3970d5b 100644 --- a/include/libtorrent/disk_io_thread.hpp +++ b/include/libtorrent/disk_io_thread.hpp @@ -463,7 +463,6 @@ namespace libtorrent static bool wait_for_job(job_queue& jobq, disk_io_thread_pool& threads , std::unique_lock& l); - void add_completed_job(disk_io_job* j); void add_completed_jobs(jobqueue_t& jobs); void add_completed_jobs_impl(jobqueue_t& jobs , jobqueue_t& completed_jobs); diff --git a/include/libtorrent/settings_pack.hpp b/include/libtorrent/settings_pack.hpp index ef12c5408..ff99d453e 100644 --- a/include/libtorrent/settings_pack.hpp +++ b/include/libtorrent/settings_pack.hpp @@ -932,7 +932,7 @@ namespace libtorrent choking_algorithm, seed_choking_algorithm, - // ``cache_size`` is the disk write and read cache. It is specified + // ``cache_size`` is the disk write and read cache. It is specified // in units of 16 KiB blocks. Buffers that are part of a peer's send // or receive buffer also count against this limit. Send and receive // buffers will never be denied to be allocated, but they will cause diff --git a/src/block_cache.cpp b/src/block_cache.cpp index 00a9adede..1d0bcbdd0 100644 --- a/src/block_cache.cpp +++ b/src/block_cache.cpp @@ -32,12 +32,9 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/config.hpp" #include "libtorrent/block_cache.hpp" -#include "libtorrent/disk_buffer_pool.hpp" #include "libtorrent/assert.hpp" -#include "libtorrent/time.hpp" #include "libtorrent/disk_io_job.hpp" #include "libtorrent/storage.hpp" -#include "libtorrent/io_service_fwd.hpp" #include "libtorrent/error.hpp" #include "libtorrent/disk_io_thread.hpp" // disk_operation_failed #include "libtorrent/invariant_check.hpp" diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index 4ced0b198..2abdd92e3 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -2335,7 +2335,7 @@ namespace libtorrent TORRENT_PIECE_ASSERT(pe->blocks[i].buf, pe); TORRENT_PIECE_ASSERT(ph->offset == i * block_size, pe); ph->offset += int(iov.iov_len); - ph->h.update(pe->blocks[i].buf, int(iov.iov_len)); + ph->h.update({pe->blocks[i].buf, iov.iov_len}); } else { @@ -2366,7 +2366,7 @@ namespace libtorrent TORRENT_PIECE_ASSERT(ph->offset == i * block_size, pe); ret = j->storage->get_storage_impl()->readv(iov, j->piece - , ph->offset, file_flags, j->error); + , ph->offset, file_flags, j->error); if (ret < 0) { @@ -2401,7 +2401,7 @@ namespace libtorrent TORRENT_PIECE_ASSERT(ph->offset == i * block_size, pe); ph->offset += int(iov.iov_len); - ph->h.update(static_cast(iov.iov_base), int(iov.iov_len)); + ph->h.update({static_cast(iov.iov_base), iov.iov_len}); l.lock(); m_disk_cache.insert_blocks(pe, i, &iov, 1, j); @@ -3324,13 +3324,6 @@ namespace libtorrent return disk_buffer_holder(*this, ret); } - void disk_io_thread::add_completed_job(disk_io_job* j) - { - jobqueue_t tmp; - tmp.push_back(j); - add_completed_jobs(tmp); - } - void disk_io_thread::add_completed_jobs(jobqueue_t& jobs) { jobqueue_t new_completed_jobs;