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

Commit 778d498

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 91fa7b4 commit 778d498

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/backend/utils/adt/geo_ops.c

+13-13
Original file line numberDiff line numberDiff line change
@@ -128,19 +128,19 @@ single_decode(char *str, float8 *x, char **s)
128128
if (!PointerIsValid(str))
129129
return FALSE;
130130

131-
while (isspace((unsigned char) *str))
132-
str++;
133131
*x = strtod(str, &cp);
132+
134133
#ifdef GEODEBUG
135-
printf("single_decode- (%x) try decoding %s to %g\n", (cp - str), str, *x);
134+
printf("single_decode- decoded first %d chars of \"%s\" to %g\n",
135+
(int) (cp - str), str, *x);
136136
#endif
137-
if (cp <= str)
138-
return FALSE;
139-
while (isspace((unsigned char) *cp))
140-
cp++;
141137

142138
if (s != NULL)
139+
{
140+
while (isspace((unsigned char) *cp))
141+
cp++;
143142
*s = cp;
143+
}
144144

145145
return TRUE;
146146
} /* single_decode() */
@@ -2901,8 +2901,8 @@ close_ps(PG_FUNCTION_ARGS)
29012901
result = point_copy(&lseg->p[!yh]); /* below the lseg, take lower
29022902
* end pt */
29032903
#ifdef GEODEBUG
2904-
printf("close_ps below: tmp A %f B %f C %f m %f\n",
2905-
tmp->A, tmp->B, tmp->C, tmp->m);
2904+
printf("close_ps below: tmp A %f B %f C %f\n",
2905+
tmp->A, tmp->B, tmp->C);
29062906
#endif
29072907
PG_RETURN_POINT_P(result);
29082908
}
@@ -2913,8 +2913,8 @@ close_ps(PG_FUNCTION_ARGS)
29132913
result = point_copy(&lseg->p[yh]); /* above the lseg, take higher
29142914
* end pt */
29152915
#ifdef GEODEBUG
2916-
printf("close_ps above: tmp A %f B %f C %f m %f\n",
2917-
tmp->A, tmp->B, tmp->C, tmp->m);
2916+
printf("close_ps above: tmp A %f B %f C %f\n",
2917+
tmp->A, tmp->B, tmp->C);
29182918
#endif
29192919
PG_RETURN_POINT_P(result);
29202920
}
@@ -2925,8 +2925,8 @@ close_ps(PG_FUNCTION_ARGS)
29252925
*/
29262926
tmp = line_construct_pm(pt, invm);
29272927
#ifdef GEODEBUG
2928-
printf("close_ps- tmp A %f B %f C %f m %f\n",
2929-
tmp->A, tmp->B, tmp->C, tmp->m);
2928+
printf("close_ps- tmp A %f B %f C %f\n",
2929+
tmp->A, tmp->B, tmp->C);
29302930
#endif
29312931
result = interpt_sl(lseg, tmp);
29322932
Assert(result != NULL);

0 commit comments

Comments
 (0)