[PATCH v2 5/5] cli: lazily create the crypto gpg context only when needed

2012-05-18 Thread Daniel Kahn Gillmor
On 05/18/2012 03:45 PM, Jameson Graef Rollins wrote: > On Fri, May 18 2012, Austin Clements wrote: >> It's slightly awkward that it's the caller's responsibility to free >> this lazily constructed object. That should probably be documented. >> We could more carefully reference count it, but I thi

[PATCH v2 5/5] cli: lazily create the crypto gpg context only when needed

2012-05-18 Thread Austin Clements
Quoth Jameson Graef Rollins on May 18 at 10:32 am: > Move the creation of the crypto ctx into mime-node.c and create it > only when needed. This removes code duplication from notmuch-show and > notmuch-reply, and should speed up these functions considerably if the > crypto flags are provided but t

Re: [PATCH v2 5/5] cli: lazily create the crypto gpg context only when needed

2012-05-18 Thread Jameson Graef Rollins
On Fri, May 18 2012, Daniel Kahn Gillmor wrote: > You could provide a "destructor" function for notmuch_crypto_t, which > whoever is responsible for the struct would need to call when they are > ready to dispose of it. > > The destructor would just destroy any GMIME crypto contexts pointed to > by

[PATCH v2 5/5] cli: lazily create the crypto gpg context only when needed

2012-05-18 Thread Jameson Graef Rollins
On Fri, May 18 2012, Daniel Kahn Gillmor wrote: > You could provide a "destructor" function for notmuch_crypto_t, which > whoever is responsible for the struct would need to call when they are > ready to dispose of it. > > The destructor would just destroy any GMIME crypto contexts pointed to > by

Re: [PATCH v2 5/5] cli: lazily create the crypto gpg context only when needed

2012-05-18 Thread Daniel Kahn Gillmor
On 05/18/2012 03:45 PM, Jameson Graef Rollins wrote: > On Fri, May 18 2012, Austin Clements wrote: >> It's slightly awkward that it's the caller's responsibility to free >> this lazily constructed object. That should probably be documented. >> We could more carefully reference count it, but I thi

Re: [PATCH v2 5/5] cli: lazily create the crypto gpg context only when needed

2012-05-18 Thread Jameson Graef Rollins
On Fri, May 18 2012, Austin Clements wrote: >> +/* Lazily create the gpgctx if it's needed and hasn't been initialized >> yet */ >> +if ((GMIME_IS_MULTIPART_ENCRYPTED (part) || GMIME_IS_MULTIPART_SIGNED >> (part)) >> +&& (node->ctx->crypto->verify || node->ctx->crypto->decrypt)) { >>

[PATCH v2 5/5] cli: lazily create the crypto gpg context only when needed

2012-05-18 Thread Jameson Graef Rollins
On Fri, May 18 2012, Austin Clements wrote: >> +/* Lazily create the gpgctx if it's needed and hasn't been initialized >> yet */ >> +if ((GMIME_IS_MULTIPART_ENCRYPTED (part) || GMIME_IS_MULTIPART_SIGNED >> (part)) >> +&& (node->ctx->crypto->verify || node->ctx->crypto->decrypt)) { >>

Re: [PATCH v2 5/5] cli: lazily create the crypto gpg context only when needed

2012-05-18 Thread Austin Clements
Quoth Jameson Graef Rollins on May 18 at 10:32 am: > Move the creation of the crypto ctx into mime-node.c and create it > only when needed. This removes code duplication from notmuch-show and > notmuch-reply, and should speed up these functions considerably if the > crypto flags are provided but t

[PATCH v2 5/5] cli: lazily create the crypto gpg context only when needed

2012-05-18 Thread Jameson Graef Rollins
Move the creation of the crypto ctx into mime-node.c and create it only when needed. This removes code duplication from notmuch-show and notmuch-reply, and should speed up these functions considerably if the crypto flags are provided but the messages don't have any cryptographic parts. --- mime-n

[PATCH v2 5/5] cli: lazily create the crypto gpg context only when needed

2012-05-18 Thread Jameson Graef Rollins
Move the creation of the crypto ctx into mime-node.c and create it only when needed. This removes code duplication from notmuch-show and notmuch-reply, and should speed up these functions considerably if the crypto flags are provided but the messages don't have any cryptographic parts. --- mime-n