Re: minor smgr code cleanup

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: minor smgr code cleanup
Date: 2004-01-06 18:13:16
Message-ID: 87fzetoshv.fsf@mailbox.samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2004-01-06 18:28:31 Re: [PATCHES] remove 'noversion' from standalone backend
Previous Message Neil Conway 2004-01-06 18:06:17 Re: remove 'noversion' from standalone backend