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

This commit is contained in:
Jordan Lee
2013-07-20 15:37:13 +00:00
parent acb1fb80dd
commit fe79ad39bc
4 changed files with 38 additions and 24 deletions

View File

@@ -181,11 +181,7 @@ getTorrents (tr_session * session,
}
else /* all of them */
{
tr_torrent * tor = NULL;
const int n = tr_sessionCountTorrents (session);
torrents = tr_new0 (tr_torrent *, n);
while ((tor = tr_torrentNext (session, tor)))
torrents[torrentCount++] = tor;
torrents = tr_sessionGetTorrents (session, &torrentCount);
}
*setmeCount = torrentCount;