[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [libktorrent/frameworks] src: inline Piece and Request, get rid of vtable for them as it is useless
From: Nick Shaforostoff <shafff () ukr ! net>
Date: 2015-12-01 0:52:34
Message-ID: E1a3ZBK-0007sz-Jf () scm ! kde ! org
[Download RAW message or body]
Git commit 7b47a743892ddf174eeada49a16c43272dd0395f by Nick Shaforostoff.
Committed on 01/12/2015 at 00:52.
Pushed by shaforo into branch 'frameworks'.
inline Piece and Request, get rid of vtable for them as it is useless
M +2 -2 src/CMakeLists.txt
M +1 -2 src/download/chunkdownload.cpp
M +2 -1 src/download/piece.cpp
M +3 -2 src/download/piece.h
M +2 -1 src/download/request.cpp
M +16 -7 src/download/request.h
http://commits.kde.org/libktorrent/7b47a743892ddf174eeada49a16c43272dd0395f
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index aae2ca2..0525958 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -81,8 +81,8 @@ set(libktorrent_SRC
peer/superseeder.cpp
peer/connectionlimit.cpp
- download/piece.cpp
- download/request.cpp
+ #download/piece.cpp all the code is inlined
+ #download/request.cpp all the code is inlined
download/packet.cpp
download/webseed.cpp
download/chunkdownload.cpp
diff --git a/src/download/chunkdownload.cpp b/src/download/chunkdownload.cpp
index 285ac16..d0753e8 100644
--- a/src/download/chunkdownload.cpp
+++ b/src/download/chunkdownload.cpp
@@ -103,8 +103,7 @@ namespace bt
return false;
- DownloadStatus* ds = dstatus.find(p.getPieceDownloader());
- if (ds)
+ if (DownloadStatus* ds = dstatus.find(p.getPieceDownloader()))
ds->remove(pp);
PieceData::Ptr buf = chunk->getPiece(p.getOffset(),p.getLength(),false);
diff --git a/src/download/piece.cpp b/src/download/piece.cpp
index 0a7bfc3..2ccac58 100644
--- a/src/download/piece.cpp
+++ b/src/download/piece.cpp
@@ -18,7 +18,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "piece.h"
-
+#if 0
namespace bt
{
@@ -32,3 +32,4 @@ namespace bt
}
+#endif
\ No newline at end of file
diff --git a/src/download/piece.h b/src/download/piece.h
index a1834cd..d4f6e7e 100644
--- a/src/download/piece.h
+++ b/src/download/piece.h
@@ -31,8 +31,9 @@ namespace bt
class Piece : public Request
{
public:
- Piece(Uint32 index, Uint32 off, Uint32 len, PieceDownloader* pd,const Uint8* data);
- virtual ~Piece();
+ inline Piece(Uint32 index, Uint32 off, Uint32 len, PieceDownloader* pd,const Uint8* data)
+ : Request(index, off, len, pd), data(data) {}
+ ~Piece() {}
const Uint8* getData() const {return data;}
private:
diff --git a/src/download/request.cpp b/src/download/request.cpp
index 9df8ef8..6277ef3 100644
--- a/src/download/request.cpp
+++ b/src/download/request.cpp
@@ -19,7 +19,7 @@
***************************************************************************/
#include "request.h"
#include <interfaces/piecedownloader.h>
-
+#if 0
namespace bt
{
Request::Request() : index(0),off(0),len(0),pd(0)
@@ -47,3 +47,4 @@ namespace bt
}
}
+#endif
\ No newline at end of file
diff --git a/src/download/request.h b/src/download/request.h
index 081f9ac..12c9e61 100644
--- a/src/download/request.h
+++ b/src/download/request.h
@@ -42,7 +42,7 @@ namespace bt
/**
* Constructor, set everything to 0.
*/
- Request();
+ inline Request(): index(0),off(0),len(0),pd(0) {}
/**
* Constructor, set the index, offset,length and peer
@@ -51,14 +51,15 @@ namespace bt
* @param len The length of the piece
* @param pd Pointer to PieceDownloader of the request
*/
- Request(Uint32 index,Uint32 off,Uint32 len,PieceDownloader* pd);
+ inline Request(Uint32 index,Uint32 off,Uint32 len,PieceDownloader* pd)
+ : index(index),off(off),len(len),pd(pd) {}
/**
* Copy constructor.
* @param r Request to copy
*/
- Request(const Request & r);
- virtual ~Request();
+ inline Request(const Request & r): index(r.index),off(r.off),len(r.len),pd(r.pd) {}
+ ~Request(){}
/// Get the index of the chunk
Uint32 getIndex() const {return index;}
@@ -70,13 +71,21 @@ namespace bt
Uint32 getLength() const {return len;}
/// Get the sending Peer
- PieceDownloader* getPieceDownloader() const {return pd;}
+ inline PieceDownloader* getPieceDownloader() const {return pd;}
/**
- * Assignmenth operator.
+ * Assignment operator.
* @param r The Request to copy
*/
- Request & operator = (const Request & r);
+ inline Request & operator = (const Request & r)
+ {
+ index = r.index;
+ off = r.off;
+ len = r.len;
+ pd = r.pd;
+ return *this;
+ }
+
/**
* Compare two requests. Return true if they are the same.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic