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 E5DC7431E64 for ; Mon, 30 Jan 2012 07:07:40 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 yGP-6M15We7i for ; Mon, 30 Jan 2012 07:07:40 -0800 (PST) Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU [18.7.68.35]) by olra.theworths.org (Postfix) with ESMTP id 528DD431FBC for ; Mon, 30 Jan 2012 07:07:40 -0800 (PST) X-AuditID: 12074423-b7f9c6d0000008c3-90-4f26b23bd67f Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP id 1A.FC.02243.C32B62F4; Mon, 30 Jan 2012 10:07:40 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q0UF7dfH001398; Mon, 30 Jan 2012 10:07:39 -0500 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0UF7ZEo021512 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Mon, 30 Jan 2012 10:07:38 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1Rrsof-0001u3-Mx; Mon, 30 Jan 2012 10:06:45 -0500 Date: Mon, 30 Jan 2012 10:06:45 -0500 From: Austin Clements To: Tomi Ollila Subject: Re: [PATCH] moved _config_(get|set)_list () functions earlyer in the file Message-ID: <20120130150645.GR17991@mit.edu> References: <4F22EA91.4020006@cs.rpi.edu> <1327919485-15027-1-git-send-email-tomi.ollila@iki.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1327919485-15027-1-git-send-email-tomi.ollila@iki.fi> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkleLIzCtJLcpLzFFi42IRYrdT17XZpOZvMOcMq8X1mzOZLd6snMfq wORx+OtCFo9nq24xBzBFcdmkpOZklqUW6dslcGVsP/SMuWCKXMX+T78ZGxiniXcxcnJICJhI rL4zhRXCFpO4cG89WxcjF4eQwD5GiYtPp7KBJIQENjBKPDuZD5E4ySRxeukZqKoljBInH/Yw dTFycLAIqAIV8YI0sAloSGzbv5wRxBYRUJF40LYebAOzgLTEt9/NYOXCAiESLy/IgoR5BXQk Vj+8xwSxK0li1oNjTBBxQYmTM5+wQLRqSdz49xKsFWTM8n8cIGFOAWeJ1tlt7CC2KNCmKSe3 sU1gFJqFpHsWku5ZCN0LGJlXMcqm5Fbp5iZm5hSnJusWJyfm5aUW6Zrp5WaW6KWmlG5iBIe0 i/IOxj8HlQ4xCnAwKvHwBv1T9RdiTSwrrsw9xCjJwaQkyhu9Uc1fiC8pP6UyI7E4I76oNCe1 +BCjBAezkgjvm9VAOd6UxMqq1KJ8mJQ0B4uSOK+G1js/IYH0xJLU7NTUgtQimKwMB4eSBG86 yFDBotT01Iq0zJwShDQTByfIcB6g4TNBaniLCxJzizPTIfKnGBWlxHlLQRICIImM0jy4XljK ecUoDvSKMO9skCoeYLqC634FNJgJaPBzBlWQwSWJCCmpBkaj0ouaPm9+PTYQ0f1y3Lb9xxvL plROHctsCUWXi+VJ3q4ZbPdjxG9lrlIRsm3kCZjqbrC0bLb+1zPVyow2VXPrX6bd2nD0v0jC 95q3F7bv31h6Kt/T42WAhqn9PI9j/b9trv3qtahMOzk/RU3gtM15Bya1F35/GxcxG7EHPlzR G/Z5coK2nhJLcUaioRZzUXEiAL3j45cUAwAA Cc: notmuch@notmuchmail.org 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 15:07:41 -0000 s/earlyer/earlier/, but unless someone feels strongly about that, I don't think we need another version of this trivial patch. Quoth Tomi Ollila on Jan 30 at 12:31 pm: > 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[],