Re: minor smgr code cleanup - Mailing list pgsql-patches

From Neil Conway
Subject Re: minor smgr code cleanup
Date
Msg-id 87fzetoshv.fsf@mailbox.samurai.com
Whole thread Raw
In response to Re: minor smgr code cleanup  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane <tgl@sss.pgh.pa.us> writes:
> This change is actually wrong (backwards), no?  You want a true result
> on equality.

*sigh*, I'm an idiot. Thanks for catching my mistake!

> Pretending that the result of strcmp is a bool is a type pun, and
> one that can rise up to bite you.  In the case at hand, strncmp is
> allowed to return (say) 256 to indicate a nonzero result --- which
> would be lost when the value is squeezed into a bool (char).  See
> the archives; we've had at least one bug of this ilk.

Good point, and good to know. I just left the code as it previously
was (but updated the comment), and applied the patch.

Thanks again.

-Neil


pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: remove 'noversion' from standalone backend
Next
From: Tom Lane
Date:
Subject: Re: remove 'noversion' from standalone backend