Re: [PATCH v3 01/20] cli: add stub for insert command

Subject: Re: [PATCH v3 01/20] cli: add stub for insert command

Date: Wed, 23 Jan 2013 10:26:31 +0200

To: Peter Wang, Jani Nikula

Cc: notmuch@notmuchmail.org

From: Tomi Ollila


On Wed, Jan 23 2013, Peter Wang <novalazy@gmail.com> wrote:

> On Tue, 22 Jan 2013 23:45:43 +0200, Jani Nikula <jani@nikula.org> wrote:
>
>> > +/* Copy the contents of standard input (fdin) into fdout. */
>> > +static notmuch_bool_t
>> > +copy_stdin (int fdin, int fdout)
>> 
>> The comment and the function name imply the function has something to do
>> with stdin, while it only cares about file descriptors.
>
> Tomi pointed out that the error message refers to standard input.

Was that me or some other Tomi ;)... Nevertheless the function here called
'copy_stdin' copies fdin to fdout, whatever the file descriptors are,
it doesn't enforce fdin to be fd 0 (default stdin).
I.e. the function name should be more generic (or then drop fdin argument --
should better name then be 'copy_from_stdin' or copy_stdin_to.. or
copy_[from_]stdin_to_some_magic_fd -- ok, no more bikeshedding now >;)).


> Peter

Tomi

Thread: