slight memory optimization and some header cleanup

This commit is contained in:
Arvid Norberg 2009-05-03 20:21:24 +00:00
parent f2ec6b5adb
commit 641abc6c4a
11 changed files with 16 additions and 34 deletions

View File

@ -33,12 +33,10 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_SESSION_IMPL_HPP_INCLUDED
#define TORRENT_SESSION_IMPL_HPP_INCLUDED
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <list>
#include <deque>
#ifndef TORRENT_DISABLE_GEO_IP
#include "libtorrent/GeoIP.h"
@ -48,8 +46,6 @@ POSSIBILITY OF SUCH DAMAGE.
#pragma warning(push, 1)
#endif
#include <boost/limits.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/thread.hpp>
#include <boost/thread/recursive_mutex.hpp>
@ -64,13 +60,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/socket.hpp"
#include "libtorrent/peer_id.hpp"
#include "libtorrent/tracker_manager.hpp"
#include "libtorrent/alert.hpp"
#include "libtorrent/debug.hpp"
#include "libtorrent/piece_block_progress.hpp"
#include "libtorrent/ip_filter.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/session_settings.hpp"
#include "libtorrent/kademlia/dht_tracker.hpp"
#include "libtorrent/session_status.hpp"
#include "libtorrent/session.hpp"
#include "libtorrent/stat.hpp"
@ -79,6 +73,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/socket_type.hpp"
#include "libtorrent/connection_queue.hpp"
#include "libtorrent/disk_io_thread.hpp"
#include "libtorrent/udp_socket.hpp"
#include "libtorrent/assert.hpp"
namespace libtorrent
@ -91,6 +86,7 @@ namespace libtorrent
class lsd;
struct fingerprint;
class torrent;
class alert;
namespace dht
{

View File

@ -33,12 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_BANDWIDTH_MANAGER_HPP_INCLUDED
#define TORRENT_BANDWIDTH_MANAGER_HPP_INCLUDED
#include <boost/shared_ptr.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <boost/integer_traits.hpp>
#include <deque>
#ifdef TORRENT_VERBOSE_BANDWIDTH_LIMIT
#include <fstream>
@ -50,10 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/bandwidth_limit.hpp"
#include "libtorrent/bandwidth_queue_entry.hpp"
using boost::weak_ptr;
using boost::shared_ptr;
using boost::intrusive_ptr;
using boost::bind;
namespace libtorrent {

View File

@ -37,7 +37,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <ctime>
#include <algorithm>
#include <vector>
#include <deque>
#include <string>
#include "libtorrent/debug.hpp"
@ -363,7 +362,7 @@ private:
};
static bool range_below_zero(const range& r)
{ return r.start < 0; }
std::deque<range> m_payloads;
std::vector<range> m_payloads;
#ifndef TORRENT_DISABLE_EXTENSIONS
// this is set to true if the handshake from

View File

@ -34,7 +34,6 @@ POSSIBILITY OF SUCH DAMAGE.
#define ROUTING_TABLE_HPP
#include <vector>
#include <deque>
#include <boost/cstdint.hpp>
#include <boost/iterator/iterator_facade.hpp>

View File

@ -36,7 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <ctime>
#include <algorithm>
#include <vector>
#include <deque>
#include <string>
#include "libtorrent/debug.hpp"
@ -265,7 +264,7 @@ namespace libtorrent
std::vector<pending_block> const& download_queue() const;
std::vector<piece_block> const& request_queue() const;
std::deque<peer_request> const& upload_queue() const;
std::vector<peer_request> const& upload_queue() const;
// estimate of how long it will take until we have
// received all piece requests that we have sent
@ -734,7 +733,7 @@ namespace libtorrent
// the queue of requests we have got
// from this peer
std::deque<peer_request> m_requests;
std::vector<peer_request> m_requests;
// the blocks we have reserved in the piece
// picker and will request from this peer.

View File

@ -33,19 +33,14 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_SESSION_HPP_INCLUDED
#define TORRENT_SESSION_HPP_INCLUDED
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <list>
#include <deque>
#ifdef _MSC_VER
#pragma warning(push, 1)
#endif
#include <boost/limits.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/thread.hpp>
@ -56,17 +51,19 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include "libtorrent/torrent_handle.hpp"
#include "libtorrent/entry.hpp"
#include "libtorrent/alert.hpp"
#include "libtorrent/session_status.hpp"
#include "libtorrent/version.hpp"
#include "libtorrent/fingerprint.hpp"
#include "libtorrent/time.hpp"
#include "libtorrent/disk_io_thread.hpp"
#include "libtorrent/peer_id.hpp"
#include "libtorrent/storage.hpp"
#include <boost/preprocessor/cat.hpp>
#ifndef TORRENT_NO_DEPRECATE
#include "libtorrent/alert.hpp"
#endif
#ifdef _MSC_VER
# include <eh.h>
#endif
@ -80,6 +77,7 @@ namespace libtorrent
class connection_queue;
class natpmp;
class upnp;
class alert;
// this is used to create linker errors when trying to link to
// a library with a conflicting build configuration than the application

View File

@ -2953,7 +2953,7 @@ namespace libtorrent
int amount_payload = 0;
if (!m_payloads.empty())
{
for (std::deque<range>::iterator i = m_payloads.begin();
for (std::vector<range>::iterator i = m_payloads.begin();
i != m_payloads.end(); ++i)
{
i->start -= bytes_transferred;
@ -3017,7 +3017,7 @@ namespace libtorrent
if (!m_payloads.empty())
{
for (std::deque<range>::const_iterator i = m_payloads.begin();
for (std::vector<range>::const_iterator i = m_payloads.begin();
i != m_payloads.end() - 1; ++i)
{
TORRENT_ASSERT(i->start + i->length <= (i+1)->start);

View File

@ -31,7 +31,6 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/storage.hpp"
#include <deque>
#include "libtorrent/disk_io_thread.hpp"
#include "libtorrent/disk_buffer_holder.hpp"
#include "libtorrent/alloca.hpp"

View File

@ -33,7 +33,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/pch.hpp"
#include <vector>
#include <deque>
#include <algorithm>
#include <functional>
#include <numeric>

View File

@ -758,7 +758,7 @@ namespace libtorrent
return m_download_queue;
}
std::deque<peer_request> const& peer_connection::upload_queue() const
std::vector<peer_request> const& peer_connection::upload_queue() const
{
return m_requests;
}
@ -2130,7 +2130,7 @@ namespace libtorrent
<< " <== CANCEL [ piece: " << r.piece << " | s: " << r.start << " | l: " << r.length << " ]\n";
#endif
std::deque<peer_request>::iterator i
std::vector<peer_request>::iterator i
= std::find(m_requests.begin(), m_requests.end(), r);
if (i != m_requests.end())
@ -2496,7 +2496,7 @@ namespace libtorrent
// reject the requests we have in the queue
// except the allowed fast pieces
for (std::deque<peer_request>::iterator i = m_requests.begin();
for (std::vector<peer_request>::iterator i = m_requests.begin();
i != m_requests.end();)
{
if (m_accept_fast.count(i->piece))

View File

@ -76,6 +76,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/instantiate_connection.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/broadcast_socket.hpp"
#include "libtorrent/kademlia/dht_tracker.hpp"
#if TORRENT_USE_IOSTREAM
#include <iostream>