|
1 | 1 | /*
|
2 |
| - * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.2 1996/11/11 16:33:12 scrappy Exp $ |
| 2 | + * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.3 1996/11/12 11:09:13 bryanh Exp $ |
3 | 3 | */
|
4 | 4 |
|
5 | 5 | #include<float.h>/* faked on sunos */
|
6 | 6 | #include<stdio.h>
|
| 7 | +#include<string.h>/* for memset() */ |
7 | 8 |
|
8 | 9 | #include<postgres.h>
|
| 10 | +#include"libpq-fe.h" |
9 | 11 |
|
10 | 12 | #include"utils/geo-decls.h"/* includes <math.h> */
|
11 |
| -#include"libpq-fe.h" |
| 13 | +#include"executor/executor.h"/* For GetAttributeByName */ |
12 | 14 |
|
13 | 15 | #defineP_MAXDIG 12
|
14 | 16 | #defineLDELIM'('
|
@@ -129,21 +131,21 @@ interpt_pp(p1,p2)
|
129 | 131 | inti,j;
|
130 | 132 | LSEGseg1,seg2;
|
131 | 133 | LINE*ln;
|
| 134 | +boolfound;/* We've found the intersection */ |
132 | 135 |
|
133 |
| -for (i=0;i<p1->npts-1;i++) |
134 |
| -for (j=0;j<p2->npts-1;j++) |
| 136 | +found= false;/* Haven't found it yet */ |
| 137 | + |
| 138 | +for (i=0;i<p1->npts-1&& !found;i++) |
| 139 | +for (j=0;j<p2->npts-1&& !found;j++) |
135 | 140 | {
|
136 |
| -regress_lseg_construct(&seg1,&p1->p[i],&p1->p[i+1]); |
137 |
| -regress_lseg_construct(&seg2,&p2->p[j],&p2->p[j+1]); |
138 |
| -if (lseg_intersect(&seg1,&seg2)) |
139 |
| - { |
140 |
| -ln=line_construct_pp(&seg2.p[0],&seg2.p[1]); |
141 |
| -retval=interpt_sl(&seg1,ln); |
142 |
| -gotoexit; |
143 |
| - } |
| 141 | +regress_lseg_construct(&seg1,&p1->p[i],&p1->p[i+1]); |
| 142 | +regress_lseg_construct(&seg2,&p2->p[j],&p2->p[j+1]); |
| 143 | +if (lseg_intersect(&seg1,&seg2))found= true; |
144 | 144 | }
|
145 | 145 |
|
146 |
| -exit: |
| 146 | +ln=line_construct_pp(&seg2.p[0],&seg2.p[1]); |
| 147 | +retval=interpt_sl(&seg1,ln); |
| 148 | + |
147 | 149 | return(retval);
|
148 | 150 | }
|
149 | 151 |
|
|