[PATCH 17/25] avoid segfault when calling sanitize_string() on NULL

Carl Worth cworth at cworth.org
Fri Jun 3 12:24:23 PDT 2011


On Sat, 28 May 2011 14:51:52 -0700, Jameson Graef Rollins <jrollins at finestructure.net> wrote:
> +    if (NULL == str)
> +	return NULL;

I haven't been blocking patches because of this, but can I please ask
everyone to not use the above style?

I understand that the above style is intended to generate a compiler
error in the case of the programmer mistyping '=' where '==' was
intended.

But I just can't stand this style.

It looks so unnatural to me to read "if some_value is some_variable"
instead of the natural "if some_variable is some_value".

Also, gcc is kind enough to warn ("suggest parentheses around assignment
used as truth value") in the case of "if (str = NULL)" anyway, so
there's no actual benefit to the unnatural style.

I really do want our code to be readable, and I think that little things
do make a difference.

Thanks for your attention, (and thanks for your patience if I seem off
my rocker).

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110603/97f8f7e7/attachment.pgp>


More information about the notmuch mailing list