Ignore:
Timestamp:
Dec 29, 2008, 6:10:07 PM (12 years ago)
Author:
charles
Message:

(trunk libT) avoid some unnecessary memory fragmentation... for composited objects that have a tr_publisher, contain the it directly rather than a pointer to one allocated elsewhere on the heap.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/publish.c

    r7404 r7528  
    2222};
    2323
    24 struct tr_publisher_s
    25 {
    26     tr_list *  list;
    27 };
    28 
    29 tr_publisher_t*
    30 tr_publisherNew( void )
    31 {
    32     return tr_new0( tr_publisher_t, 1 );
    33 }
     24const tr_publisher TR_PUBLISHER_INIT = { NULL };
    3425
    3526void
    36 tr_publisherFree( tr_publisher_t ** p )
     27tr_publisherDestruct( tr_publisher * p )
    3728{
    38     assert( p );
    39     assert( *p );
    40 
    41     tr_list_free( &( *p )->list, NULL );
    42     tr_free( *p );
    43     *p = NULL;
     29    tr_list_free( &p->list, NULL );
    4430}
    4531
    4632tr_publisher_tag
    47 tr_publisherSubscribe( tr_publisher_t * p,
    48                        tr_delivery_func func,
    49                        void *           user_data )
     33tr_publisherSubscribe( tr_publisher    * p,
     34                       tr_delivery_func   func,
     35                       void *             user_data )
    5036{
    5137    struct tr_publisher_node * node = tr_new( struct tr_publisher_node, 1 );
     
    5844
    5945void
    60 tr_publisherUnsubscribe( tr_publisher_t * p,
     46tr_publisherUnsubscribe( tr_publisher * p,
    6147                         tr_publisher_tag tag )
    6248{
     
    6652
    6753void
    68 tr_publisherPublish( tr_publisher_t * p,
     54tr_publisherPublish( tr_publisher * p,
    6955                     void *           source,
    7056                     void *           event )
Note: See TracChangeset for help on using the changeset viewer.