Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9006792

Browse files
committed
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 261c7d4. Although it's only debug code, might as well fix the 9.4 branch too.
1 parent d0f8332 commit 9006792

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/backend/utils/adt/geo_ops.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,19 @@ single_decode(char *str, float8 *x, char **s)
127127
if (!PointerIsValid(str))
128128
return FALSE;
129129

130-
while (isspace((unsigned char) *str))
131-
str++;
132130
*x = strtod(str, &cp);
131+
133132
#ifdef GEODEBUG
134-
printf("single_decode- (%x) try decoding %s to %g\n", (cp - str), str, *x);
133+
printf("single_decode- decoded first %d chars of \"%s\" to %g\n",
134+
(int) (cp - str), str, *x);
135135
#endif
136-
if (cp <= str)
137-
return FALSE;
138-
while (isspace((unsigned char) *cp))
139-
cp++;
140136

141137
if (s != NULL)
138+
{
139+
while (isspace((unsigned char) *cp))
140+
cp++;
142141
*s = cp;
142+
}
143143

144144
return TRUE;
145145
} /* single_decode() */
@@ -2857,8 +2857,8 @@ close_ps(PG_FUNCTION_ARGS)
28572857
result = point_copy(&lseg->p[!yh]); /* below the lseg, take lower
28582858
* end pt */
28592859
#ifdef GEODEBUG
2860-
printf("close_ps below: tmp A %f B %f C %f m %f\n",
2861-
tmp->A, tmp->B, tmp->C, tmp->m);
2860+
printf("close_ps below: tmp A %f B %f C %f\n",
2861+
tmp->A, tmp->B, tmp->C);
28622862
#endif
28632863
PG_RETURN_POINT_P(result);
28642864
}
@@ -2869,8 +2869,8 @@ close_ps(PG_FUNCTION_ARGS)
28692869
result = point_copy(&lseg->p[yh]); /* above the lseg, take higher
28702870
* end pt */
28712871
#ifdef GEODEBUG
2872-
printf("close_ps above: tmp A %f B %f C %f m %f\n",
2873-
tmp->A, tmp->B, tmp->C, tmp->m);
2872+
printf("close_ps above: tmp A %f B %f C %f\n",
2873+
tmp->A, tmp->B, tmp->C);
28742874
#endif
28752875
PG_RETURN_POINT_P(result);
28762876
}
@@ -2881,8 +2881,8 @@ close_ps(PG_FUNCTION_ARGS)
28812881
*/
28822882
tmp = line_construct_pm(pt, invm);
28832883
#ifdef GEODEBUG
2884-
printf("close_ps- tmp A %f B %f C %f m %f\n",
2885-
tmp->A, tmp->B, tmp->C, tmp->m);
2884+
printf("close_ps- tmp A %f B %f C %f\n",
2885+
tmp->A, tmp->B, tmp->C);
28862886
#endif
28872887
result = interpt_sl(lseg, tmp);
28882888
Assert(result != NULL);

0 commit comments

Comments
 (0)