[PATCH v2 06/10] cli: refactor insert

2014-09-16 Thread David Bremner
Peter Wang writes: > On Sat, 05 Jul 2014 10:18:05 -0300, David Bremner > wrote: >> Peter Wang writes: >> >> > -cleanup_path = tmppath; >> > - >> > -if (! copy_stdin (fdin, fdout)) >> > - goto FAIL; >> > +if (! copy_stdin (fdin, fdout)) { >> > + close (fdout); >> > + unlink (tmp

Re: [PATCH v2 06/10] cli: refactor insert

2014-09-16 Thread David Bremner
Peter Wang writes: > On Sat, 05 Jul 2014 10:18:05 -0300, David Bremner wrote: >> Peter Wang writes: >> >> > -cleanup_path = tmppath; >> > - >> > -if (! copy_stdin (fdin, fdout)) >> > - goto FAIL; >> > +if (! copy_stdin (fdin, fdout)) { >> > + close (fdout); >> > + unlink (tmppat

[PATCH v2 06/10] cli: refactor insert

2014-07-08 Thread David Bremner
Peter Wang writes: >> Is there a good reason to use TRUE and FALSE for return values rather >> than EXIT_SUCCESS and EXIT_FAILURE? It seems like the latter would be >> overall slightly simpler in notmuch_insert_command. > > Not sure what you have in mind. I think CLI exit codes should be > confi

Re: [PATCH v2 06/10] cli: refactor insert

2014-07-08 Thread David Bremner
Peter Wang writes: >> Is there a good reason to use TRUE and FALSE for return values rather >> than EXIT_SUCCESS and EXIT_FAILURE? It seems like the latter would be >> overall slightly simpler in notmuch_insert_command. > > Not sure what you have in mind. I think CLI exit codes should be > confi

[PATCH v2 06/10] cli: refactor insert

2014-07-06 Thread Peter Wang
On Sat, 05 Jul 2014 10:18:05 -0300, David Bremner wrote: > Peter Wang writes: > > > -cleanup_path = tmppath; > > - > > -if (! copy_stdin (fdin, fdout)) > > - goto FAIL; > > +if (! copy_stdin (fdin, fdout)) { > > + close (fdout); > > + unlink (tmppath); > > + return FALSE; > >

Re: [PATCH v2 06/10] cli: refactor insert

2014-07-05 Thread Peter Wang
On Sat, 05 Jul 2014 10:18:05 -0300, David Bremner wrote: > Peter Wang writes: > > > -cleanup_path = tmppath; > > - > > -if (! copy_stdin (fdin, fdout)) > > - goto FAIL; > > +if (! copy_stdin (fdin, fdout)) { > > + close (fdout); > > + unlink (tmppath); > > + return FALSE; > >

[PATCH v2 06/10] cli: refactor insert

2014-07-05 Thread David Bremner
Peter Wang writes: > -cleanup_path = tmppath; > - > -if (! copy_stdin (fdin, fdout)) > - goto FAIL; > +if (! copy_stdin (fdin, fdout)) { > + close (fdout); > + unlink (tmppath); > + return FALSE; > +} I'm not completely convinced by replacement of the "goto FAIL"

Re: [PATCH v2 06/10] cli: refactor insert

2014-07-05 Thread David Bremner
Peter Wang writes: > -cleanup_path = tmppath; > - > -if (! copy_stdin (fdin, fdout)) > - goto FAIL; > +if (! copy_stdin (fdin, fdout)) { > + close (fdout); > + unlink (tmppath); > + return FALSE; > +} I'm not completely convinced by replacement of the "goto FAIL"

[PATCH v2 06/10] cli: refactor insert

2014-04-16 Thread Peter Wang
Change insert_message into write_message and move its responsibilities for indexing the message into the main function, to simplify the control flow. --- notmuch-insert.c | 63 +++- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/

[PATCH v2 06/10] cli: refactor insert

2014-04-16 Thread Peter Wang
Change insert_message into write_message and move its responsibilities for indexing the message into the main function, to simplify the control flow. --- notmuch-insert.c | 63 +++- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/