Tom Lane wrote:
> "Pedro M. Ferreira" <pfrazao@ualg.pt> writes:
>
>>Is it ok to remove #define P_MAXDIG DBL_DIG,
>>change P_MAXLEN to 2*(DBL_DIG+7)+1) and
>>remove the line 'static int digits8 = P_MAXDIG;' ?
>
> Perhaps P_MAXLEN now needs to be (2*(DBL_DIG+2+7)+1), considering
> that we'll allow extra_float_digits to be up to 2. What's it used for?
Yes. I guess so, because it is used in what I think is a memory
allocation function. P_MAXLEN is only used twice:
* 1st use in path_encode() (allmost all the geo *_out functions use
path_encode):
int size = npts * (P_MAXLEN + 3) + 2;
/* Check for integer overflow */
if ((size - 2) / npts != (P_MAXLEN + 3)) elog(ERROR, "Too many points requested");
* 2nd use in circle_out(PG_FUNCTION_ARGS):
result = palloc(3 * (P_MAXLEN + 1) + 3);
I will do the changes tomorrow and send in the appropriate diff's.
Regards,
Pedro