From e2a16c6fc9058c0a2e8f59a86abce7bdb866ecd6 Mon Sep 17 00:00:00 2001 From: Guillaume Brogi Date: Mon, 6 Feb 2017 20:27:10 +0100 Subject: [PATCH] Use mutt_buffer_init instead of memset The mutt_buffer_init function does a memset to 0 of its argument, so use it instead of doing a manual memset. I noticed (thanks to @zmo) that a number of buffer used in hooks where initialised using memset instead of this dedicated function. This remedies to that. Fixes #369 --- hook.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hook.c b/hook.c index 45b48db69..c52196ce7 100644 --- a/hook.c +++ b/hook.c @@ -113,7 +113,7 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) } FREE (&pattern.data); - memset (&pattern, 0, sizeof (pattern)); + mutt_buffer_init(&pattern); pattern.data = safe_strdup (path); } #ifdef USE_COMPRESSED @@ -138,7 +138,7 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) strfcpy (tmp, pattern.data, sizeof (tmp)); mutt_check_simple (tmp, sizeof (tmp), DefaultHook); FREE (&pattern.data); - memset (&pattern, 0, sizeof (pattern)); + mutt_buffer_init(&pattern); pattern.data = safe_strdup (tmp); } @@ -147,7 +147,7 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) strfcpy (path, command.data, sizeof (path)); mutt_expand_path (path, sizeof (path)); FREE (&command.data); - memset (&command, 0, sizeof (command)); + mutt_buffer_init(&command); command.data = safe_strdup (path); } @@ -578,7 +578,7 @@ void mutt_timeout_hook (void) err.data = buf; err.dsize = sizeof (buf); - memset (&token, 0, sizeof (token)); + mutt_buffer_init(&token); for (hook = Hooks; hook; hook = hook->next) { @@ -613,7 +613,7 @@ void mutt_startup_shutdown_hook (int type) err.data = buf; err.dsize = sizeof (buf); - memset (&token, 0, sizeof (token)); + mutt_buffer_init(&token); for (hook = Hooks; hook; hook = hook->next) { -- 2.40.0