Changeset 12435


Ignore:
Timestamp:
May 16, 2011, 7:11:21 AM (10 years ago)
Author:
jordan
Message:

(trunk libT) better r12434

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/session.c

    r12355 r12435  
    18821882                if(( tor = tr_torrentNew( ctor, NULL )))
    18831883                {
    1884                     tr_list_append( &list, tor );
     1884                    tr_list_prepend( &list, tor );
    18851885                    ++n;
    18861886                }
  • trunk/libtransmission/torrent.c

    r12434 r12435  
    870870
    871871    /* add the torrent to tr_session.torrentList */
    872     {
    873         tr_torrent * it = NULL;
    874         tr_torrent * last = NULL;
    875         while(( it = tr_torrentNext( session, it )))
    876             last = it;
    877 
    878         if( !last )
    879             session->torrentList = tor;
    880         else
    881             last->next = tor;
    882         ++session->torrentCount;
     872    ++session->torrentCount;
     873    if( session->torrentList == NULL )
     874        session->torrentList = tor;
     875    else {
     876        tr_torrent * it = session->torrentList;
     877        while( it->next != NULL )
     878            it = it->next;
     879        it->next = tor;
    883880    }
    884881
Note: See TracChangeset for help on using the changeset viewer.