[PATCH 1/4] show: Pass notmuch_message_t instead of path to show_message_body.

Austin Clements amdragon at MIT.EDU
Fri Dec 9 11:54:26 PST 2011


Quoth Dmitry Kurochkin on Dec 09 at 11:05 pm:
> On Sun,  4 Dec 2011 14:31:37 -0500, Austin Clements <amdragon at MIT.EDU> wrote:
> >  }
> >  
> >  notmuch_status_t
> > -show_message_body (const char *filename,
> > +show_message_body (notmuch_message_t *message,
> >  		   const notmuch_show_format_t *format,
> >  		   notmuch_show_params_t *params)
> 
> Is show_message_body() (or functions that it calls/would call) supposed
> to modify the message structure?  If not, we should make it const.

That would be nice, but lack of const in libnotmuch makes it difficult
to do this (for example, notmuch_message_get_filename, which
show_message_body calls, takes a non-const notmuch_message_t *).

OTOH, since functions like notmuch_message_get_filename lazily compute
fields of notmuch_message_t and C has no equivalent of C++'s mutable,
it's not clear making the message const is even the right thing to do.

> I would also make all pointers constant (i.e. const notmuch_message_t
> *const message), but I can not insist since it is not common in notmuch.
> 
> Regards,
>   Dmitry


More information about the notmuch mailing list