From 84f9d3c3b4ebbc83f21e009cb4d666f1616288ec Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sun, 18 Jan 2015 09:09:43 -0300 Subject: [PATCH] poly2d/p2d_attrib.c (p2d_no_intersect): don't test last vs. first segment This one case slipped through. Surprisingly, it rarely produced a complaint. --- poly2d/p2d_attrib.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/poly2d/p2d_attrib.c b/poly2d/p2d_attrib.c index 48932a2..1e7fc7b 100644 --- a/poly2d/p2d_attrib.c +++ b/poly2d/p2d_attrib.c @@ -4,8 +4,7 @@ * Written 2012, 2015 by Werner Almesberger * Copyright 2012, 2015 Werner Almesberger * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ @@ -89,15 +88,13 @@ bool p2d_no_intersect(const struct p2d *p) u = u->next; if (!u || u == p->v) return 1; - while (u && u->next) { + while (u && u->next && u->next != v) { if (v2d_intersect(v, v->next, u, u->next, NULL, NULL) > 0) return 0; u = u->next; if (u == p->v) break; - if (u->next == v) - break; } v = v->next; if (v == p->v)