Ignore:
Timestamp:
Apr 6, 2011, 11:27:11 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) more heap pruning: avoid four unnecessary malloc() + free() calls per tr_peer.

This commit also changes tr_recentHistory from being a general-purpose tool to being a little more hardcoded for the only purpose it's used, in tr_peerMgr. If its files (history.[ch]) don't find any other "customers" in libtransmission, eventually it should be demoted to being a private helper class inside of peer-mgr.c and have the history.[ch] files removed from the build.

File:
1 edited

Legend:

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

    r12013 r12328  
    11#include <stdio.h>
     2#include <string.h> /* memset() */
    23
    34#include "transmission.h"
     
    3536    tr_recentHistory h;
    3637
    37     tr_historyConstruct( &h, 60, 10 );
     38    memset( &h, 0, sizeof( tr_recentHistory ) );
     39
    3840    tr_historyAdd( &h, 10000, 1 );
    3941    check( (int)tr_historyGet( &h, 12000, 1000 ) == 0 )
     
    4547    check( (int)tr_historyGet( &h, 22000, 15000 ) == 2 )
    4648    check( (int)tr_historyGet( &h, 22000, 20000 ) == 2 )
    47     tr_historyDestruct( &h );
    4849
    4950    return 0;
Note: See TracChangeset for help on using the changeset viewer.