From: Vsevolod Stakhov Date: Sat, 9 Jan 2016 23:41:52 +0000 (+0000) Subject: Use constants instead of magic numbers X-Git-Tag: 1.1.0~82 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5a4566af6e715e15ea8dce6776cdc7b9bd03b5bf;p=rspamd.git Use constants instead of magic numbers --- diff --git a/src/libutil/sqlite_utils.c b/src/libutil/sqlite_utils.c index e1e6f7f76..76a708593 100644 --- a/src/libutil/sqlite_utils.c +++ b/src/libutil/sqlite_utils.c @@ -248,7 +248,8 @@ rspamd_sqlite3_wait (rspamd_mempool_t *pool, const gchar *lock) return TRUE; } - +#define RSPAMD_SQLITE_MMAP_LIMIT 268435456 +#define RSPAMD_SQLITE_CACHE_SIZE 262144 sqlite3 * rspamd_sqlite3_open_or_create (rspamd_mempool_t *pool, const gchar *path, const @@ -267,10 +268,12 @@ rspamd_sqlite3_open_or_create (rspamd_mempool_t *pool, const gchar *path, const foreign_keys[] = "PRAGMA foreign_keys=\"ON\";", - enable_mmap[] = "PRAGMA mmap_size=268435456;", + enable_mmap[] = "PRAGMA mmap_size=" + G_STRINGIFY(RSPAMD_SQLITE_MMAP_LIMIT) ";", other_pragmas[] = "PRAGMA read_uncommitted=\"ON\";" - "PRAGMA cache_size=262144"; + "PRAGMA cache_size=" + G_STRINGIFY(RSPAMD_SQLITE_CACHE_SIZE) ";"; gboolean create = FALSE, has_lock = FALSE; flags = SQLITE_OPEN_READWRITE;