From a9ce7be96211e5fc5eccc8e7f44e76a3ef4c4eef Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 5 Oct 2020 13:15:28 +0200 Subject: [PATCH] streamline init of type & name in imap_parse_store() --- src/drv_imap.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/drv_imap.c b/src/drv_imap.c index f628eb3..8afb0c1 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -3333,19 +3333,21 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep ) if (!strcasecmp( "IMAPAccount", cfg->cmd )) { server = nfcalloc( sizeof(*server) ); - server->name = nfstrdup( cfg->val ); + name = server->name = nfstrdup( cfg->val ); *serverapp = server; serverapp = &server->next; store = NULL; *storep = NULL; + type = "IMAP account"; } else if (!strcasecmp( "IMAPStore", cfg->cmd )) { store = nfcalloc( sizeof(*store) ); store->gen.driver = &imap_driver; - store->gen.name = nfstrdup( cfg->val ); + name = store->gen.name = nfstrdup( cfg->val ); store->use_namespace = 1; *storep = &store->gen; memset( &sserver, 0, sizeof(sserver) ); server = &sserver; + type = "IMAP store"; } else return 0; @@ -3539,10 +3541,6 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep ) } acc_opt = 1; } - if (store) - type = "IMAP store", name = store->gen.name; - else - type = "IMAP account", name = server->name; if (!store || !store->server) { if (!server->sconf.tunnel && !server->sconf.host) { error( "%s '%s' has neither Tunnel nor Host\n", type, name );