unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: Austin Clements <amdragon@MIT.EDU>, Tomi Ollila <tomi.ollila@iki.fi>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH 1/3] cli: add insert --must-index option
Date: Wed, 23 Oct 2013 21:05:33 -0300	[thread overview]
Message-ID: <87ob6fv8he.fsf@zancas.localnet> (raw)
In-Reply-To: <20131023193209.GF20337@mit.edu>

Austin Clements <amdragon@MIT.EDU> writes:

> And in libnotmuch, we would do something like
>
> notmuch_status_t
> notmuch_database_open (const char *path,
>                        notmuch_database_mode_t mode,
>                        const notmuch_options_t *options,
>                        notmuch_database_t **database)
> {
>     notmuch_option_t real_options = NOTMUCH_OPTIONS_INIT;
>     if (real_options.options_length < options.options_length)
>         return error;
>     memmove(&real_options, options, options.options_length);
>     // ...
> }
>

Does the C standard guarantee that if two structs have the same initial
set of members, that they are aligned in a compatible way? I suppose it
must work, but I'm still curious.

Yet another approach would be to pass in array of descriptors, something
like the command line argument parsing code does now.

libnotmuch_opt_desc_t options[] = {
  { LIBNOTMUCH_OPT_LOGHOOK, loghook },
  { 0, 0} 
}

I guess passing a (void *) as the second element of the pair?

Of course it's a bit more work to unpack this way.

  parent reply	other threads:[~2013-10-24  0:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-21  0:07 [PATCH 1/3] cli: add insert --must-index option Peter Wang
2013-07-21  0:07 ` [PATCH 2/3] man: document insert --must-index Peter Wang
2013-07-21  0:07 ` [PATCH 3/3] test: test " Peter Wang
2013-07-21  8:31 ` [PATCH 1/3] cli: add insert --must-index option Mark Walters
2013-07-27  5:15   ` Peter Wang
2013-09-10  8:06     ` Mark Walters
2013-09-11 14:13       ` Peter Wang
2013-10-10 10:41         ` David Bremner
2013-10-10 12:30           ` Tomi Ollila
2013-10-10 14:15             ` David Bremner
2013-10-23 19:05               ` Tomi Ollila
2013-10-23 19:32                 ` Austin Clements
2013-10-23 21:34                   ` Tomi Ollila
2013-10-24  0:05                   ` David Bremner [this message]
2013-10-24 10:19                     ` Tomi Ollila

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=87ob6fv8he.fsf@zancas.localnet \
    --to=david@tethera.net \
    --cc=amdragon@MIT.EDU \
    --cc=notmuch@notmuchmail.org \
    --cc=tomi.ollila@iki.fi \
    /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).