[notmuch] [PATCH] fix compiler warnings

Carl Worth cworth at cworth.org
Sun Nov 22 19:22:07 PST 2009


On Sun, 22 Nov 2009 17:11:03 +0200, Dirk-Jan C. Binnema <djcb.bulk at 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


More information about the notmuch mailing list