Fix breakage in GEODEBUG debug code.
LINE doesn't have an "m" field (anymore anyway). Also fix unportable
assumption that %x can print the result of pointer subtraction.
In passing, improve single_decode() in minor ways:
* Remove unnecessary leading-whitespace skip (strtod does that already).
* Make GEODEBUG message more intelligible.
* Remove entirely-useless test to see if strtod returned a silly pointer.
* Don't bother computing trailing-whitespace skip unless caller wants
an ending pointer.
This has been broken since 261c7d4b65
.
Although it's only debug code, might as well fix the 9.4 branch too.
This commit is contained in:
parent
91fa7b4719
commit
778d498c7d
|
@ -128,19 +128,19 @@ single_decode(char *str, float8 *x, char **s)
|
||||||
if (!PointerIsValid(str))
|
if (!PointerIsValid(str))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
while (isspace((unsigned char) *str))
|
|
||||||
str++;
|
|
||||||
*x = strtod(str, &cp);
|
*x = strtod(str, &cp);
|
||||||
|
|
||||||
#ifdef GEODEBUG
|
#ifdef GEODEBUG
|
||||||
printf("single_decode- (%x) try decoding %s to %g\n", (cp - str), str, *x);
|
printf("single_decode- decoded first %d chars of \"%s\" to %g\n",
|
||||||
|
(int) (cp - str), str, *x);
|
||||||
#endif
|
#endif
|
||||||
if (cp <= str)
|
|
||||||
return FALSE;
|
|
||||||
while (isspace((unsigned char) *cp))
|
|
||||||
cp++;
|
|
||||||
|
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
|
{
|
||||||
|
while (isspace((unsigned char) *cp))
|
||||||
|
cp++;
|
||||||
*s = cp;
|
*s = cp;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} /* single_decode() */
|
} /* single_decode() */
|
||||||
|
@ -2901,8 +2901,8 @@ close_ps(PG_FUNCTION_ARGS)
|
||||||
result = point_copy(&lseg->p[!yh]); /* below the lseg, take lower
|
result = point_copy(&lseg->p[!yh]); /* below the lseg, take lower
|
||||||
* end pt */
|
* end pt */
|
||||||
#ifdef GEODEBUG
|
#ifdef GEODEBUG
|
||||||
printf("close_ps below: tmp A %f B %f C %f m %f\n",
|
printf("close_ps below: tmp A %f B %f C %f\n",
|
||||||
tmp->A, tmp->B, tmp->C, tmp->m);
|
tmp->A, tmp->B, tmp->C);
|
||||||
#endif
|
#endif
|
||||||
PG_RETURN_POINT_P(result);
|
PG_RETURN_POINT_P(result);
|
||||||
}
|
}
|
||||||
|
@ -2913,8 +2913,8 @@ close_ps(PG_FUNCTION_ARGS)
|
||||||
result = point_copy(&lseg->p[yh]); /* above the lseg, take higher
|
result = point_copy(&lseg->p[yh]); /* above the lseg, take higher
|
||||||
* end pt */
|
* end pt */
|
||||||
#ifdef GEODEBUG
|
#ifdef GEODEBUG
|
||||||
printf("close_ps above: tmp A %f B %f C %f m %f\n",
|
printf("close_ps above: tmp A %f B %f C %f\n",
|
||||||
tmp->A, tmp->B, tmp->C, tmp->m);
|
tmp->A, tmp->B, tmp->C);
|
||||||
#endif
|
#endif
|
||||||
PG_RETURN_POINT_P(result);
|
PG_RETURN_POINT_P(result);
|
||||||
}
|
}
|
||||||
|
@ -2925,8 +2925,8 @@ close_ps(PG_FUNCTION_ARGS)
|
||||||
*/
|
*/
|
||||||
tmp = line_construct_pm(pt, invm);
|
tmp = line_construct_pm(pt, invm);
|
||||||
#ifdef GEODEBUG
|
#ifdef GEODEBUG
|
||||||
printf("close_ps- tmp A %f B %f C %f m %f\n",
|
printf("close_ps- tmp A %f B %f C %f\n",
|
||||||
tmp->A, tmp->B, tmp->C, tmp->m);
|
tmp->A, tmp->B, tmp->C);
|
||||||
#endif
|
#endif
|
||||||
result = interpt_sl(lseg, tmp);
|
result = interpt_sl(lseg, tmp);
|
||||||
Assert(result != NULL);
|
Assert(result != NULL);
|
||||||
|
|
Loading…
Reference in New Issue