Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 09A42431FAE for ; Thu, 26 Jan 2012 05:03:52 -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 NFuzuU1aQvQh for ; Thu, 26 Jan 2012 05:03:51 -0800 (PST) Received: from mail-qw0-f53.google.com (mail-qw0-f53.google.com [209.85.216.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id E23C3431FAF for ; Thu, 26 Jan 2012 05:03:50 -0800 (PST) Received: by qabg24 with SMTP id g24so544708qab.5 for ; Thu, 26 Jan 2012 05:03:50 -0800 (PST) Received: by 10.224.59.65 with SMTP id k1mr2319822qah.54.1327583030365; Thu, 26 Jan 2012 05:03:50 -0800 (PST) Received: from localhost (nikula.org. [92.243.24.172]) by mx.google.com with ESMTPS id gy6sm8465181qab.1.2012.01.26.05.03.48 (version=SSLv3 cipher=OTHER); Thu, 26 Jan 2012 05:03:49 -0800 (PST) From: Jani Nikula To: Tomi Ollila , notmuch@notmuchmail.org Subject: Re: [PATCH 1/2] moved _notmuch_get_list () and _notmuch_set_list () up in file In-Reply-To: <1327572718-13411-1-git-send-email-tomi.ollila@iki.fi> References: <8762g0sj6f.fsf@praet.org> <1327572718-13411-1-git-send-email-tomi.ollila@iki.fi> User-Agent: Notmuch/0.10.2+187~g43d4f26 (http://notmuchmail.org) Emacs/23.1.1 (i686-pc-linux-gnu) Date: Thu, 26 Jan 2012 13:03:46 +0000 Message-ID: <87sjj2ipjh.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Thu, 26 Jan 2012 13:03:52 -0000 On Thu, 26 Jan 2012 12:11:57 +0200, Tomi Ollila wrote: > Moved _notmuch_get_list () and _notmuch_set_list () to a location > in notmuch-config.c so that new functions that will be located > before the old location of those functions can also use these. Parse error. ;) You mean something along the lines of: "Move _notmuch_get_list () and _notmuch_set_list () earlier in the file to avoid forward declarations in further work. No functional changes." I'm sure native speakers can bikeshed that further. ;) BR, Jani. > --- > > This patch is independent of the next one (just required by it) > and can (should) be pushed early. > > 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.6.4 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch