Ignore:
Timestamp:
Jul 20, 2013, 3:37:13 PM (9 years ago)
Author:
jordan
Message:

add tr_sessionGetTorrents(), a private utility to avoid code duplication in libtransmission

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r14125 r14130  
    33913391queueIsSequenced (tr_session * session)
    33923392{
    3393   int i ;
    3394   int n ;
    3395   bool is_sequenced = true;
     3393  int i;
     3394  int n;
     3395  bool is_sequenced;
    33963396  tr_torrent * tor;
    3397   tr_torrent ** tmp = tr_new (tr_torrent *, session->torrentCount);
    3398 
    3399   /* get all the torrents */
     3397  tr_torrent ** torrents;
     3398
    34003399  n = 0;
    3401   tor = NULL;
    3402   while ((tor = tr_torrentNext (session, tor)))
    3403     tmp[n++] = tor;
    3404 
    3405   /* sort them by position */
    3406   qsort (tmp, n, sizeof (tr_torrent *), compareTorrentByQueuePosition);
     3400  torrents = tr_sessionGetTorrents (session, &n);
     3401  qsort (torrents, n, sizeof (tr_torrent *), compareTorrentByQueuePosition);
    34073402
    34083403#if 0
     
    34143409
    34153410  /* test them */
     3411  is_sequenced = true;
    34163412  for (i=0; is_sequenced && i<n; ++i)
    3417     if (tmp[i]->queuePosition != i)
     3413    if (torrents[i]->queuePosition != i)
    34183414      is_sequenced = false;
    34193415
    3420   tr_free (tmp);
     3416  tr_free (torrents);
    34213417  return is_sequenced;
    34223418}
Note: See TracChangeset for help on using the changeset viewer.