unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: Felipe Contreras <felipe.contreras@gmail.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH 3/3] ruby: add db.{set,get}_config
Date: Mon, 29 May 2023 08:32:29 -0300	[thread overview]
Message-ID: <87353f1igi.fsf@tethera.net> (raw)
In-Reply-To: <20230331205338.174779-4-felipe.contreras@gmail.com>

Felipe Contreras <felipe.contreras@gmail.com> writes:

> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  bindings/ruby/database.c | 45 ++++++++++++++++++++++++++++++++++++++++
>  bindings/ruby/defs.h     |  6 ++++++
>  bindings/ruby/init.c     |  2 ++
>  3 files changed, 53 insertions(+)

So, usual request about tests...


> +/*
> + * call-seq: DB.get_config(key) => String
> + *
> + * Retrieves a configuration key.
> + */
> +VALUE
> +notmuch_rb_database_get_config (VALUE self, VALUE key)
> +{
> +    notmuch_database_t *db;
> +    notmuch_status_t ret;
> +    char *value;
> +    VALUE rvalue;
> +
> +    Data_Get_Notmuch_Database (self, db);
> +
> +    ret = notmuch_database_get_config (db, RSTRING_PTR (key), &value);
> +    notmuch_rb_status_raise (ret);
> +
> +    rvalue = rb_str_new2 (value);
> +    free (value);
> +
> +    return rvalue;
> +}

Just to be clear, there are (confusingly) two APIs for reading
configuration. The one you are binding is in some sense the most low
level and general but it might be good to encourage use of
notmuch_config_get, since the use of an enum makes it less error-prone
for well-known configuration values.

      reply	other threads:[~2023-05-29 11:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31 20:53 [PATCH 0/3] ruby: api updates Felipe Contreras
2023-03-31 20:53 ` [PATCH 1/3] ruby: add database.revision Felipe Contreras
2023-05-29 11:15   ` David Bremner
2023-03-31 20:53 ` [PATCH 2/3] ruby: add directory.delete Felipe Contreras
2023-05-29 11:24   ` David Bremner
2023-03-31 20:53 ` [PATCH 3/3] ruby: add db.{set,get}_config Felipe Contreras
2023-05-29 11:32   ` David Bremner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87353f1igi.fsf@tethera.net \
    --to=david@tethera.net \
    --cc=felipe.contreras@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).