From 3e4168025b6c979ec7270e805ee0c7fb9e407c95 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 31 Mar 2008 19:34:20 +0000 Subject: [PATCH] experimental commit to save 1888 bytes from each tr_torrent --- libtransmission/torrent.c | 8 +++----- libtransmission/torrent.h | 19 +++++++++---------- libtransmission/transmission.h | 4 ++-- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 8b17a049b..cfe7a6dfa 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -554,9 +554,8 @@ tr_torrentStatCached( tr_torrent * tor ) { const time_t now = time( NULL ); - return now == tor->lastStatTime - ? &tor->stats[tor->statCur] - : tr_torrentStat( tor ); + return now == tor->lastStatTime ? &tor->stats + : tr_torrentStat( tor ); } const tr_stat * @@ -570,8 +569,7 @@ tr_torrentStat( tr_torrent * tor ) tor->lastStatTime = time( NULL ); tr_torrentRecheckCompleteness( tor ); - tor->statCur = !tor->statCur; - s = &tor->stats[tor->statCur]; + s = &tor->stats; s->error = tor->error; memcpy( s->errorString, tor->errorString, diff --git a/libtransmission/torrent.h b/libtransmission/torrent.h index de99720df..5d06e3051 100644 --- a/libtransmission/torrent.h +++ b/libtransmission/torrent.h @@ -111,14 +111,14 @@ tr_verify_state; struct tr_torrent { - tr_handle * handle; - tr_info info; + tr_handle * handle; + tr_info info; - tr_speedlimit uploadLimitMode; - tr_speedlimit downloadLimitMode; - struct tr_ratecontrol * upload; - struct tr_ratecontrol * download; - struct tr_ratecontrol * swarmspeed; + tr_speedlimit uploadLimitMode; + tr_speedlimit downloadLimitMode; + struct tr_ratecontrol * upload; + struct tr_ratecontrol * download; + struct tr_ratecontrol * swarmspeed; int error; char errorString[128]; @@ -163,16 +163,15 @@ struct tr_torrent tr_torrent_active_func * active_func; void * active_func_user_data; - unsigned int statCur : 1; unsigned int isRunning : 1; unsigned int isDeleting : 1; uint16_t maxConnectedPeers; - tr_verify_state verifyState; + tr_verify_state verifyState; time_t lastStatTime; - tr_stat stats[2]; + tr_stat stats; tr_torrent * next; }; diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index 5e094250f..8c7bc7298 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -780,12 +780,12 @@ struct tr_tracker_stat /* This is the unmodified string returned by the tracker in response * to the torrent's most recent scrape request. If no request was * sent or there was no response, this string is empty. */ - char scrapeResponse[512]; + char scrapeResponse[256]; /* The unmodified string returned by the tracker in response * to the torrent's most recent scrape request. If no request was * sent or there was no response, this string is empty. */ - char announceResponse[512]; + char announceResponse[256]; /* Time the most recent scrape request was sent, * or zero if one hasn't been sent yet. */