Index: trunk/src/find_geo.c =================================================================== --- trunk/src/find_geo.c (revision 28425) +++ trunk/src/find_geo.c (revision 28426) @@ -307,8 +307,8 @@ return pcb_poly_is_point_in_p_ignore_holes(Point->X, Point->Y, polygon); /* canonical point */ - cx = polygon->Clipped->contours->head.point[0]; - cy = polygon->Clipped->contours->head.point[1]; + cx = polygon->Clipped->contours->head->point[0]; + cy = polygon->Clipped->contours->head->point[1]; if ((Point->X == cx) && (Point->Y == cy)) return pcb_true; @@ -731,7 +731,7 @@ pcb_pline_t *c; for (c = P1->Clipped->contours; c; c = c->next) { pcb_line_t line; - pcb_vnode_t *v = &c->head; + pcb_vnode_t *v = c->head; if (c->xmin - Bloat <= P2->Clipped->contours->xmax && c->xmax + Bloat >= P2->Clipped->contours->xmin && c->ymin - Bloat <= P2->Clipped->contours->ymax && c->ymax + Bloat >= P2->Clipped->contours->ymin) { @@ -741,7 +741,7 @@ line.Thickness = 2 * Bloat; line.Clearance = 0; line.Flags = pcb_no_flags(); - for (v = v->next; v != &c->head; v = v->next) { + for (v = v->next; v != c->head; v = v->next) { line.Point2.X = v->point[0]; line.Point2.Y = v->point[1]; pcb_line_bbox(&line); @@ -799,7 +799,7 @@ q[2][0] = x1 - ox; q[2][1] = y1 - oy; q[3][0] = x2 - ox; q[3][1] = y2 - oy; - return pcb_is_point_in_convex_quad(pl->head.point, q); + return pcb_is_point_in_convex_quad(pl->head->point, q); } } @@ -935,7 +935,7 @@ pl = pcb_poly_contour_new(v); for(n = 1; n < shape->data.poly.len; n++) { v[0] = shape->data.poly.x[n] + ps->x; v[1] = shape->data.poly.y[n] + ps->y; - pcb_poly_vertex_include(pl->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(pl->head->prev, pcb_poly_node_create(v)); } pcb_poly_contour_pre(pl, 1); pcb_polyarea_contour_include(shp, pl); Index: trunk/src/obj_pinvia_therm.c =================================================================== --- trunk/src/obj_pinvia_therm.c (revision 28425) +++ trunk/src/obj_pinvia_therm.c (revision 28426) @@ -66,13 +66,13 @@ return NULL; v[0] = X - x2; v[1] = Y - y1; - pcb_poly_vertex_include(c->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(c->head->prev, pcb_poly_node_create(v)); v[0] = X - x1; v[1] = Y - y2; - pcb_poly_vertex_include(c->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(c->head->prev, pcb_poly_node_create(v)); v[0] = X + x2; v[1] = Y + y1; - pcb_poly_vertex_include(c->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(c->head->prev, pcb_poly_node_create(v)); return pcb_poly_from_contour(c); } Index: trunk/src/obj_poly.c =================================================================== --- trunk/src/obj_poly.c (revision 28425) +++ trunk/src/obj_poly.c (revision 28426) @@ -1055,10 +1055,10 @@ for(cidx = 0, pl = pa->contours; pl != NULL; cidx++, pl = pl->next) { pcb_vnode_t *v; cb(p, ctx, (cidx == 0 ? PCB_POLYEV_ISLAND_START : PCB_POLYEV_HOLE_START), 0, 0); - v = pl->head.next; + v = pl->head->next; do { cb(p, ctx, (cidx == 0 ? PCB_POLYEV_ISLAND_POINT : PCB_POLYEV_HOLE_POINT), v->point[0], v->point[1]); - } while ((v = v->next) != pl->head.next); + } while ((v = v->next) != pl->head->next); cb(p, ctx, (cidx == 0 ? PCB_POLYEV_ISLAND_END : PCB_POLYEV_HOLE_END), 0, 0); } @@ -1224,7 +1224,7 @@ pcb_vnode_t *n, *head; int i; pcb_dhlp_fill_pcb_polygon(pcb_draw_out.active_padGC, polygon, info->drawn_area); - head = &polygon->Clipped->contours->head; + head = polygon->Clipped->contours->head; pcb_hid_set_line_cap(pcb_draw_out.fgGC, pcb_cap_square); for(n = head, i = 0; (n != head) || (i == 0); n = n->next, i++) { pcb_coord_t x, y, r; Index: trunk/src/obj_poly.h =================================================================== --- trunk/src/obj_poly.h (revision 28425) +++ trunk/src/obj_poly.h (revision 28426) @@ -170,7 +170,7 @@ read the coords into x,y; returns 1 on success, 0 if there are no points */ PCB_INLINE int pcb_poly_vect_first(pcb_poly_it_t *it, pcb_coord_t *x, pcb_coord_t *y) { - it->v = it->cntr->head.next; + it->v = it->cntr->head->next; if (it->v == NULL) return 0; *x = it->v->point[0]; @@ -184,7 +184,7 @@ PCB_INLINE int pcb_poly_vect_next(pcb_poly_it_t *it, pcb_coord_t *x, pcb_coord_t *y) { it->v = it->v->next; - if (it->v == it->cntr->head.next) + if (it->v == it->cntr->head->next) return 0; *x = it->v->point[0]; *y = it->v->point[1]; Index: trunk/src/obj_poly_draw_helper.c =================================================================== --- trunk/src/obj_poly_draw_helper.c (revision 28425) +++ trunk/src/obj_poly_draw_helper.c (revision 28426) @@ -42,9 +42,9 @@ #define vert_opt_begin() \ { \ pcb_coord_t last_x, last_y, this_x, this_y, next_x, next_y, mindist; \ - last_x = pl->head.point[0]; \ - last_y = pl->head.point[1]; \ - v = pl->head.next; \ + last_x = pl->head->point[0]; \ + last_y = pl->head->point[1]; \ + v = pl->head->next; \ mindist = pcb_render->coord_per_pix * 2; \ /* call this before drawing the next vertex */ @@ -94,7 +94,7 @@ fc_y[i++] = this_y; vert_opt_loop2(); } - while ((v = v->next) != pl->head.next); + while ((v = v->next) != pl->head->next); if (i < 3) pcb_render->draw_line(gc, last_x, last_y, this_x, this_y); @@ -120,7 +120,7 @@ } /* Need at least two points in the contour */ - if (pl->head.next == NULL) + if (pl->head->next == NULL) return; vert_opt_begin(); @@ -129,7 +129,7 @@ pcb_render->draw_line(gc, last_x, last_y, this_x, this_y); vert_opt_loop2(); } - while ((v = v->next) != pl->head.next); + while ((v = v->next) != pl->head->next); vert_opt_end(); } Index: trunk/src/obj_pstk_proto.c =================================================================== --- trunk/src/obj_pstk_proto.c (revision 28425) +++ trunk/src/obj_pstk_proto.c (revision 28426) @@ -778,7 +778,7 @@ pl = pcb_poly_contour_new(v); for(n = 1; n < poly->len; n++) { v[0] = poly->x[n]; v[1] = poly->y[n]; - pcb_poly_vertex_include(pl->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(pl->head->prev, pcb_poly_node_create(v)); } pcb_poly_contour_pre(pl, 1); Index: trunk/src/polyarea.h =================================================================== --- trunk/src/polyarea.h (revision 28425) +++ trunk/src/polyarea.h (revision 28426) @@ -69,7 +69,7 @@ struct pcb_pline_s { pcb_coord_t xmin, ymin, xmax, ymax; pcb_pline_t *next; - pcb_vnode_t head; + pcb_vnode_t *head; unsigned int Count; double area; pcb_rtree_t *tree; Index: trunk/src/polygon.c =================================================================== --- trunk/src/polygon.c (revision 28425) +++ trunk/src/polygon.c (revision 28426) @@ -248,7 +248,7 @@ return NULL; } else { - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); } /* Is current point last in contour? If so process it. */ @@ -1605,9 +1605,9 @@ if (!newone) return pcb_false; many = pcb_true; - v = &p->contours->head; + v = p->contours->head; pcb_poly_point_new(newone, v->point[0], v->point[1]); - for (v = v->next; v != &p->contours->head; v = v->next) + for (v = v->next; v != p->contours->head; v = v->next) pcb_poly_point_new(newone, v->point[0], v->point[1]); newone->BoundingBox.X1 = p->contours->xmin; newone->BoundingBox.X2 = p->contours->xmax + 1; @@ -1638,11 +1638,11 @@ { pcb_vnode_t *v; pcb_fprintf(stderr, "\txmin %#mS xmax %#mS ymin %#mS ymax %#mS\n", pl->xmin, pl->xmax, pl->ymin, pl->ymax); - v = &pl->head; + v = pl->head; while (v) { pcb_fprintf(stderr, "\t\tvnode: %#mD\n", v->point[0], v->point[1]); v = v->next; - if (v == &pl->head) + if (v == pl->head) break; } } @@ -1705,11 +1705,11 @@ pcb_poly_hole_new(Polygon); outer = pcb_false; - node = &pline->head; + node = pline->head; do { pcb_poly_point_new(Polygon, node->point[0], node->point[1]); } - while ((node = node->next) != &pline->head); + while ((node = node->next) != pline->head); } while ((pline = pline->next) != NULL); @@ -1735,7 +1735,7 @@ pcb_coord_t x[4], y[4]; pcb_vnode_t *v; - v = pl->head.next; + v = pl->head->next; n = 0; do { x[n] = v->point[0]; @@ -1742,7 +1742,7 @@ y[n] = v->point[1]; n++; v = v->next; - } while((n < 4) && (v != pl->head.next)); + } while((n < 4) && (v != pl->head->next)); if (n != 4) return pcb_false; Index: trunk/src/polygon1.c =================================================================== --- trunk/src/polygon1.c (revision 28425) +++ trunk/src/polygon1.c (revision 28426) @@ -165,7 +165,7 @@ do { pl = p->contours; do { - pline_dump(&pl->head); + pline_dump(pl->head); fprintf(stderr, "NEXT pcb_pline_t\n"); } while ((pl = pl->next) != NULL); @@ -440,7 +440,7 @@ */ static pcb_cvc_list_t *add_descriptors(pcb_pline_t * pl, char poly, pcb_cvc_list_t * list) { - pcb_vnode_t *node = &pl->head; + pcb_vnode_t *node = pl->head; do { if (node->cvc_prev) { @@ -453,7 +453,7 @@ return NULL; } } - while ((node = node->next) != &pl->head); + while ((node = node->next) != pl->head); return list; } @@ -636,7 +636,7 @@ struct seg *s; pcb_vnode_t *bv; pcb_rtree_t *ans = pcb_r_create_tree(); - bv = &pb->head; + bv = pb->head; do { s = (seg *) malloc(sizeof(struct seg)); s->intersected = 0; @@ -660,7 +660,7 @@ s->p = pb; pcb_r_insert_entry(ans, (const pcb_box_t *) s); } - while ((bv = bv->next) != &pb->head); + while ((bv = bv->next) != pb->head); return (void *) ans; } @@ -724,7 +724,7 @@ looping_over = pb; } - av = &looping_over->head; + av = looping_over->head; do { /* Loop over the nodes in the smaller contour */ pcb_r_dir_t rres; /* check this edge for any insertions */ @@ -761,7 +761,7 @@ assert(0); /* XXX: Memory allocation failure */ } } - while ((av = av->next) != &looping_over->head); + while ((av = av->next) != looping_over->head); c_info->node_insert_list = info.node_insert_list; if (info.need_restart) @@ -979,12 +979,12 @@ #ifdef DEBUG_ALL_LABELS static void print_labels(pcb_pline_t * a) { - pcb_vnode_t *c = &a->head; + pcb_vnode_t *c = a->head; do { DEBUGP("%#mD->%#mD labeled %s\n", c->point[0], c->point[1], c->next->point[0], c->next->point[1], theState(c)); } - while ((c = c->next) != &a->head); + while ((c = c->next) != a->head); } #endif #endif @@ -998,7 +998,7 @@ static pcb_bool label_contour(pcb_pline_t * a) { - pcb_vnode_t *cur = &a->head; + pcb_vnode_t *cur = a->head; pcb_vnode_t *first_labelled = NULL; int label = UNKNWN; @@ -1481,7 +1481,7 @@ else { if ((newn = pcb_poly_node_create(cur->point)) == NULL) return pcb_err_no_memory; - pcb_poly_vertex_include((*result)->head.prev, newn); + pcb_poly_vertex_include((*result)->head->prev, newn); } #ifdef DEBUG_GATHER DEBUGP("gather vertex at %#mD\n", cur->point[0], cur->point[1]); @@ -1532,7 +1532,7 @@ pcb_vnode_t *cur, *other; DIRECTION dir; - cur = &a->head; + cur = a->head; do { if (s_rule(cur, &dir) && cur->Flags.mark == 0) Collect1(e, cur, dir, contours, holes, j_rule); @@ -1540,7 +1540,7 @@ if ((other->cvc_prev && jump(&other, &dir, j_rule))) Collect1(e, other, dir, contours, holes, j_rule); } - while ((cur = cur->next) != &a->head); + while ((cur = cur->next) != a->head); } /* Collect */ @@ -2156,11 +2156,11 @@ do { for (c = n->contours; c; c = c->next) { - v = &c->head; + v = c->head; do { v->Flags.mark = 0; } - while ((v = v->next) != &c->head); + while ((v = v->next) != c->head); } } while ((n = n->f) != p); @@ -2257,7 +2257,9 @@ if (c == NULL) return; /* bzero (c, sizeof(pcb_pline_t)); */ - c->head.next = c->head.prev = &c->head; + if (c->head == NULL) + c->head = calloc(sizeof(pcb_vnode_t), 1); + c->head->next = c->head->prev = c->head; c->xmin = c->ymin = COORD_MAX; c->xmax = c->ymax = -COORD_MAX-1; c->is_round = pcb_false; @@ -2277,7 +2279,9 @@ pcb_poly_contour_init(res); if (v != NULL) { - Vcopy(res->head.point, v); + res->head = calloc(sizeof(pcb_vnode_t), 1); + res->head->next = res->head->prev = res->head; + Vcopy(res->head->point, v); cntrbox_adjust(res, v); } @@ -2289,10 +2293,12 @@ pcb_vnode_t *cur; assert(c != NULL); - while ((cur = c->head.next) != &c->head) { + while ((cur = c->head->next) != c->head) { pcb_poly_vertex_exclude(cur); free(cur); } + free(c->head); + c->head = NULL; pcb_poly_contour_init(c); } @@ -2302,7 +2308,7 @@ if (*c == NULL) return; - for (cur = (*c)->head.prev; cur != &(*c)->head; cur = prev) { + for (cur = (*c)->head->prev; cur != (*c)->head; cur = prev) { prev = cur->prev; if (cur->cvc_next != NULL) { free(cur->cvc_next); @@ -2310,9 +2316,9 @@ } free(cur); } - if ((*c)->head.cvc_next != NULL) { - free((*c)->head.cvc_next); - free((*c)->head.cvc_prev); + if ((*c)->head->cvc_next != NULL) { + free((*c)->head->cvc_next); + free((*c)->head->cvc_prev); } /* FIXME -- strict aliasing violation. */ if ((*c)->tree) { @@ -2320,6 +2326,7 @@ pcb_r_free_tree_data(r, free); pcb_r_destroy_tree(&r); } + free((*c)->head); free(*c), *c = NULL; } @@ -2332,7 +2339,7 @@ assert(C != NULL); if (optimize) { - for (c = (p = &C->head)->next; c != &C->head; c = (p = c)->next) { + for (c = (p = C->head)->next; c != C->head; c = (p = c)->next) { /* if the previous node is on the same line with this one, we should remove it */ Vsub2(p1, c->point, p->point); Vsub2(p2, c->next->point, c->point); @@ -2350,10 +2357,10 @@ } } C->Count = 0; - C->xmin = C->xmax = C->head.point[0]; - C->ymin = C->ymax = C->head.point[1]; + C->xmin = C->xmax = C->head->point[0]; + C->ymin = C->ymax = C->head->point[1]; - p = (c = &C->head)->prev; + p = (c = C->head)->prev; if (c != p) { do { /* calculate area for orientation */ @@ -2361,7 +2368,7 @@ cntrbox_adjust(C, c->point); C->Count++; } - while ((c = (p = c)->next) != &C->head); + while ((c = (p = c)->next) != C->head); } C->area = PCB_ABS(area); if (C->Count > 2) @@ -2382,7 +2389,7 @@ int r; assert(c != NULL); - cur = &c->head; + cur = c->head; do { next = cur->next; cur->next = cur->prev; @@ -2389,7 +2396,7 @@ cur->prev = next; /* fix the segment tree */ } - while ((cur = next) != &c->head); + while ((cur = next) != c->head); c->Flags.orient ^= 1; if (c->tree) { pcb_r_search(c->tree, NULL, NULL, flip_cb, NULL, &r); @@ -2450,7 +2457,7 @@ assert(src != NULL); *dst = NULL; - *dst = pcb_poly_contour_new(src->head.point); + *dst = pcb_poly_contour_new(src->head->point); if (*dst == NULL) return pcb_false; @@ -2460,11 +2467,11 @@ (*dst)->ymin = src->ymin, (*dst)->ymax = src->ymax; (*dst)->area = src->area; - for (cur = src->head.next; cur != &src->head; cur = cur->next) { + for (cur = src->head->next; cur != src->head; cur = cur->next) { if ((newnode = pcb_poly_node_create(cur->point)) == NULL) return pcb_false; /* newnode->Flags = cur->Flags; */ - pcb_poly_vertex_include((*dst)->head.prev, newnode); + pcb_poly_vertex_include((*dst)->head->prev, newnode); } (*dst)->tree = (pcb_rtree_t *) pcb_poly_make_edge_tree(*dst); return pcb_true; @@ -2728,7 +2735,7 @@ double dir = (poly->Flags.orient == PCB_PLF_DIR) ? 1. : -1; /* Find a convex node on the polygon */ - pt1 = &poly->head; + pt1 = poly->head; do { double dot_product; @@ -2740,7 +2747,7 @@ if (dot_product * dir > 0.) break; } - while ((pt1 = pt1->next) != &poly->head); + while ((pt1 = pt1->next) != poly->head); /* Loop over remaining vertices */ q = pt3; @@ -2788,7 +2795,7 @@ /* We need to prove the "inner" contour is not outside * "poly" contour. If it is outside, we can return. */ - if (!pcb_poly_contour_inside(poly, inner->head.point)) + if (!pcb_poly_contour_inside(poly, inner->head->point)) return 0; poly_ComputeInteriorPoint(inner, point); @@ -2920,7 +2927,7 @@ res->marks = res->lines = 0; assert(a != NULL); - a1 = &a->head; + a1 = a->head; do { a2 = a1; do { @@ -2987,9 +2994,9 @@ } } } - while ((a2 = a2->next) != &a->head); + while ((a2 = a2->next) != a->head); } - while ((a1 = a1->next) != &a->head); + while ((a1 = a1->next) != a->head); return pcb_false; } @@ -3088,7 +3095,7 @@ if (p->contours->Flags.orient == PCB_PLF_INV) { #ifndef NDEBUG pcb_fprintf(stderr, "Invalid Outer pcb_pline_t: failed orient\n"); - pcb_poly_valid_report(p->contours, &p->contours->head, NULL); + pcb_poly_valid_report(p->contours, p->contours->head, NULL); #endif return pcb_false; } @@ -3096,7 +3103,7 @@ if (pcb_polyarea_contour_check_(p->contours, &chk)) { #ifndef NDEBUG pcb_fprintf(stderr, "Invalid Outer pcb_pline_t: failed contour check\n"); - pcb_poly_valid_report(p->contours, &p->contours->head, &chk); + pcb_poly_valid_report(p->contours, p->contours->head, &chk); #endif return pcb_false; } @@ -3105,7 +3112,7 @@ if (c->Flags.orient == PCB_PLF_DIR) { #ifndef NDEBUG pcb_fprintf(stderr, "Invalid Inner: pcb_pline_t orient = %d\n", c->Flags.orient); - pcb_poly_valid_report(c, &c->head, NULL); + pcb_poly_valid_report(c, c->head, NULL); #endif return pcb_false; } @@ -3112,7 +3119,7 @@ if (pcb_polyarea_contour_check_(c, &chk)) { #ifndef NDEBUG pcb_fprintf(stderr, "Invalid Inner: failed contour check\n"); - pcb_poly_valid_report(c, &c->head, &chk); + pcb_poly_valid_report(c, c->head, &chk); #endif return pcb_false; } @@ -3119,7 +3126,7 @@ if (!pcb_poly_contour_in_contour(p->contours, c)) { #ifndef NDEBUG pcb_fprintf(stderr, "Invalid Inner: overlap with outer\n"); - pcb_poly_valid_report(c, &c->head, NULL); + pcb_poly_valid_report(c, c->head, NULL); #endif return pcb_false; } @@ -3534,8 +3541,8 @@ for(pl = pa->contours; pl != NULL; pl = pl->next) { pcb_vnode_t *v; int cnt2 = 0; - for(v = &pl->head; v != NULL; v = v->next) { - if (v == &pl->head) { + for(v = pl->head; v != NULL; v = v->next) { + if (v == pl->head) { cnt2++; if (cnt2 > 1) break; Index: trunk/src/polygon1_gen.c =================================================================== --- trunk/src/polygon1_gen.c (revision 28425) +++ trunk/src/polygon1_gen.c (revision 28426) @@ -128,7 +128,7 @@ ang += da; v[0] = cx - rx * cos(ang * PCB_M180); v[1] = cy + ry * sin(ang * PCB_M180); - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); } /* find last point */ ang = astart + adelta; @@ -146,7 +146,7 @@ for (i = 0; i < segs; i++) { v[0] = cx - rx * cos(ang * PCB_M180); v[1] = cy + ry * sin(ang * PCB_M180); - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); ang += da; } @@ -159,7 +159,7 @@ if (edx < 0) edx = -edx; if (edy < 0) edy = -edy; if (edx+edy > PCB_MM_TO_COORD(0.001)) - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v2)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v2)); /* now add other round cap */ @@ -187,13 +187,13 @@ return NULL; v[0] = x2; v[1] = y1; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); v[0] = x2; v[1] = y2; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); v[0] = x1; v[1] = y2; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); return pcb_poly_from_contour(contour); } @@ -214,31 +214,31 @@ /* point 6 */ v[0] = x + ROUND(radius * PCB_TAN_22_5_DEGREE_2) * xm[6]; v[1] = y + ROUND(radius * 0.5) * ym[6]; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); /* point 5 */ v[0] = x - ROUND(radius * PCB_TAN_22_5_DEGREE_2) * xm[5]; v[1] = y + ROUND(radius * 0.5) * ym[5]; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); /* point 4 */ v[0] = x - ROUND(radius * 0.5) * xm[4]; v[1] = y + ROUND(radius * PCB_TAN_22_5_DEGREE_2) * ym[4]; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); /* point 3 */ v[0] = x - ROUND(radius * 0.5) * xm[3]; v[1] = y - ROUND(radius * PCB_TAN_22_5_DEGREE_2) * ym[3]; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); /* point 2 */ v[0] = x - ROUND(radius * PCB_TAN_22_5_DEGREE_2) * xm[2]; v[1] = y - ROUND(radius * 0.5) * ym[2]; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); /* point 1 */ v[0] = x + ROUND(radius * PCB_TAN_22_5_DEGREE_2) * xm[1]; v[1] = y - ROUND(radius * 0.5) * ym[1]; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); /* point 0 */ v[0] = x + ROUND(radius * 0.5) * xm[0]; v[1] = y - ROUND(radius * PCB_TAN_22_5_DEGREE_2) * ym[0]; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); return pcb_poly_from_contour(contour); } @@ -252,7 +252,7 @@ oe1 = (v[0] - X); oe2 = (v[1] - Y); - pcb_poly_vertex_include(c->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(c->head->prev, pcb_poly_node_create(v)); /* move vector to origin */ e1 = (v[0] - X) * PCB_POLY_CIRC_RADIUS_ADJ; @@ -267,13 +267,13 @@ e1 = t1; v[0] = X + ROUND(e1); v[1] = Y + ROUND(e2); - pcb_poly_vertex_include(c->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(c->head->prev, pcb_poly_node_create(v)); } if ((add_last) && (orange == 4)) { v[0] = X - ROUND(oe2); v[1] = Y + ROUND(oe1); - pcb_poly_vertex_include(c->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(c->head->prev, pcb_poly_node_create(v)); } } @@ -332,15 +332,15 @@ pcb_poly_frac_circle_end(contour, x1, y1, v, 4); v[0] = x2; v[1] = y1 - t; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); pcb_poly_frac_circle_end(contour, x2, y1, v, 4); v[0] = x2 + t; v[1] = y2; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); pcb_poly_frac_circle_end(contour, x2, y2, v, 4); v[0] = x1; v[1] = y2 + t; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); pcb_poly_frac_circle_end(contour, x1, y2, v, 4); return pcb_poly_from_contour(contour); } @@ -383,16 +383,16 @@ v[0] = x2 - dx; v[1] = y2 - dy; if (square) - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); else pcb_poly_frac_circle(contour, x2, y2, v, 2); v[0] = x2 + dx; v[1] = y2 + dy; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); v[0] = x1 + dx; v[1] = y1 + dy; if (square) - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); else pcb_poly_frac_circle(contour, x1, y1, v, 2); /* now we have the line contour */ Index: trunk/src/polygon_offs.c =================================================================== --- trunk/src/polygon_offs.c (revision 28425) +++ trunk/src/polygon_offs.c (revision 28426) @@ -142,15 +142,15 @@ pcb_polo_t *pcsh; /* count corners */ - v = &src->head; + v = src->head; num_pts = 0; do { num_pts++; - } while((v = v->next) != &src->head); + } while((v = v->next) != src->head); /* allocate the cache and copy all data */ pcsh = malloc(sizeof(pcb_polo_t) * num_pts); - for(n = 0, v = &src->head; n < num_pts; n++, v = v->next) { + for(n = 0, v = src->head; n < num_pts; n++, v = v->next) { pcsh[n].x = v->point[0]; pcsh[n].y = v->point[1]; pcb_polo_norm(&pcsh[n].nx, &pcsh[n].ny, v->point[0], v->point[1], v->next->point[0], v->next->point[1]); @@ -167,7 +167,7 @@ for(n = 1; n < num_pts; n++) { tmp[0] = pcb_round(pcsh[n].x); tmp[1] = pcb_round(pcsh[n].y); - pcb_poly_vertex_include(res->head.prev, pcb_poly_node_create(tmp)); + pcb_poly_vertex_include(res->head->prev, pcb_poly_node_create(tmp)); } free(pcsh); @@ -318,7 +318,7 @@ /* there are two ways dst can get too close to src: */ /* case #1: a point in dst is too close to a line in src */ - v = &dst->head; + v = dst->head; do { pcb_rtree_it_t it; pcb_rtree_box_t pb; @@ -403,16 +403,16 @@ goto retry; } } - } while((v = v->next) != &dst->head); + } while((v = v->next) != dst->head); /* case #2: a line in dst is too close to a point in src */ /* cleanup: remove redundant points */ - v = &dst->head; + v = dst->head; do { if ((v->prev->point[0] == v->point[0]) && (v->prev->point[1] == v->point[1])) { - if (v->prev == &dst->head) { + if (v->prev == dst->head) { pcb_vnode_t *nv = v->next; pcb_poly_vertex_exclude(v); v = nv; @@ -420,6 +420,6 @@ } pcb_poly_vertex_exclude(v->prev); } - } while((v = v->next) != &dst->head); + } while((v = v->next) != dst->head); } Index: trunk/src/polygon_selfi.c =================================================================== --- trunk/src/polygon_selfi.c (revision 28425) +++ trunk/src/polygon_selfi.c (revision 28426) @@ -161,10 +161,10 @@ next = v->next; pcb_poly_vertex_exclude(v); tmp = pcb_poly_node_create(v->point); - pcb_poly_vertex_include(newpl->head.prev, tmp); + pcb_poly_vertex_include(newpl->head->prev, tmp); } -TRACE("APPEND: %p %p\n", newpl, newpl->head.next); +TRACE("APPEND: %p %p\n", newpl, newpl->head->next); vtp0_append(out, newpl); return 1; } @@ -207,7 +207,7 @@ { pcb_vnode_t *va, *vb; - va = (pcb_vnode_t *)&pl->head; + va = (pcb_vnode_t *)pl->head; do { for(vb = va->next->next; vb->next != va; vb = vb->next) { pcb_vector_t i, tmp; @@ -215,7 +215,7 @@ return pcb_true; } va = va->next; - } while (va != &pl->head); + } while (va != pl->head); return pcb_false; } @@ -231,14 +231,14 @@ /* copy the pline and reset the in_hub flag */ pcb_poly_contour_copy(&pl, pl_in); - va = (pcb_vnode_t *)&pl->head; + va = (pcb_vnode_t *)pl->head; do { va->Flags.in_hub = 0; va = va->next; - } while (va != &pl->head); + } while (va != pl->head); /* insert corners at intersections, collect a list of intersection hubs */ - va = (pcb_vnode_t *)&pl->head; + va = (pcb_vnode_t *)pl->head; do { for(vb = va->next->next; vb->next != va; vb = vb->next) { pcb_vector_t i, tmp; @@ -254,7 +254,7 @@ } } va = va->next; - } while (va != &pl->head); + } while (va != pl->head); /*for(t = MAX_HUB_TRIES; t > 0; t--)*/ { retry:; Index: trunk/src_plugins/export_fidocadj/fidocadj.c =================================================================== --- trunk/src_plugins/export_fidocadj/fidocadj.c (revision 28425) +++ trunk/src_plugins/export_fidocadj/fidocadj.c (revision 28426) @@ -228,11 +228,11 @@ pcb_io_incompat_save(PCB->Data, (pcb_any_obj_t *)polygon, "polygon", "FidoCadJ can't handle holes in polygons, ignoring holes for this export", "(some of the polygons will look different unless you remove the holes or split up the polygons)"); } - fprintf(f, "PP %ld %ld", crd(pl->head.point[0]), crd(pl->head.point[1])); - v = pl->head.next; + fprintf(f, "PP %ld %ld", crd(pl->head->point[0]), crd(pl->head->point[1])); + v = pl->head->next; do { fprintf(f, " %ld %ld", crd(v->point[0]), crd(v->point[1])); - } while ((v = v->next) != pl->head.next); + } while ((v = v->next) != pl->head->next); fprintf(f, " %d\n", fidoly); } PCB_END_LOOP; Index: trunk/src_plugins/io_autotrax/write.c =================================================================== --- trunk/src_plugins/io_autotrax/write.c (revision 28425) +++ trunk/src_plugins/io_autotrax/write.c (revision 28426) @@ -602,11 +602,11 @@ if (pl != NULL) { const pcb_vnode_t *v, *n; track = pcb_pline_dup_offset(pl, -((Thickness / 2) + 1)); - v = &track->head; + v = track->head; do { n = v->next; wrax_pline_segment(ctx, v->point[0]+dx, v->point[1]+dy, n->point[0]+dx, n->point[1]+dy, Thickness, current_layer); - } while((v = v->next) != &track->head); + } while((v = v->next) != track->head); pcb_poly_contour_del(&track); /* iterate over all holes within this island */ @@ -613,11 +613,11 @@ for(pl = pcb_poly_hole_first(&poly_it); pl != NULL; pl = pcb_poly_hole_next(&poly_it)) { const pcb_vnode_t *v, *n; track = pcb_pline_dup_offset(pl, -((Thickness / 2) + 1)); - v = &track->head; + v = track->head; do { n = v->next; wrax_pline_segment(ctx, v->point[0]+dx, v->point[1]+dy, n->point[0]+dx, n->point[1]+dy, Thickness, current_layer); - } while((v = v->next) != &track->head); + } while((v = v->next) != track->head); pcb_poly_contour_del(&track); } } Index: trunk/src_plugins/io_hyp/parser.c =================================================================== --- trunk/src_plugins/io_hyp/parser.c (revision 28425) +++ trunk/src_plugins/io_hyp/parser.c (revision 28426) @@ -1038,7 +1038,7 @@ /* add first point to contour */ v[0] = x1; v[1] = y1; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); /* intermediate points */ for (i = 1; i < poly_points; i++) { @@ -1045,13 +1045,13 @@ double angle = alpha + (beta - alpha) * i / poly_points; v[0] = xc + r * cos(angle); v[1] = yc + r * sin(angle); - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); } /* last point */ v[0] = x2; v[1] = y2; - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); return; } @@ -1187,7 +1187,7 @@ else { if (!vrtx->is_arc) /* line. add vertex to contour */ - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); else /* arc. pcb polyarea contains line segments, not arc segments. convert arc segment to line segments. */ hyp_arc2contour(contour, vrtx->x1, vrtx->y1, vrtx->x2, vrtx->y2, vrtx->xc, vrtx->yc, vrtx->r, pcb_false); Index: trunk/src_plugins/io_hyp/write.c =================================================================== --- trunk/src_plugins/io_hyp/write.c (revision 28425) +++ trunk/src_plugins/io_hyp/write.c (revision 28426) @@ -292,7 +292,7 @@ pl = poly->Clipped->contours; do { - v = pl->head.next; + v = pl->head->next; if (pl == poly->Clipped->contours) pcb_fprintf(wr->f, " {POLYGON L=%[4] T=POUR W=0.0 ID=%d X=%me Y=%me\n", @@ -301,10 +301,10 @@ /* hole. Use same ID as polygon. */ pcb_fprintf(wr->f, " {POLYVOID ID=%d X=%me Y=%me\n", wr->poly_id, v->point[0], flip(v->point[1])); - for (v = v->next; v != pl->head.next; v = v->next) + for (v = v->next; v != pl->head->next; v = v->next) pcb_fprintf(wr->f, " (LINE X=%me Y=%me)\n", v->point[0], flip(v->point[1])); - v = pl->head.next; /* repeat first point */ + v = pl->head->next; /* repeat first point */ pcb_fprintf(wr->f, " (LINE X=%me Y=%me)\n", v->point[0], flip(v->point[1])); fprintf(wr->f, " }\n"); Index: trunk/src_plugins/io_tedax/tlayer.c =================================================================== --- trunk/src_plugins/io_tedax/tlayer.c (revision 28425) +++ trunk/src_plugins/io_tedax/tlayer.c (revision 28426) @@ -75,7 +75,7 @@ long i, n; fprintf(f, "begin polyline v1 pllay_%ld_%ld_%ld\n", gid, polygon->ID, plid); n = pl->Count; - for(v = &pl->head, i = 0; i < n; v = v->next, i++) + for(v = pl->head, i = 0; i < n; v = v->next, i++) pcb_fprintf(f, " v %.06mm %.06mm\n", v->point[0], v->point[1]); fprintf(f, "end polyline\n"); } Index: trunk/src_plugins/jostle/jostle.c =================================================================== --- trunk/src_plugins/jostle/jostle.c (revision 28425) +++ trunk/src_plugins/jostle/jostle.c (revision 28426) @@ -92,7 +92,7 @@ n = pl->Count; x = (int *) malloc(n * sizeof(int)); y = (int *) malloc(n * sizeof(int)); - for (v = &pl->head; i < n; v = v->next) { + for (v = pl->head; i < n; v = v->next) { x[i] = v->point[0]; y[i++] = v->point[1]; } @@ -219,7 +219,7 @@ pcb_message(PCB_MSG_ERROR, "jostle: aiee, what side?"); return; } - v = &a->contours->head; + v = a->contours->head; do { int test = kx * v->point[0] + ky * v->point[1]; if (test < mm[0]) { @@ -232,7 +232,7 @@ mmp[1][0] = v->point[0]; mmp[1][1] = v->point[1]; } - } while ((v = v->next) != &a->contours->head); + } while ((v = v->next) != a->contours->head); Vcpy2(p, mmp[minmax]); /* add clearance in the right direction */ clearance *= 0.707123; /* = cos(45) = sqrt(2)/2 */ Index: trunk/src_plugins/lib_polyhelp/polyhelp.c =================================================================== --- trunk/src_plugins/lib_polyhelp/polyhelp.c (revision 28425) +++ trunk/src_plugins/lib_polyhelp/polyhelp.c (revision 28426) @@ -54,12 +54,12 @@ { const pcb_vnode_t *v, *n; fprintf(f, "!pline start\n"); - v = &pl->head; + v = pl->head; do { n = v->next; pcb_fprintf(f, "line %#mm %#mm %#mm %#mm\n", v->point[0], v->point[1], n->point[0], n->point[1]); } - while((v = v->next) != &pl->head); + while((v = v->next) != pl->head); fprintf(f, "!pline end\n"); } @@ -86,13 +86,13 @@ const pcb_vnode_t *v, *n; pcb_pline_t *track = tracks.array[i]; - v = &track->head; + v = track->head; do { n = v->next; pcb_line_new(dst, v->point[0], v->point[1], n->point[0], n->point[1], thickness, clearance, flags); cnt++; } - while((v = v->next) != &track->head); + while((v = v->next) != track->head); pcb_poly_contour_del(&track); } @@ -104,13 +104,13 @@ { const pcb_vnode_t *v, *n; - v = &src->head; + v = src->head; do { n = v->next; if ((v->point[0] != n->point[0]) && (v->point[1] != n->point[1])) return pcb_false; } - while((v = v->next) != &src->head); + while((v = v->next) != src->head); return pcb_true; } Index: trunk/src_plugins/polycombine/polycombine.c =================================================================== --- trunk/src_plugins/polycombine/polycombine.c (revision 28425) +++ trunk/src_plugins/polycombine/polycombine.c (revision 28426) @@ -57,7 +57,7 @@ return NULL; } else { - pcb_poly_vertex_include(contour->head.prev, pcb_poly_node_create(v)); + pcb_poly_vertex_include(contour->head->prev, pcb_poly_node_create(v)); } /* Is current point last in contour? If so process it. */