[PATCH 1/2] moved _notmuch_get_list () and _notmuch_set_list () up in file

Jani Nikula jani at nikula.org
Thu Jan 26 05:03:46 PST 2012


On Thu, 26 Jan 2012 12:11:57 +0200, Tomi Ollila <tomi.ollila at iki.fi> 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 at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list