aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/geo_ops.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2015-02-03 15:20:48 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2015-02-03 15:20:48 -0500
commit900679245de9d7f407dc72c34a5beb4124955f6f (patch)
treef25fcaa5c492355fdca57a82f1e6ddd9d6425a5c /src/backend/utils/adt/geo_ops.c
parentd0f83327d3739a45102fdd486947248c70e0249d (diff)
downloadpostgresql-900679245de9d7f407dc72c34a5beb4124955f6f.tar.gz
postgresql-900679245de9d7f407dc72c34a5beb4124955f6f.zip
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 261c7d4b653bc3e44c31fd456d94f292caa50d8f. Although it's only debug code, might as well fix the 9.4 branch too.
Diffstat (limited to 'src/backend/utils/adt/geo_ops.c')
-rw-r--r--src/backend/utils/adt/geo_ops.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c
index 54391fd7aba..6ef420d310e 100644
--- a/src/backend/utils/adt/geo_ops.c
+++ b/src/backend/utils/adt/geo_ops.c
@@ -127,19 +127,19 @@ single_decode(char *str, float8 *x, char **s)
if (!PointerIsValid(str))
return FALSE;
- while (isspace((unsigned char) *str))
- str++;
*x = strtod(str, &cp);
+
#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
- if (cp <= str)
- return FALSE;
- while (isspace((unsigned char) *cp))
- cp++;
if (s != NULL)
+ {
+ while (isspace((unsigned char) *cp))
+ cp++;
*s = cp;
+ }
return TRUE;
} /* single_decode() */
@@ -2857,8 +2857,8 @@ close_ps(PG_FUNCTION_ARGS)
result = point_copy(&lseg->p[!yh]); /* below the lseg, take lower
* end pt */
#ifdef GEODEBUG
- printf("close_ps below: tmp A %f B %f C %f m %f\n",
- tmp->A, tmp->B, tmp->C, tmp->m);
+ printf("close_ps below: tmp A %f B %f C %f\n",
+ tmp->A, tmp->B, tmp->C);
#endif
PG_RETURN_POINT_P(result);
}
@@ -2869,8 +2869,8 @@ close_ps(PG_FUNCTION_ARGS)
result = point_copy(&lseg->p[yh]); /* above the lseg, take higher
* end pt */
#ifdef GEODEBUG
- printf("close_ps above: tmp A %f B %f C %f m %f\n",
- tmp->A, tmp->B, tmp->C, tmp->m);
+ printf("close_ps above: tmp A %f B %f C %f\n",
+ tmp->A, tmp->B, tmp->C);
#endif
PG_RETURN_POINT_P(result);
}
@@ -2881,8 +2881,8 @@ close_ps(PG_FUNCTION_ARGS)
*/
tmp = line_construct_pm(pt, invm);
#ifdef GEODEBUG
- printf("close_ps- tmp A %f B %f C %f m %f\n",
- tmp->A, tmp->B, tmp->C, tmp->m);
+ printf("close_ps- tmp A %f B %f C %f\n",
+ tmp->A, tmp->B, tmp->C);
#endif
result = interpt_sl(lseg, tmp);
Assert(result != NULL);