mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-24 09:02:37 +00:00
removing run-time sized array
git-svn-id: http://svn.osgeo.org/postgis/trunk@6030 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
parent
2cb5766335
commit
12ac2d5e56
|
@ -948,9 +948,11 @@ lw_dist2d_fast_ptarray_ptarray(POINTARRAY *l1, POINTARRAY *l2,DISTPTS *dl, BOX2D
|
||||||
int t;
|
int t;
|
||||||
int n1 = l1->npoints;
|
int n1 = l1->npoints;
|
||||||
int n2 = l2->npoints;
|
int n2 = l2->npoints;
|
||||||
LISTSTRUCT list1[n1]; /* This could be a problem, var-size array not legal in C90 */
|
|
||||||
LISTSTRUCT list2[n2]; /* This could be a problem, var-size array not legal in C90 */
|
LISTSTRUCT *list1, *list2;
|
||||||
|
list1 = (LISTSTRUCT*)lwalloc(sizeof(LISTSTRUCT)*n1);
|
||||||
|
list2 = (LISTSTRUCT*)lwalloc(sizeof(LISTSTRUCT)*n2);
|
||||||
|
|
||||||
LWDEBUG(2, "lw_dist2d_fast_ptarray_ptarray is called");
|
LWDEBUG(2, "lw_dist2d_fast_ptarray_ptarray is called");
|
||||||
|
|
||||||
max1X = box1->xmax;
|
max1X = box1->xmax;
|
||||||
|
@ -1029,13 +1031,25 @@ lw_dist2d_fast_ptarray_ptarray(POINTARRAY *l1, POINTARRAY *l2,DISTPTS *dl, BOX2D
|
||||||
|
|
||||||
if (c1m < c2m)
|
if (c1m < c2m)
|
||||||
{
|
{
|
||||||
if (!lw_dist2d_pre_seg_seg(l1,l2,list1,list2,k,dl)) return LW_FALSE;
|
if (!lw_dist2d_pre_seg_seg(l1,l2,list1,list2,k,dl))
|
||||||
|
{
|
||||||
|
lwfree(list1);
|
||||||
|
lwfree(list2);
|
||||||
|
return LW_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dl->twisted= ((dl->twisted) * (-1));
|
dl->twisted= ((dl->twisted) * (-1));
|
||||||
if (!lw_dist2d_pre_seg_seg(l2,l1,list2,list1,k,dl)) return LW_FALSE;
|
if (!lw_dist2d_pre_seg_seg(l2,l1,list2,list1,k,dl))
|
||||||
|
{
|
||||||
|
lwfree(list1);
|
||||||
|
lwfree(list2);
|
||||||
|
return LW_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
lwfree(list1);
|
||||||
|
lwfree(list2);
|
||||||
return LW_TRUE;
|
return LW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue