experimental commit to save 1888 bytes from each tr_torrent
authorCharles Kerr <charles@transmissionbt.com>
Mon, 31 Mar 2008 19:34:20 +0000 (19:34 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Mon, 31 Mar 2008 19:34:20 +0000 (19:34 +0000)
libtransmission/torrent.c
libtransmission/torrent.h
libtransmission/transmission.h

index 8b17a049b81691fbd9d0dca4a904c95f44d68ade..cfe7a6dfaea999fad68e16b45589edff79a119df 100644 (file)
@@ -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,
index de99720dfa585dd92b0e093a1852640f0d049d42..5d06e3051200d8b139093782d4212765c6e8ef87 100644 (file)
@@ -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;
 };
index 5e094250f3cdbf2b01da5464efeda459c9bbe27b..8c7bc7298a8db3a364a06233268c79cc0b189013 100644 (file)
@@ -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. */