Index: trunk/doc-rnd/TODO =================================================================== --- trunk/doc-rnd/TODO (revision 1208) +++ trunk/doc-rnd/TODO (revision 1209) @@ -12,9 +12,11 @@ - buffer element breakup double frees? - drawing new rats cause double free? - test onpoint + - fix up dependencies: make clean in src_3rd subdirs and check what breaks - get rid of gcode/lists.h, ds.[ch] and vector.[ch] + BUGS - gpmi (and other buildings/plugins) not showing up in the about box Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 1208) +++ trunk/src/crosshair.c (revision 1209) @@ -958,8 +958,8 @@ struct snap_data snap_data; int ans; - Crosshair.X = CLAMP(X, Crosshair.MinX, Crosshair.MaxX); - Crosshair.Y = CLAMP(Y, Crosshair.MinY, Crosshair.MaxY); + Crosshair.X = PCB_CLAMP(X, Crosshair.MinX, Crosshair.MaxX); + Crosshair.Y = PCB_CLAMP(Y, Crosshair.MinY, Crosshair.MaxY); if (PCB->RatDraw) { nearest_grid_x = -MIL_TO_COORD(6); @@ -972,7 +972,7 @@ if (Marked.status && TEST_FLAG(ORTHOMOVEFLAG, PCB)) { Coord dx = Crosshair.X - Marked.X; Coord dy = Crosshair.Y - Marked.Y; - if (ABS(dx) > ABS(dy)) + if (PCB_ABS(dx) > PCB_ABS(dy)) nearest_grid_y = Marked.Y; else nearest_grid_x = Marked.X; Index: trunk/src/file.c =================================================================== --- trunk/src/file.c (revision 1208) +++ trunk/src/file.c (revision 1209) @@ -395,8 +395,8 @@ if (!is_misc) { /* update cursor location */ - Crosshair.X = CLAMP(PCB->CursorX, 0, PCB->MaxWidth); - Crosshair.Y = CLAMP(PCB->CursorY, 0, PCB->MaxHeight); + Crosshair.X = PCB_CLAMP(PCB->CursorX, 0, PCB->MaxWidth); + Crosshair.Y = PCB_CLAMP(PCB->CursorY, 0, PCB->MaxHeight); /* update cursor confinement and output area (scrollbars) */ ChangePCBSize(PCB->MaxWidth, PCB->MaxHeight); Index: trunk/src/find.c =================================================================== --- trunk/src/find.c (revision 1208) +++ trunk/src/find.c (revision 1209) @@ -1671,7 +1671,6 @@ /* loop over all layers of the group */ for (entry = 0; entry < PCB->LayerGroups.Number[LayerGroup]; entry++) { Cardinal layer; - GList *i; layer = PCB->LayerGroups.Entries[LayerGroup][entry]; Index: trunk/src/fontmode.c =================================================================== --- trunk/src/fontmode.c (revision 1208) +++ trunk/src/fontmode.c (revision 1209) @@ -162,7 +162,6 @@ FontTypePtr font; SymbolTypePtr symbol; int i; - GList *ii; LineType *l; gdl_iterator_t it; LayerTypePtr lfont, lwidth; Index: trunk/src/global.h =================================================================== --- trunk/src/global.h (revision 1208) +++ trunk/src/global.h (revision 1209) @@ -55,9 +55,7 @@ #include #include #include -#include - #include "global_typedefs.h" #include "global_objs.h" #include "list_common.h" @@ -138,6 +136,14 @@ #endif /* --------------------------------------------------------------------------- + * Macros to annotate branch-prediction information. + * Taken from GLib 2.42.1 (LGPL 2). PCB_ prefixes have + * been added to avoid namespace clashes. + */ +#define PCB_CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) +#define PCB_ABS(a) (((a) < 0) ? -(a) : (a)) + +/* --------------------------------------------------------------------------- * some useful values of our widgets */ typedef struct { /* holds information about output window */ Index: trunk/src/hid/ps/ps.c =================================================================== --- trunk/src/hid/ps/ps.c (revision 1208) +++ trunk/src/hid/ps/ps.c (revision 1209) @@ -610,7 +610,7 @@ global.incolor = options[HA_color].int_value; global.bloat = options[HA_psbloat].int_value; global.invert = options[HA_psinvert].int_value; - global.fade_ratio = CLAMP(options[HA_psfade].real_value, 0, 1); + global.fade_ratio = PCB_CLAMP(options[HA_psfade].real_value, 0, 1); global.media_idx = options[HA_media].int_value; global.media_width = media_data[global.media_idx].Width; global.media_height = media_data[global.media_idx].Height; Index: trunk/src/main.c =================================================================== --- trunk/src/main.c (revision 1208) +++ trunk/src/main.c (revision 1209) @@ -1339,8 +1339,8 @@ if (Settings.ViaDrillingHole <= 0) Settings.ViaDrillingHole = DEFAULT_DRILLINGHOLE * Settings.ViaThickness / 100; - Settings.MaxWidth = CLAMP(Settings.MaxWidth, MIN_SIZE, MAX_COORD); - Settings.MaxHeight = CLAMP(Settings.MaxHeight, MIN_SIZE, MAX_COORD); + Settings.MaxWidth = PCB_CLAMP(Settings.MaxWidth, MIN_SIZE, MAX_COORD); + Settings.MaxHeight = PCB_CLAMP(Settings.MaxHeight, MIN_SIZE, MAX_COORD); if (Settings.Routes != NULL) ParseRouteString(Settings.Routes, &Settings.RouteStyle[0], "cmil"); Index: trunk/src/misc.c =================================================================== --- trunk/src/misc.c (revision 1208) +++ trunk/src/misc.c (revision 1209) @@ -840,7 +840,7 @@ char *make_route_string(RouteStyleType rs[], int n_styles) { gds_t str; - gint i; + int i; gds_init(&str); for (i = 0; i < n_styles; ++i) { @@ -1325,7 +1325,7 @@ /* first put angles into standard form: * ang1 < ang2, both angles between 0 and 720 */ - Arc->Delta = CLAMP(Arc->Delta, -360, 360); + Arc->Delta = PCB_CLAMP(Arc->Delta, -360, 360); if (Arc->Delta > 0) { ang1 = NormalizeAngle(Arc->StartAngle); Index: trunk/src/parse_l.c =================================================================== --- trunk/src/parse_l.c (revision 1208) +++ trunk/src/parse_l.c (revision 1209) @@ -2509,7 +2509,7 @@ static int parse_number () { - yylval.number = strtod ((gchar *) yytext, NULL); + yylval.number = strtod ((char *) yytext, NULL); return FLOATING; } Index: trunk/src/parse_l.l =================================================================== --- trunk/src/parse_l.l (revision 1208) +++ trunk/src/parse_l.l (revision 1209) @@ -390,7 +390,7 @@ static int parse_number () { - yylval.number = strtod ((gchar *) yytext, NULL); + yylval.number = strtod ((char *) yytext, NULL); return FLOATING; } Index: trunk/src/polygon1.c =================================================================== --- trunk/src/polygon1.c (revision 1208) +++ trunk/src/polygon1.c (revision 1209) @@ -2337,7 +2337,7 @@ } while ((c = (p = c)->next) != &C->head); } - C->area = ABS(area); + C->area = PCB_ABS(area); if (C->Count > 2) C->Flags.orient = ((area < 0) ? PLF_INV : PLF_DIR); C->tree = (rtree_t *) make_edge_tree(C); Index: trunk/src_plugins/autoplace/autoplace.c =================================================================== --- trunk/src_plugins/autoplace/autoplace.c (revision 1208) +++ trunk/src_plugins/autoplace/autoplace.c (revision 1209) @@ -559,8 +559,8 @@ case 0: { /* shift! */ Coord grid; - double scaleX = CLAMP(sqrt(T), MIL_TO_COORD(2.5), PCB->MaxWidth / 3); - double scaleY = CLAMP(sqrt(T), MIL_TO_COORD(2.5), PCB->MaxHeight / 3); + double scaleX = PCB_CLAMP(sqrt(T), MIL_TO_COORD(2.5), PCB->MaxWidth / 3); + double scaleY = PCB_CLAMP(sqrt(T), MIL_TO_COORD(2.5), PCB->MaxHeight / 3); pt.which = SHIFT; pt.DX = scaleX * 2 * ((((double) random()) / RAND_MAX) - 0.5); pt.DY = scaleY * 2 * ((((double) random()) / RAND_MAX) - 0.5); Index: trunk/src_plugins/autoroute/autoroute.c =================================================================== --- trunk/src_plugins/autoroute/autoroute.c (revision 1208) +++ trunk/src_plugins/autoroute/autoroute.c (revision 1209) @@ -959,10 +959,10 @@ LineType fake_line = *line; Coord dx = (line->Point2.X - line->Point1.X); Coord dy = (line->Point2.Y - line->Point1.Y); - int segs = MAX(ABS(dx), - ABS(dy)) / (4 * BLOAT(rd->styles[j]) + 1); + int segs = MAX(PCB_ABS(dx), + PCB_ABS(dy)) / (4 * BLOAT(rd->styles[j]) + 1); int qq; - segs = CLAMP(segs, 1, 32); /* don't go too crazy */ + segs = PCB_CLAMP(segs, 1, 32); /* don't go too crazy */ dx /= segs; dy /= segs; for (qq = 0; qq < segs - 1; qq++) { @@ -1074,9 +1074,9 @@ LineType fake_line = *line; Coord dx = (line->Point2.X - line->Point1.X); Coord dy = (line->Point2.Y - line->Point1.Y); - int segs = MAX(ABS(dx), ABS(dy)) / (4 * rd->max_bloat + 1); + int segs = MAX(PCB_ABS(dx), PCB_ABS(dy)) / (4 * rd->max_bloat + 1); int qq; - segs = CLAMP(segs, 1, 32); /* don't go too crazy */ + segs = PCB_CLAMP(segs, 1, 32); /* don't go too crazy */ dx /= segs; dy /= segs; for (qq = 0; qq < segs - 1; qq++) { @@ -1201,7 +1201,7 @@ x_dist *= x_cost[point_layer]; y_dist *= y_cost[point_layer]; /* cost is proportional to orthogonal distance. */ - r = ABS(x_dist) + ABS(y_dist); + r = PCB_ABS(x_dist) + PCB_ABS(y_dist); if (p1->X != p2->X && p1->Y != p2->Y) r += AutoRouteParameters.JogPenalty; return r; @@ -1227,8 +1227,8 @@ c1 = p2.X - p->X; c2 = p2.Y - p->Y; - c1 = ABS(c1); - c2 = ABS(c2); + c1 = PCB_ABS(c1); + c2 = PCB_ABS(c2); if (c1 < c2) return c1 * AutoRouteParameters.MinPenalty + c2; else @@ -1275,12 +1275,12 @@ trial += AutoRouteParameters.JogPenalty; /* special case for defered via searching */ if (point_layer > max_group || point_layer == rb->group) - return trial + ABS(p2.X - p->X) + ABS(p2.Y - p->Y); + return trial + PCB_ABS(p2.X - p->X) + PCB_ABS(p2.Y - p->Y); /* if this target is only a via away, then the via is cheaper than the congestion */ if (p->X == p2.X && p->Y == p2.Y) return trial + 1; trial += AutoRouteParameters.ViaCost; - trial += ABS(p2.X - p->X) + ABS(p2.Y - p->Y); + trial += PCB_ABS(p2.X - p->X) + PCB_ABS(p2.Y - p->Y); return trial; } @@ -2939,7 +2939,7 @@ return; /* but not this! */ rb = (routebox_t *) malloc(sizeof(*rb)); memset((void *) rb, 0, sizeof(*rb)); - assert(is_45 ? (ABS(qX2 - qX1) == ABS(qY2 - qY1)) /* line must be 45-degrees */ + assert(is_45 ? (PCB_ABS(qX2 - qX1) == PCB_ABS(qY2 - qY1)) /* line must be 45-degrees */ : (qX1 == qX2 || qY1 == qY2) /* line must be ortho */ ); init_const_box(rb, /*X1 */ MIN(qX1, qX2) - qhthick, @@ -3032,7 +3032,7 @@ } else { /* draw 45-degree path across knee */ - Coord len45 = MIN(ABS(start.X - end.X), ABS(start.Y - end.Y)); + Coord len45 = MIN(PCB_ABS(start.X - end.X), PCB_ABS(start.Y - end.Y)); CheapPointType kneestart = knee, kneeend = knee; if (kneestart.X == start.X) kneestart.Y += (kneestart.Y > start.Y) ? -len45 : len45; Index: trunk/src_plugins/autoroute/mtspace.c =================================================================== --- trunk/src_plugins/autoroute/mtspace.c (revision 1208) +++ trunk/src_plugins/autoroute/mtspace.c (revision 1209) @@ -197,7 +197,7 @@ CheapPointType p = *desired; assert(desired); closest_point_in_box(&p, newone); - heap_insert(heap, ABS(p.X - desired->X) + (p.Y - desired->Y), newone); + heap_insert(heap, PCB_ABS(p.X - desired->X) + (p.Y - desired->Y), newone); } static inline void append(struct query_closure *qc, BoxType * newone) Index: trunk/src_plugins/edif/edif.c =================================================================== --- trunk/src_plugins/edif/edif.c (revision 1208) +++ trunk/src_plugins/edif/edif.c (revision 1209) @@ -6186,7 +6186,7 @@ cc = (ContextCar *) Malloc(sizeof(ContextCar)); cc->Next = cxt->Context; (cxt->Context = cc)->Context = - FindContext(ABS(BinderDef[i].Follower[j])); + FindContext(PCB_ABS(BinderDef[i].Follower[j])); cc->u.Single = BinderDef[i].Follower[j] < 0; } } Index: trunk/src_plugins/edif/edif.y =================================================================== --- trunk/src_plugins/edif/edif.y (revision 1208) +++ trunk/src_plugins/edif/edif.y (revision 1209) @@ -4108,7 +4108,7 @@ cc = (ContextCar *) Malloc(sizeof(ContextCar)); cc->Next = cxt->Context; (cxt->Context = cc)->Context = - FindContext(ABS(BinderDef[i].Follower[j])); + FindContext(PCB_ABS(BinderDef[i].Follower[j])); cc->u.Single = BinderDef[i].Follower[j] < 0; } } Index: trunk/src_plugins/puller/puller.c =================================================================== --- trunk/src_plugins/puller/puller.c (revision 1208) +++ trunk/src_plugins/puller/puller.c (revision 1209) @@ -54,8 +54,8 @@ #include #include #include +#include - #include "create.h" #include "data.h" #include "draw.h" Index: trunk/src_plugins/toporouter/toporouter.h =================================================================== --- trunk/src_plugins/toporouter/toporouter.h (revision 1208) +++ trunk/src_plugins/toporouter/toporouter.h (revision 1209) @@ -28,6 +28,7 @@ #define PCB_TOPOROUTER_H #include +#include #include "data.h" #include "macro.h" #include "../autoroute/autoroute.h"