Changeset 9973


Ignore:
Timestamp:
Jan 20, 2010, 6:48:52 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #2775 "Saving some memory/storage" -- committed for 1.80

Location:
trunk/libtransmission
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/JSON_parser.c

    r9548 r9973  
    155155};
    156156
    157 static int ascii_class[128] = {
     157static const int ascii_class[128] = {
    158158/*
    159159    This array maps the 128 ASCII characters into character classes.
     
    244244
    245245
    246 static int state_transition_table[NR_STATES][NR_CLASSES] = {
     246static const int state_transition_table[NR_STATES][NR_CLASSES] = {
    247247/*
    248248    The state transition table takes the current state and the current symbol,
     
    524524#define IS_LOW_SURROGATE(uc)  (((uc) & 0xFC00) == 0xDC00)
    525525#define DECODE_SURROGATE_PAIR(hi,lo) ((((hi) & 0x3FF) << 10) + ((lo) & 0x3FF) + 0x10000)
    526 static unsigned char utf8_lead_bits[4] = { 0x00, 0xC0, 0xE0, 0xF0 };
     526static const unsigned char utf8_lead_bits[4] = { 0x00, 0xC0, 0xE0, 0xF0 };
    527527
    528528static int decode_unicode_char(JSON_parser jc)
  • trunk/libtransmission/bitfield.c

    r9868 r9973  
    191191    size_t           ret = 0;
    192192    const uint8_t *  it, *end;
    193     static const int trueBitCount[512] = {
     193    static const int trueBitCount[256] = {
    194194        0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
    195195        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
     
    199199        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
    200200        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
    201         3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8,
    202         1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
    203         2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
    204         2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
    205         3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8,
    206         2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
    207         3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8,
    208         3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8,
    209         4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8, 5, 6, 6, 7, 6, 7, 7, 8, 6, 7, 7, 8, 7, 8, 8, 9
     201        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
    210202    };
    211203
  • trunk/libtransmission/crypto.c

    r9965 r9973  
    376376                                 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    377377                                 "./";
    378     static const size_t salter_len = 64;
    379     static const size_t saltval_len = 8;
     378    const size_t salter_len = 64;
     379    const size_t saltval_len = 8;
    380380
    381381    size_t i;
  • trunk/libtransmission/makemeta.c

    r9903 r9973  
    9191bestPieceSize( uint64_t totalSize )
    9292{
    93     static const uint64_t GiB = 1073741824;
    94     static const uint64_t MiB = 1048576;
    95     static const uint64_t KiB = 1024;
     93    const uint64_t GiB = 1073741824;
     94    const uint64_t MiB = 1048576;
     95    const uint64_t KiB = 1024;
    9696
    9797    if( totalSize >=   ( 2 * GiB ) ) return 2 * MiB;
  • trunk/libtransmission/peer-io.c

    r9960 r9973  
    5858     *  (1500-72)/(42+1500) = 92.6070 %  802.1q, IPv6, ICP timestamps
    5959     */
    60     static const double assumed_payload_data_rate = 94.0;
     60    const double assumed_payload_data_rate = 94.0;
    6161
    6262    return (size_t)( d * ( 100.0 / assumed_payload_data_rate ) - d );
  • trunk/libtransmission/peer-mgr.c

    r9965 r9973  
    11211121            int keepCount = 0;
    11221122            int cancelCount = 0;
    1123             struct block_request * keep = tr_new( struct block_request, n );
    11241123            struct block_request * cancel = tr_new( struct block_request, n );
    11251124            const struct block_request * it;
     
    11271126
    11281127            for( it=t->requests, end=it+n; it!=end; ++it )
     1128            {
    11291129                if( it->sentAt <= too_old )
    11301130                    cancel[cancelCount++] = *it;
    11311131                else
    1132                     keep[keepCount++] = *it;
     1132                {
     1133                    if( it != &t->requests[keepCount] )
     1134                        t->requests[keepCount] = *it;
     1135                    keepCount++;
     1136                }
     1137            }
    11331138
    11341139            /* prune out the ones we aren't keeping */
    1135             tr_free( t->requests );
    1136             t->requests = keep;
    11371140            t->requestCount = keepCount;
    1138             t->requestAlloc = n;
    11391141
    11401142            /* send cancel messages for all the "cancel" ones */
  • trunk/libtransmission/stats.c

    r9965 r9973  
    2222***/
    2323
    24 static struct tr_session_stats STATS_INIT = { 0.0f, 0, 0, 0, 0, 0 };
     24static const struct tr_session_stats STATS_INIT = { 0.0f, 0, 0, 0, 0, 0 };
    2525
    2626/** @brief Opaque, per-session data structure for bandwidth use statistics */
Note: See TracChangeset for help on using the changeset viewer.