preallocate a couple of dictionaries to the right size before using them.

This commit is contained in:
Jordan Lee 2012-12-09 21:28:20 +00:00
parent 0846d3f2ab
commit 9ddd7e0166
2 changed files with 3 additions and 1 deletions

View File

@ -77,6 +77,8 @@ tr_prefs_init_defaults (tr_benc * d)
if (!str)
str = tr_getDefaultDownloadDir ();
tr_bencDictReserve (d, 29);
tr_bencDictAddStr (d, PREF_KEY_DIR_WATCH, str);
tr_bencDictAddBool (d, PREF_KEY_DIR_WATCH_ENABLED, FALSE);

View File

@ -307,7 +307,7 @@ tr_sessionGetDefaultSettings (tr_benc * d)
{
assert (tr_bencIsDict (d));
tr_bencDictReserve (d, 60);
tr_bencDictReserve (d, 62);
tr_bencDictAddBool (d, TR_PREFS_KEY_BLOCKLIST_ENABLED, false);
tr_bencDictAddStr (d, TR_PREFS_KEY_BLOCKLIST_URL, "http://www.example.com/blocklist");
tr_bencDictAddInt (d, TR_PREFS_KEY_MAX_CACHE_SIZE_MB, DEFAULT_CACHE_SIZE_MB);