From: Kevin McCarthy Date: Thu, 27 Jun 2019 18:06:19 +0000 (-0700) Subject: Convert $header_cache_pagesize to type DT_LNUM. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4c728278;p=mutt Convert $header_cache_pagesize to type DT_LNUM. Prior to commit 4bc76c2f there was no LNUM type, and so the workaround was to store it as a string, converting in the hcache_open_gdbm() call. This will not affect the user interface or config file, because DT_NUM and DT_LNUM read in a string from the config file and convert to a number. Quotes are used for escaping style, not passed through to the variable setter. So essentially this simply moves the conversion to parse_set(), and provides feedback for a non-numeric type immediately. --- diff --git a/globals.h b/globals.h index f5c08a5c..4d508221 100644 --- a/globals.h +++ b/globals.h @@ -79,7 +79,7 @@ WHERE char *MessageCachedir; #if USE_HCACHE WHERE char *HeaderCache; #if HAVE_GDBM || HAVE_DB4 -WHERE char *HeaderCachePageSize; +WHERE long HeaderCachePageSize; #endif /* HAVE_GDBM || HAVE_DB4 */ #endif /* USE_HCACHE */ WHERE char *MarkMacroPrefix; diff --git a/hcache.c b/hcache.c index 492d5701..2f601102 100644 --- a/hcache.c +++ b/hcache.c @@ -1188,7 +1188,8 @@ hcache_open_gdbm (struct header_cache* h, const char* path) { int pagesize; - if (mutt_atoi (HeaderCachePageSize, &pagesize) < 0 || pagesize <= 0) + pagesize = HeaderCachePageSize; + if (pagesize <= 0) pagesize = 16384; h->db = gdbm_open((char *) path, pagesize, GDBM_WRCREAT, 00600, NULL); diff --git a/init.h b/init.h index 7d530ef5..041806b1 100644 --- a/init.h +++ b/init.h @@ -1167,7 +1167,7 @@ struct option_t MuttVars[] = { */ #endif /* HAVE_QDBM */ #if defined(HAVE_GDBM) || defined(HAVE_DB4) - { "header_cache_pagesize", DT_STR, R_NONE, {.p=&HeaderCachePageSize}, {.p="16384"} }, + { "header_cache_pagesize", DT_LNUM, R_NONE, {.p=&HeaderCachePageSize}, {.l=16384} }, /* ** .pp ** When mutt is compiled with either gdbm or bdb4 as the header cache backend,