Ignore:
Timestamp:
Feb 23, 2011, 6:01:16 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) #4051 "Use composition for the tr_history fields in tr_peer" -- fixed.

If we use composition on these objects we can save a handful of pointers per peer. This isn't a big deal, but it's an easy/safe change to do.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/history-test.c

    r10390 r12013  
    3333test1( void )
    3434{
    35     tr_recentHistory * h;
     35    tr_recentHistory h;
    3636
    37     h = tr_historyNew( 60, 10 );
    38     tr_historyAdd( h, 10000, 1 );
    39     check( (int)tr_historyGet( h, 12000, 1000 ) == 0 )
    40     check( (int)tr_historyGet( h, 12000, 3000 ) == 1 )
    41     check( (int)tr_historyGet( h, 12000, 5000 ) == 1 )
    42     tr_historyAdd( h, 20000, 1 );
    43     check( (int)tr_historyGet( h, 22000,  1000 ) == 0 )
    44     check( (int)tr_historyGet( h, 22000,  3000 ) == 1 )
    45     check( (int)tr_historyGet( h, 22000, 15000 ) == 2 )
    46     check( (int)tr_historyGet( h, 22000, 20000 ) == 2 )
    47     tr_historyFree( h );
     37    tr_historyConstruct( &h, 60, 10 );
     38    tr_historyAdd( &h, 10000, 1 );
     39    check( (int)tr_historyGet( &h, 12000, 1000 ) == 0 )
     40    check( (int)tr_historyGet( &h, 12000, 3000 ) == 1 )
     41    check( (int)tr_historyGet( &h, 12000, 5000 ) == 1 )
     42    tr_historyAdd( &h, 20000, 1 );
     43    check( (int)tr_historyGet( &h, 22000,  1000 ) == 0 )
     44    check( (int)tr_historyGet( &h, 22000,  3000 ) == 1 )
     45    check( (int)tr_historyGet( &h, 22000, 15000 ) == 2 )
     46    check( (int)tr_historyGet( &h, 22000, 20000 ) == 2 )
     47    tr_historyDestruct( &h );
    4848
    4949    return 0;
Note: See TracChangeset for help on using the changeset viewer.