From cb57dd100675c801db281018c15e9d8ad713a3b7 Mon Sep 17 00:00:00 2001 From: Pietro Cerutti Date: Wed, 17 Apr 2019 09:29:31 +0000 Subject: [PATCH] Make buffer pool initialization lazy This fixes an issue in the startup sequence where a buffer is requested from the buffer pool before mutt_buffer_pool_init is called. The latter doubles up the number of buffers even though there are free ones. --- init.c | 1 - mutt/buffer.c | 8 -------- mutt/buffer.h | 1 - 3 files changed, 10 deletions(-) diff --git a/init.c b/init.c index 7824412fc..dc28ded02 100644 --- a/init.c +++ b/init.c @@ -3004,7 +3004,6 @@ int mutt_init(bool skip_sys_rc, struct ListHead *commands) TagFormats = mutt_hash_new(64, MUTT_HASH_NO_FLAGS); mutt_menu_init(); - mutt_buffer_pool_init(); snprintf(AttachmentMarker, sizeof(AttachmentMarker), "\033]9;%" PRIu64 "\a", // Escape mutt_rand64()); diff --git a/mutt/buffer.c b/mutt/buffer.c index d691f28ee..2d5f1b6fb 100644 --- a/mutt/buffer.c +++ b/mutt/buffer.c @@ -373,14 +373,6 @@ static void increase_buffer_pool(void) } } -/** - * mutt_buffer_pool_init - Initialise the Buffer pool - */ -void mutt_buffer_pool_init(void) -{ - increase_buffer_pool(); -} - /** * mutt_buffer_pool_free - Release the Buffer pool */ diff --git a/mutt/buffer.h b/mutt/buffer.h index 400de48e7..150ef5562 100644 --- a/mutt/buffer.h +++ b/mutt/buffer.h @@ -64,7 +64,6 @@ void mutt_buffer_strcpy_n (struct Buffer *buf, const char *s, size void mutt_buffer_pool_free (void); struct Buffer *mutt_buffer_pool_get (void); -void mutt_buffer_pool_init (void); void mutt_buffer_pool_release (struct Buffer **pbuf); #endif /* MUTT_LIB_BUFFER_H */ -- 2.40.0