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.h

    r11709 r12013  
    2525 * to estimate the speed over the last N seconds.
    2626 */
    27 typedef struct tr_recentHistory tr_recentHistory;
     27
     28struct tr_history_slice
     29{
     30    unsigned int n;
     31    time_t date;
     32};
     33typedef struct tr_recentHistory
     34{
     35    /* these are PRIVATE IMPLEMENTATION details included for composition only.
     36     * Don't access these directly! */
     37    int newest;
     38    int sliceCount;
     39    unsigned int precision;
     40    struct tr_history_slice * slices;
     41}
     42tr_recentHistory;
    2843
    2944/**
    30  * @brief create a new tr_recentHistory object.
     45 * @brief construct a new tr_recentHistory object
    3146 * @param seconds how many seconds of history this object should remember
    3247 * @param precision how precise the history should be, in seconds
    3348 *        For a precision of 10 seconds and a history of 2 minutes, makes 12 bins.
    3449 */
    35 tr_recentHistory * tr_historyNew( unsigned int seconds, unsigned int precision );
     50void tr_historyConstruct( tr_recentHistory *, unsigned int seconds, unsigned int precision );
    3651
    37 /** @brief destroy an existing tr_recentHistory object. */
    38 void tr_historyFree( tr_recentHistory * );
     52/** @brief destruct an existing tr_recentHistory object. */
     53void tr_historyDestruct( tr_recentHistory * );
    3954
    4055/**
Note: See TracChangeset for help on using the changeset viewer.