]> granicus.if.org Git - mutt/commitdiff
Convert $header_cache_pagesize to type DT_LNUM.
authorKevin McCarthy <kevin@8t8.us>
Thu, 27 Jun 2019 18:06:19 +0000 (11:06 -0700)
committerKevin McCarthy <kevin@8t8.us>
Thu, 27 Jun 2019 18:06:19 +0000 (11:06 -0700)
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.

globals.h
hcache.c
init.h

index f5c08a5caf1ff2362f73758f38d7a6bfb6eb24ef..4d508221581604fd97d2789c71a2c5d9ba10e798 100644 (file)
--- 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;
index 492d570111e10b84da3877ab1990fafb5828fab9..2f601102ff5d471cbbb1cebfbdfb465bcb25acb9 100644 (file)
--- 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 7d530ef5bad804559f69a4088010f248ed79d451..041806b185c3b5b99ef4dec48aa040cd005c3fd8 100644 (file)
--- 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,