Re: bool abuse in path_encode()

Lists: pgsql-hackers
From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: bool abuse in path_encode()
Date: 2013-07-07 01:12:33
Message-ID: 1373159553.17986.7.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

The function path_encode() in geo_ops.c takes an argument "bool closed",
to indicate an open or closed path --- but you can also pass -1 to
indicate "neither". I propose to change this to an enum to make the
code clearer and less weird.

Attachment Content-Type Size
path-encode-enum.patch text/x-patch 2.9 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bool abuse in path_encode()
Date: 2013-07-07 03:33:14
Message-ID: 3351.1373167994@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> The function path_encode() in geo_ops.c takes an argument "bool closed",
> to indicate an open or closed path --- but you can also pass -1 to
> indicate "neither".

Egad :-(.

> I propose to change this to an enum to make the
> code clearer and less weird.

Please change the "default" cases to be "case PATH_NONE", then.

regards, tom lane