refactor: remove unused tr_variant_string.session (#1881)

This was assigned but never used. Shrinks sizeof(tr_bandwidth) by 8 bytes.
This commit is contained in:
Charles Kerr 2021-10-05 19:06:18 -05:00 committed by GitHub
parent 3b49fa993c
commit 396afd8a42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 8 deletions

View File

@ -95,11 +95,10 @@ static int compareBandwidth(void const* va, void const* vb)
****
***/
void tr_bandwidthConstruct(tr_bandwidth* b, tr_session* session, tr_bandwidth* parent)
void tr_bandwidthConstruct(tr_bandwidth* b, tr_bandwidth* parent)
{
static unsigned int uniqueKey = 0;
b->session = session;
b->children = {};
b->magicNumber = BANDWIDTH_MAGIC_NUMBER;
b->uniqueKey = uniqueKey++;

View File

@ -110,7 +110,6 @@ typedef struct tr_bandwidth
tr_priority_t priority;
int magicNumber;
unsigned int uniqueKey;
tr_session* session;
tr_ptrArray children; /* struct tr_bandwidth */
struct tr_peerIo* peer;
} tr_bandwidth;
@ -119,7 +118,7 @@ typedef struct tr_bandwidth
***
**/
void tr_bandwidthConstruct(tr_bandwidth* bandwidth, tr_session* session, tr_bandwidth* parent);
void tr_bandwidthConstruct(tr_bandwidth* bandwidth, tr_bandwidth* parent);
void tr_bandwidthDestruct(tr_bandwidth* bandwidth);

View File

@ -680,7 +680,7 @@ static tr_peerIo* tr_peerIoNew(
io->timeCreated = tr_time();
io->inbuf = evbuffer_new();
io->outbuf = evbuffer_new();
tr_bandwidthConstruct(&io->bandwidth, session, parent);
tr_bandwidthConstruct(&io->bandwidth, parent);
tr_bandwidthSetPeer(&io->bandwidth, io);
dbgmsg(io, "bandwidth is %p; its parent is %p", (void*)&io->bandwidth, (void*)parent);

View File

@ -636,7 +636,7 @@ tr_session* tr_sessionInit(char const* configDir, bool messageQueuingEnabled, tr
session->cache = tr_cacheNew(1024 * 1024 * 2);
session->magicNumber = SESSION_MAGIC_NUMBER;
session->session_id = tr_session_id_new();
tr_bandwidthConstruct(&session->bandwidth, session, nullptr);
tr_bandwidthConstruct(&session->bandwidth, nullptr);
tr_variantInitList(&session->removedTorrents, 0);
/* nice to start logging at the very beginning */

View File

@ -885,7 +885,7 @@ static void torrentInit(tr_torrent* tor, tr_ctor const* ctor)
tor->incompleteDir = tr_strdup(dir);
}
tr_bandwidthConstruct(&tor->bandwidth, session, &session->bandwidth);
tr_bandwidthConstruct(&tor->bandwidth, &session->bandwidth);
tor->bandwidth.priority = tr_ctorGetBandwidthPriority(ctor);
tor->error = TR_STAT_OK;

View File

@ -614,7 +614,7 @@ tr_webseed* tr_webseedNew(struct tr_torrent* tor, char const* url, tr_peer_callb
w->callback = callback;
w->callback_data = callback_data;
w->file_urls = tr_new0(char*, inf->fileCount);
tr_bandwidthConstruct(&w->bandwidth, tor->session, &tor->bandwidth);
tr_bandwidthConstruct(&w->bandwidth, &tor->bandwidth);
w->timer = evtimer_new(w->session->event_base, webseed_timer_func, w);
tr_timerAddMsec(w->timer, TR_IDLE_TIMER_MSEC);
return w;