Sfoglia il codice sorgente

much less memory, a bit faster

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@40286 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 15 anni fa
parent
commit
f03eb13a7b

+ 23 - 12
vector/v.voronoi/main.c

@@ -55,19 +55,18 @@ int cmp(void *a, void *b)
 {
 {
     COOR *ca = (COOR *) a;
     COOR *ca = (COOR *) a;
     COOR *cb = (COOR *) b;
     COOR *cb = (COOR *) b;
-    double thresh = 1e-10;
     double ma, mb;
     double ma, mb;
 
 
     /* calculate measure */
     /* calculate measure */
     ma = mb = 0.0;
     ma = mb = 0.0;
 
 
-    if (fabs(ca->y - Box.S) < thresh) {	/* bottom */
+    if (fabs(ca->y - Box.S) < GRASS_EPSILON) {	/* bottom */
 	ma = ca->x - Box.W;
 	ma = ca->x - Box.W;
     }
     }
-    else if (fabs(ca->x - Box.E) < thresh) {	/* right */
+    else if (fabs(ca->x - Box.E) < GRASS_EPSILON) {	/* right */
 	ma = (Box.E - Box.W) + (ca->y - Box.S);
 	ma = (Box.E - Box.W) + (ca->y - Box.S);
     }
     }
-    else if (fabs(ca->y - Box.N) < thresh) {	/* top */
+    else if (fabs(ca->y - Box.N) < GRASS_EPSILON) {	/* top */
 	ma = (Box.E - Box.W) + (Box.N - Box.S) + (Box.E - ca->x);
 	ma = (Box.E - Box.W) + (Box.N - Box.S) + (Box.E - ca->x);
     }
     }
     else {			/* left */
     else {			/* left */
@@ -75,13 +74,13 @@ int cmp(void *a, void *b)
     }
     }
 
 
 
 
-    if (fabs(cb->y - Box.S) < thresh) {	/* bottom */
+    if (fabs(cb->y - Box.S) < GRASS_EPSILON) {	/* bottom */
 	mb = cb->x - Box.W;
 	mb = cb->x - Box.W;
     }
     }
-    else if (fabs(cb->x - Box.E) < thresh) {	/* right */
+    else if (fabs(cb->x - Box.E) < GRASS_EPSILON) {	/* right */
 	mb = (Box.E - Box.W) + (cb->y - Box.S);
 	mb = (Box.E - Box.W) + (cb->y - Box.S);
     }
     }
-    else if (fabs(cb->y - Box.N) < thresh) {	/* top */
+    else if (fabs(cb->y - Box.N) < GRASS_EPSILON) {	/* top */
 	mb = (Box.E - Box.W) + (Box.N - Box.S) + (Box.E - cb->x);
 	mb = (Box.E - Box.W) + (Box.N - Box.S) + (Box.E - cb->x);
     }
     }
     else {			/* left */
     else {			/* left */
@@ -164,8 +163,9 @@ int main(int argc, char **argv)
     G_get_window(&Window);
     G_get_window(&Window);
     Vect_region_box(&Window, &Box);
     Vect_region_box(&Window, &Box);
 
 
-    freeinit(&sfl, sizeof *sites);
+    freeinit(&sfl, sizeof(struct Site));
 
 
+    G_message(_("Reading sites..."));
     readsites();
     readsites();
 
 
     siteidx = 0;
     siteidx = 0;
@@ -174,9 +174,11 @@ int main(int argc, char **argv)
     triangulate = 0;
     triangulate = 0;
     plot = 0;
     plot = 0;
     debug = 0;
     debug = 0;
+
+    G_message(_("Voronoi triangulation..."));
     voronoi(triangulate, nextone);
     voronoi(triangulate, nextone);
 
 
-    /* Close free ends by cyrrent region */
+    /* Close free ends by current region */
     Vect_build_partial(&Out, GV_BUILD_BASE);
     Vect_build_partial(&Out, GV_BUILD_BASE);
 
 
     ncoor = 0;
     ncoor = 0;
@@ -249,12 +251,21 @@ int main(int argc, char **argv)
     }
     }
 
 
     if (1) {
     if (1) {
-	int line, nlines, type;
+	int line, nlines, type, ctype;
+
+	if (line_flag->answer)
+	    ctype = GV_POINT;
+	else
+	    ctype = GV_CENTROID;
 
 
 	nlines = Vect_get_num_lines(&In);
 	nlines = Vect_get_num_lines(&In);
 
 
+	G_message(_("Writing sites to output..."));
+
 	for (line = 1; line <= nlines; line++) {
 	for (line = 1; line <= nlines; line++) {
 
 
+	    G_percent(line, nlines, 2);
+
 	    type = Vect_read_line(&In, Points, Cats, line);
 	    type = Vect_read_line(&In, Points, Cats, line);
 	    if (!(type & GV_POINTS))
 	    if (!(type & GV_POINTS))
 		continue;
 		continue;
@@ -262,7 +273,7 @@ int main(int argc, char **argv)
 	    if (!Vect_point_in_box(Points->x[0], Points->y[0], 0.0, &Box))
 	    if (!Vect_point_in_box(Points->x[0], Points->y[0], 0.0, &Box))
 		continue;
 		continue;
 
 
-	    Vect_write_line(&Out, GV_CENTROID, Points, Cats);
+	    Vect_write_line(&Out, ctype, Points, Cats);
 
 
 
 
 	    for (i = 0; i < Cats->n_cats; i++) {
 	    for (i = 0; i < Cats->n_cats; i++) {
@@ -339,7 +350,6 @@ int main(int argc, char **argv)
 		Vect_map_add_dblink(&Out, OFi->number, OFi->name, OFi->table,
 		Vect_map_add_dblink(&Out, OFi->number, OFi->name, OFi->table,
 				    IFi->key, OFi->database, OFi->driver);
 				    IFi->key, OFi->database, OFi->driver);
 	    }
 	    }
-	    G_done_msg(" ");
 	}
 	}
     }
     }
 
 
@@ -350,5 +360,6 @@ int main(int argc, char **argv)
     Vect_build(&Out);
     Vect_build(&Out);
     Vect_close(&Out);
     Vect_close(&Out);
 
 
+    G_done_msg(" ");
     exit(EXIT_SUCCESS);
     exit(EXIT_SUCCESS);
 }
 }

+ 12 - 11
vector/v.voronoi/sw_edgelist.c

@@ -1,4 +1,5 @@
 #include <stdlib.h>
 #include <stdlib.h>
+#include <grass/gis.h>
 #include "sw_defs.h"
 #include "sw_defs.h"
 
 
 int ntry, totalsearch;
 int ntry, totalsearch;
@@ -7,10 +8,10 @@ int ELinitialize(void)
 {
 {
     int i;
     int i;
 
 
-    freeinit(&hfl, sizeof **ELhash);
+    freeinit(&hfl, sizeof(struct Halfedge));
     ELhashsize = 2 * sqrt_nsites;
     ELhashsize = 2 * sqrt_nsites;
-    ELhash = (struct Halfedge **)myalloc(sizeof *ELhash * ELhashsize);
-    for (i = 0; i < ELhashsize; i += 1)
+    ELhash = (struct Halfedge **)G_malloc(ELhashsize * sizeof(struct Halfedge *));
+    for (i = 0; i < ELhashsize; i++)
 	ELhash[i] = (struct Halfedge *)NULL;
 	ELhash[i] = (struct Halfedge *)NULL;
     ELleftend = HEcreate((struct Edge *)NULL, 0);
     ELleftend = HEcreate((struct Edge *)NULL, 0);
     ELrightend = HEcreate((struct Edge *)NULL, 0);
     ELrightend = HEcreate((struct Edge *)NULL, 0);
@@ -62,7 +63,7 @@ struct Halfedge *ELgethash(int b)
 
 
     /* Hash table points to deleted half edge.  Patch as necessary. */
     /* Hash table points to deleted half edge.  Patch as necessary. */
     ELhash[b] = (struct Halfedge *)NULL;
     ELhash[b] = (struct Halfedge *)NULL;
-    if ((he->ELrefcnt -= 1) == 0)
+    if (--(he->ELrefcnt) == 0)
 	makefree((struct Freenode *)he, &hfl);
 	makefree((struct Freenode *)he, &hfl);
     return ((struct Halfedge *)NULL);
     return ((struct Halfedge *)NULL);
 }
 }
@@ -80,15 +81,15 @@ struct Halfedge *ELleftbnd(struct Point *p)
 	bucket = ELhashsize - 1;
 	bucket = ELhashsize - 1;
     he = ELgethash(bucket);
     he = ELgethash(bucket);
     if (he == (struct Halfedge *)NULL) {
     if (he == (struct Halfedge *)NULL) {
-	for (i = 1; 1; i += 1) {
+	for (i = 1; 1; i++) {
 	    if ((he = ELgethash(bucket - i)) != (struct Halfedge *)NULL)
 	    if ((he = ELgethash(bucket - i)) != (struct Halfedge *)NULL)
 		break;
 		break;
 	    if ((he = ELgethash(bucket + i)) != (struct Halfedge *)NULL)
 	    if ((he = ELgethash(bucket + i)) != (struct Halfedge *)NULL)
 		break;
 		break;
-	};
+	}
 	totalsearch += i;
 	totalsearch += i;
-    };
-    ntry += 1;
+    }
+    ntry++;
     /* Now search linear list of halfedges for the corect one */
     /* Now search linear list of halfedges for the corect one */
     if (he == ELleftend || (he != ELrightend && right_of(he, p))) {
     if (he == ELleftend || (he != ELrightend && right_of(he, p))) {
 	do {
 	do {
@@ -104,10 +105,10 @@ struct Halfedge *ELleftbnd(struct Point *p)
     /* Update hash table and reference counts */
     /* Update hash table and reference counts */
     if (bucket > 0 && bucket < ELhashsize - 1) {
     if (bucket > 0 && bucket < ELhashsize - 1) {
 	if (ELhash[bucket] != (struct Halfedge *)NULL)
 	if (ELhash[bucket] != (struct Halfedge *)NULL)
-	    ELhash[bucket]->ELrefcnt -= 1;
+	    ELhash[bucket]->ELrefcnt--;
 	ELhash[bucket] = he;
 	ELhash[bucket] = he;
-	ELhash[bucket]->ELrefcnt += 1;
-    };
+	ELhash[bucket]->ELrefcnt++;
+    }
     return (he);
     return (he);
 }
 }
 
 

+ 10 - 11
vector/v.voronoi/sw_geometry.c

@@ -4,10 +4,9 @@
 
 
 int geominit(void)
 int geominit(void)
 {
 {
-    struct Edge e;
     double sn;
     double sn;
 
 
-    freeinit(&efl, sizeof e);
+    freeinit(&efl, sizeof(struct Edge));
     nvertices = 0;
     nvertices = 0;
     nedges = 0;
     nedges = 0;
     sn = nsites + 4;
     sn = nsites + 4;
@@ -48,11 +47,11 @@ struct Edge *bisect(struct Site *s1, struct Site *s2)
 	newedge->b = 1.0;
 	newedge->b = 1.0;
 	newedge->a = dx / dy;
 	newedge->a = dx / dy;
 	newedge->c /= dy;
 	newedge->c /= dy;
-    };
+    }
 
 
     newedge->edgenbr = nedges;
     newedge->edgenbr = nedges;
     out_bisector(newedge);
     out_bisector(newedge);
-    nedges += 1;
+    nedges++;
     return (newedge);
     return (newedge);
 }
 }
 
 
@@ -88,7 +87,7 @@ struct Site *intersect(struct Halfedge *el1, struct Halfedge *el2)
     else {
     else {
 	el = el2;
 	el = el2;
 	e = e2;
 	e = e2;
-    };
+    }
     right_of_site = xint >= e->reg[1]->coord.x;
     right_of_site = xint >= e->reg[1]->coord.x;
     if ((right_of_site && el->ELpm == le) ||
     if ((right_of_site && el->ELpm == le) ||
 	(!right_of_site && el->ELpm == re))
 	(!right_of_site && el->ELpm == re))
@@ -131,14 +130,14 @@ int right_of(struct Halfedge *el, struct Point *p)
 		above = !above;
 		above = !above;
 	    if (!above)
 	    if (!above)
 		fast = 1;
 		fast = 1;
-	};
+	}
 	if (!fast) {
 	if (!fast) {
 	    dxs = topsite->coord.x - (e->reg[0])->coord.x;
 	    dxs = topsite->coord.x - (e->reg[0])->coord.x;
 	    above = e->b * (dxp * dxp - dyp * dyp) <
 	    above = e->b * (dxp * dxp - dyp * dyp) <
 		dxs * dyp * (1.0 + 2.0 * dxp / dxs + e->b * e->b);
 		dxs * dyp * (1.0 + 2.0 * dxp / dxs + e->b * e->b);
 	    if (e->b < 0.0)
 	    if (e->b < 0.0)
 		above = !above;
 		above = !above;
-	};
+	}
     }
     }
     else {			/*e->b==1.0 */
     else {			/*e->b==1.0 */
 	yl = e->c - e->a * p->x;
 	yl = e->c - e->a * p->x;
@@ -146,7 +145,7 @@ int right_of(struct Halfedge *el, struct Point *p)
 	t2 = p->x - topsite->coord.x;
 	t2 = p->x - topsite->coord.x;
 	t3 = yl - topsite->coord.y;
 	t3 = yl - topsite->coord.y;
 	above = t1 * t1 > t2 * t2 + t3 * t3;
 	above = t1 * t1 > t2 * t2 + t3 * t3;
-    };
+    }
     return (el->ELpm == le ? above : !above);
     return (el->ELpm == le ? above : !above);
 }
 }
 
 
@@ -177,7 +176,7 @@ double dist(struct Site *s, struct Site *t)
 int makevertex(struct Site *v)
 int makevertex(struct Site *v)
 {
 {
     v->sitenbr = nvertices;
     v->sitenbr = nvertices;
-    nvertices += 1;
+    nvertices++;
     out_vertex(v);
     out_vertex(v);
     return 0;
     return 0;
 }
 }
@@ -185,7 +184,7 @@ int makevertex(struct Site *v)
 
 
 int deref(struct Site *v)
 int deref(struct Site *v)
 {
 {
-    v->refcnt -= 1;
+    v->refcnt--;
     if (v->refcnt == 0)
     if (v->refcnt == 0)
 	makefree((struct Freenode *)v, &sfl);
 	makefree((struct Freenode *)v, &sfl);
     return 0;
     return 0;
@@ -193,6 +192,6 @@ int deref(struct Site *v)
 
 
 int ref(struct Site *v)
 int ref(struct Site *v)
 {
 {
-    v->refcnt += 1;
+    v->refcnt++;
     return 0;
     return 0;
 }
 }

+ 11 - 9
vector/v.voronoi/sw_heap.c

@@ -1,4 +1,5 @@
 #include <stdlib.h>
 #include <stdlib.h>
+#include <grass/gis.h>
 #include "sw_defs.h"
 #include "sw_defs.h"
 
 
 
 
@@ -15,10 +16,10 @@ int PQinsert(struct Halfedge *he, struct Site *v, double offset)
 	    (he->ystar == next->ystar && v->coord.x > next->vertex->coord.x)))
 	    (he->ystar == next->ystar && v->coord.x > next->vertex->coord.x)))
     {
     {
 	last = next;
 	last = next;
-    };
+    }
     he->PQnext = last->PQnext;
     he->PQnext = last->PQnext;
     last->PQnext = he;
     last->PQnext = he;
-    PQcount += 1;
+    PQcount++;
     return 0;
     return 0;
 }
 }
 
 
@@ -31,10 +32,10 @@ int PQdelete(struct Halfedge *he)
 	while (last->PQnext != he)
 	while (last->PQnext != he)
 	    last = last->PQnext;
 	    last = last->PQnext;
 	last->PQnext = he->PQnext;
 	last->PQnext = he->PQnext;
-	PQcount -= 1;
+	PQcount--;
 	deref(he->vertex);
 	deref(he->vertex);
 	he->vertex = (struct Site *)NULL;
 	he->vertex = (struct Site *)NULL;
-    };
+    }
     return 0;
     return 0;
 }
 }
 
 
@@ -65,10 +66,11 @@ struct Point PQ_min(void)
     struct Point answer;
     struct Point answer;
 
 
     while (PQhash[PQmin].PQnext == (struct Halfedge *)NULL) {
     while (PQhash[PQmin].PQnext == (struct Halfedge *)NULL) {
-	PQmin += 1;
-    };
+	PQmin++;
+    }
     answer.x = PQhash[PQmin].PQnext->vertex->coord.x;
     answer.x = PQhash[PQmin].PQnext->vertex->coord.x;
     answer.y = PQhash[PQmin].PQnext->ystar;
     answer.y = PQhash[PQmin].PQnext->ystar;
+    answer.z = PQhash[PQmin].PQnext->vertex->coord.z;
     return (answer);
     return (answer);
 }
 }
 
 
@@ -78,7 +80,7 @@ struct Halfedge *PQextractmin(void)
 
 
     curr = PQhash[PQmin].PQnext;
     curr = PQhash[PQmin].PQnext;
     PQhash[PQmin].PQnext = curr->PQnext;
     PQhash[PQmin].PQnext = curr->PQnext;
-    PQcount -= 1;
+    PQcount--;
     return (curr);
     return (curr);
 }
 }
 
 
@@ -90,8 +92,8 @@ int PQinitialize(void)
     PQcount = 0;
     PQcount = 0;
     PQmin = 0;
     PQmin = 0;
     PQhashsize = 4 * sqrt_nsites;
     PQhashsize = 4 * sqrt_nsites;
-    PQhash = (struct Halfedge *)myalloc(PQhashsize * sizeof *PQhash);
-    for (i = 0; i < PQhashsize; i += 1)
+    PQhash = (struct Halfedge *)G_malloc(PQhashsize * sizeof(struct Halfedge));
+    for (i = 0; i < PQhashsize; i++)
 	PQhash[i].PQnext = (struct Halfedge *)NULL;
 	PQhash[i].PQnext = (struct Halfedge *)NULL;
 
 
     return 0;
     return 0;

+ 30 - 23
vector/v.voronoi/sw_main.c

@@ -56,7 +56,7 @@ struct Site *nextone(void)
 
 
     if (siteidx < nsites) {
     if (siteidx < nsites) {
 	s = &sites[siteidx];
 	s = &sites[siteidx];
-	siteidx += 1;
+	siteidx++;
 	return (s);
 	return (s);
     }
     }
     else
     else
@@ -98,7 +98,7 @@ void removeDuplicates()
 
 
     if (j != nsites) {
     if (j != nsites) {
 	nsites = j;
 	nsites = j;
-	sites = (struct Site *)G_realloc(sites, nsites * sizeof(*sites));
+	sites = (struct Site *)G_realloc(sites, nsites * sizeof(struct Site));
     }
     }
 
 
 }
 }
@@ -106,7 +106,7 @@ void removeDuplicates()
 /* read all sites, sort, and compute xmin, xmax, ymin, ymax */
 /* read all sites, sort, and compute xmin, xmax, ymin, ymax */
 int readsites(void)
 int readsites(void)
 {
 {
-    int i, nlines, line;
+    int nlines, line;
     struct line_pnts *Points;
     struct line_pnts *Points;
 
 
     Points = Vect_new_line_struct();
     Points = Vect_new_line_struct();
@@ -114,11 +114,13 @@ int readsites(void)
     nlines = Vect_get_num_lines(&In);
     nlines = Vect_get_num_lines(&In);
 
 
     nsites = 0;
     nsites = 0;
-    sites = (struct Site *)myalloc(nlines * sizeof(*sites));
+    sites = (struct Site *)G_malloc(nlines * sizeof(struct Site));
 
 
     for (line = 1; line <= nlines; line++) {
     for (line = 1; line <= nlines; line++) {
 	int type;
 	int type;
 
 
+	G_percent(line, nlines, 2);
+
 	type = Vect_read_line(&In, Points, NULL, line);
 	type = Vect_read_line(&In, Points, NULL, line);
 	if (!(type & GV_POINTS))
 	if (!(type & GV_POINTS))
 	    continue;
 	    continue;
@@ -134,28 +136,33 @@ int readsites(void)
 	    G_debug(3, "Points->z[0]: %f", Points->z[0]);
 	    G_debug(3, "Points->z[0]: %f", Points->z[0]);
 	    sites[nsites].coord.z = Points->z[0];
 	    sites[nsites].coord.z = Points->z[0];
 	}
 	}
+	else
+	    sites[nsites].coord.z = 0.0;
+
+	if (nsites > 1) {
+	    if (xmin > sites[nsites].coord.x)
+		xmin = sites[nsites].coord.x;
+	    if (xmax < sites[nsites].coord.x)
+		xmax = sites[nsites].coord.x;
+	    if (ymin > sites[nsites].coord.y)
+		ymin = sites[nsites].coord.y;
+	    if (ymax < sites[nsites].coord.y)
+		ymax = sites[nsites].coord.y;
+	}
+	else {
+	    xmin = xmax = sites[nsites].coord.x;
+	    ymin = ymax = sites[nsites].coord.y;
+	}
 
 
-	sites[nsites].sitenbr = nsites;
-	sites[nsites].refcnt = 0;
-	nsites += 1;
-	if (nsites % 4000 == 0)
-	    sites =
-		(struct Site *)G_realloc(sites,
-					 (nsites + 4000) * sizeof(*sites));
+	nsites++;
     }
     }
+    if (nsites < nlines)
+	sites =
+	    (struct Site *)G_realloc(sites,
+				     (nsites) * sizeof(struct Site));
 
 
-    qsort(sites, nsites, sizeof(*sites), scomp);
+    qsort(sites, nsites, sizeof(struct Site), scomp);
     removeDuplicates();
     removeDuplicates();
-    xmin = sites[0].coord.x;
-    xmax = sites[0].coord.x;
-    for (i = 1; i < nsites; i += 1) {
-	if (sites[i].coord.x < xmin)
-	    xmin = sites[i].coord.x;
-	if (sites[i].coord.x > xmax)
-	    xmax = sites[i].coord.x;
-    }
-    ymin = sites[0].coord.y;
-    ymax = sites[nsites - 1].coord.y;
     return 0;
     return 0;
 }
 }
 
 
@@ -167,7 +174,7 @@ struct Site *readone(void)
     s = (struct Site *)getfree(&sfl);
     s = (struct Site *)getfree(&sfl);
     s->refcnt = 0;
     s->refcnt = 0;
     s->sitenbr = siteidx;
     s->sitenbr = siteidx;
-    siteidx += 1;
+    siteidx++;
 
 
     if (scanf("%lf %lf", &(s->coord.x), &(s->coord.y)) == EOF)
     if (scanf("%lf %lf", &(s->coord.x), &(s->coord.y)) == EOF)
 	return ((struct Site *)NULL);
 	return ((struct Site *)NULL);

+ 3 - 18
vector/v.voronoi/sw_memory.c

@@ -16,10 +16,10 @@ char *getfree(struct Freelist *fl)
     struct Freenode *t;
     struct Freenode *t;
 
 
     if (fl->head == (struct Freenode *)NULL) {
     if (fl->head == (struct Freenode *)NULL) {
-	t = (struct Freenode *)myalloc(sqrt_nsites * fl->nodesize);
-	for (i = 0; i < sqrt_nsites; i += 1)
+	t = (struct Freenode *)G_malloc(sqrt_nsites * fl->nodesize);
+	for (i = 0; i < sqrt_nsites; i++)
 	    makefree((struct Freenode *)((char *)t + i * fl->nodesize), fl);
 	    makefree((struct Freenode *)((char *)t + i * fl->nodesize), fl);
-    };
+    }
     t = fl->head;
     t = fl->head;
     fl->head = (fl->head)->nextfree;
     fl->head = (fl->head)->nextfree;
     return ((char *)t);
     return ((char *)t);
@@ -31,18 +31,3 @@ int makefree(struct Freenode *curr, struct Freelist *fl)
     fl->head = curr;
     fl->head = curr;
     return 0;
     return 0;
 }
 }
-
-int total_alloc;
-char *myalloc(unsigned n)
-{
-    char *t;
-
-    if ((t = G_malloc(n)) == (char *)0) {
-	fprintf(stderr,
-		"Insufficient memory processing site %d (%d bytes in use)\n",
-		siteidx, total_alloc);
-	exit(0);
-    };
-    total_alloc += n;
-    return (t);
-}

+ 10 - 10
vector/v.voronoi/sw_output.c

@@ -146,7 +146,7 @@ int clip_line(struct Edge *e)
     else {
     else {
 	s1 = e->ep[0];
 	s1 = e->ep[0];
 	s2 = e->ep[1];
 	s2 = e->ep[1];
-    };
+    }
 
 
     if (e->a == 1.0) {
     if (e->a == 1.0) {
 	y1 = pymin;
 	y1 = pymin;
@@ -167,19 +167,19 @@ int clip_line(struct Edge *e)
 	if (x1 > pxmax) {
 	if (x1 > pxmax) {
 	    x1 = pxmax;
 	    x1 = pxmax;
 	    y1 = (e->c - x1) / e->b;
 	    y1 = (e->c - x1) / e->b;
-	};
+	}
 	if (x1 < pxmin) {
 	if (x1 < pxmin) {
 	    x1 = pxmin;
 	    x1 = pxmin;
 	    y1 = (e->c - x1) / e->b;
 	    y1 = (e->c - x1) / e->b;
-	};
+	}
 	if (x2 > pxmax) {
 	if (x2 > pxmax) {
 	    x2 = pxmax;
 	    x2 = pxmax;
 	    y2 = (e->c - x2) / e->b;
 	    y2 = (e->c - x2) / e->b;
-	};
+	}
 	if (x2 < pxmin) {
 	if (x2 < pxmin) {
 	    x2 = pxmin;
 	    x2 = pxmin;
 	    y2 = (e->c - x2) / e->b;
 	    y2 = (e->c - x2) / e->b;
-	};
+	}
     }
     }
     else {
     else {
 	x1 = pxmin;
 	x1 = pxmin;
@@ -200,20 +200,20 @@ int clip_line(struct Edge *e)
 	if (y1 > pymax) {
 	if (y1 > pymax) {
 	    y1 = pymax;
 	    y1 = pymax;
 	    x1 = (e->c - y1) / e->a;
 	    x1 = (e->c - y1) / e->a;
-	};
+	}
 	if (y1 < pymin) {
 	if (y1 < pymin) {
 	    y1 = pymin;
 	    y1 = pymin;
 	    x1 = (e->c - y1) / e->a;
 	    x1 = (e->c - y1) / e->a;
-	};
+	}
 	if (y2 > pymax) {
 	if (y2 > pymax) {
 	    y2 = pymax;
 	    y2 = pymax;
 	    x2 = (e->c - y2) / e->a;
 	    x2 = (e->c - y2) / e->a;
-	};
+	}
 	if (y2 < pymin) {
 	if (y2 < pymin) {
 	    y2 = pymin;
 	    y2 = pymin;
 	    x2 = (e->c - y2) / e->a;
 	    x2 = (e->c - y2) / e->a;
-	};
-    };
+	}
+    }
 
 
     line(x1, y1, x2, y2);
     line(x1, y1, x2, y2);
 
 

+ 6 - 6
vector/v.voronoi/sw_voronoi.c

@@ -37,13 +37,13 @@ int voronoi(int triangulate, struct Site *(*nextsite) (void))
 	    if ((p = intersect(lbnd, bisector)) != (struct Site *)NULL) {
 	    if ((p = intersect(lbnd, bisector)) != (struct Site *)NULL) {
 		PQdelete(lbnd);
 		PQdelete(lbnd);
 		PQinsert(lbnd, p, dist(p, newsite));
 		PQinsert(lbnd, p, dist(p, newsite));
-	    };
+	    }
 	    lbnd = bisector;
 	    lbnd = bisector;
 	    bisector = HEcreate(e, re);
 	    bisector = HEcreate(e, re);
 	    ELinsert(lbnd, bisector);
 	    ELinsert(lbnd, bisector);
 	    if ((p = intersect(bisector, rbnd)) != (struct Site *)NULL) {
 	    if ((p = intersect(bisector, rbnd)) != (struct Site *)NULL) {
 		PQinsert(bisector, p, dist(p, newsite));
 		PQinsert(bisector, p, dist(p, newsite));
-	    };
+	    }
 	    /* get next site, but ensure that it doesn't have the same
 	    /* get next site, but ensure that it doesn't have the same
 	       coordinates as the previous. If so, step over to the following
 	       coordinates as the previous. If so, step over to the following
 	       site. Andrea Aime 4/7/2001 */
 	       site. Andrea Aime 4/7/2001 */
@@ -87,19 +87,19 @@ int voronoi(int triangulate, struct Site *(*nextsite) (void))
 	    if ((p = intersect(llbnd, bisector)) != (struct Site *)NULL) {
 	    if ((p = intersect(llbnd, bisector)) != (struct Site *)NULL) {
 		PQdelete(llbnd);
 		PQdelete(llbnd);
 		PQinsert(llbnd, p, dist(p, bot));
 		PQinsert(llbnd, p, dist(p, bot));
-	    };
+	    }
 	    if ((p = intersect(bisector, rrbnd)) != (struct Site *)NULL) {
 	    if ((p = intersect(bisector, rrbnd)) != (struct Site *)NULL) {
 		PQinsert(bisector, p, dist(p, bot));
 		PQinsert(bisector, p, dist(p, bot));
-	    };
+	    }
 	}
 	}
 	else
 	else
 	    break;
 	    break;
-    };
+    }
 
 
     for (lbnd = ELright(ELleftend); lbnd != ELrightend; lbnd = ELright(lbnd)) {
     for (lbnd = ELright(ELleftend); lbnd != ELrightend; lbnd = ELright(lbnd)) {
 	e = lbnd->ELedge;
 	e = lbnd->ELedge;
 	out_ep(e);
 	out_ep(e);
-    };
+    }
 
 
     return 0;
     return 0;
 }
 }