Re: [notmuch] [PATCH] fix compiler warnings

Subject: Re: [notmuch] [PATCH] fix compiler warnings

Date: Mon, 23 Nov 2009 04:22:07 +0100

To: djcb@djcbsoftware.nl, notmuch@notmuchmail org

Cc:

From: Carl Worth


On Sun, 22 Nov 2009 17:11:03 +0200, Dirk-Jan C. Binnema <djcb.bulk@gmail.com> wrote:
> 
> (hopefully this is the correct way to send patches...)

Looks just fine, and welcome to notmuch!

> With these minor changes, notmuch compiles warning-free with gcc 4.4.1

Could you resend these as separate patches, each patch fixing a single
type of warning? That would make it more clear what the code is doing.

> -    write(2, msg, sizeof(msg)-1);
> +    if (write(2, msg, sizeof(msg)-1) < 0) {
> +	    /* ignore...*/
> +    }

I don't like the gratuitous conditional here. It clutters the code and
make is less clear. If we're just trying to squelch a warning about an
unused return value from a function, then I think I'd rather see:

	ssize_t ignored;

        ignored = write (2, msg, sizeof (msg) - 1);

What do you think?

-Carl

Thread: