From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1377F431E64 for ; Mon, 30 Jan 2012 02:31:27 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0h68VCfmcbNo for ; Mon, 30 Jan 2012 02:31:26 -0800 (PST) Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66]) by olra.theworths.org (Postfix) with ESMTP id 04FA6431FBC for ; Mon, 30 Jan 2012 02:31:25 -0800 (PST) Received: by guru.guru-group.fi (Postfix, from userid 501) id 698A068056; Mon, 30 Jan 2012 12:31:28 +0200 (EET) From: Tomi Ollila To: notmuch@notmuchmail.org Subject: [PATCH] moved _config_(get|set)_list () functions earlyer in the file Date: Mon, 30 Jan 2012 12:31:25 +0200 Message-Id: <1327919485-15027-1-git-send-email-tomi.ollila@iki.fi> X-Mailer: git-send-email 1.7.6.1 In-Reply-To: <4F22EA91.4020006@cs.rpi.edu> References: <4F22EA91.4020006@cs.rpi.edu> Cc: Tomi Ollila X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2012 10:31:27 -0000 Moved static functions _config_get_list () and _config_set_list () closer to the beginning of file so that their definition is known (without adding forward declarations) in upcoming changes. --- This addresses Ethan's comments. Thanks. s/_notmuch_/_config_/ and changed 'in further work' to 'in upcoming changes' -- 'changes' being more generic that 'patches'. notmuch-config.c | 84 +++++++++++++++++++++++++++--------------------------- 1 files changed, 42 insertions(+), 42 deletions(-) diff --git a/notmuch-config.c b/notmuch-config.c index 0ded6d7..a124e34 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -467,6 +467,48 @@ notmuch_config_save (notmuch_config_t *config) return 0; } +static const char ** +_config_get_list (notmuch_config_t *config, + const char *section, const char *key, + const char ***outlist, size_t *list_length, size_t *ret_length) +{ + assert(outlist); + + if (*outlist == NULL) { + + char **inlist = g_key_file_get_string_list (config->key_file, + section, key, list_length, NULL); + if (inlist) { + unsigned int i; + + *outlist = talloc_size (config, sizeof (char *) * (*list_length + 1)); + + for (i = 0; i < *list_length; i++) + (*outlist)[i] = talloc_strdup (*outlist, inlist[i]); + + (*outlist)[i] = NULL; + + g_strfreev (inlist); + } + } + + if (ret_length) + *ret_length = *list_length; + + return *outlist; +} + +static void +_config_set_list (notmuch_config_t *config, + const char *group, const char *name, + const char *list[], + size_t length, const char ***config_var ) +{ + g_key_file_set_string_list (config->key_file, group, name, list, length); + talloc_free (*config_var); + *config_var = NULL; +} + const char * notmuch_config_get_database_path (notmuch_config_t *config) { @@ -551,37 +593,6 @@ notmuch_config_set_user_primary_email (notmuch_config_t *config, config->user_primary_email = NULL; } -static const char ** -_config_get_list (notmuch_config_t *config, - const char *section, const char *key, - const char ***outlist, size_t *list_length, size_t *ret_length) -{ - assert(outlist); - - if (*outlist == NULL) { - - char **inlist = g_key_file_get_string_list (config->key_file, - section, key, list_length, NULL); - if (inlist) { - unsigned int i; - - *outlist = talloc_size (config, sizeof (char *) * (*list_length + 1)); - - for (i = 0; i < *list_length; i++) - (*outlist)[i] = talloc_strdup (*outlist, inlist[i]); - - (*outlist)[i] = NULL; - - g_strfreev (inlist); - } - } - - if (ret_length) - *ret_length = *list_length; - - return *outlist; -} - const char ** notmuch_config_get_user_other_email (notmuch_config_t *config, size_t *length) { @@ -598,17 +609,6 @@ notmuch_config_get_new_tags (notmuch_config_t *config, size_t *length) &(config->new_tags_length), length); } -static void -_config_set_list (notmuch_config_t *config, - const char *group, const char *name, - const char *list[], - size_t length, const char ***config_var ) -{ - g_key_file_set_string_list (config->key_file, group, name, list, length); - talloc_free (*config_var); - *config_var = NULL; -} - void notmuch_config_set_user_other_email (notmuch_config_t *config, const char *list[], -- 1.7.8.2