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

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Fri Dec 9 11:59:59 PST 2011


On Fri, 9 Dec 2011 14:54:26 -0500, Austin Clements <amdragon at MIT.EDU> wrote:
> 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.
> 

If there are fields that are computed lazily (I just did not know it),
we can not make it const.


The patch looks good.  I think it can be pushed before the rest of the
patches are reviewed/ready.

Regards,
  Dmitry

> > 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