Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 1179) +++ trunk/src/buffer.c (revision 1180) @@ -224,10 +224,8 @@ RestoreToPolygon(Source, VIA_TYPE, via, via); r_delete_entry(Source->via_tree, (BoxType *) via); - Source->Via = g_list_remove(Source->Via, via); - Source->ViaN--; - Dest->Via = g_list_append(Dest->Via, via); - Dest->ViaN++; + pinlist_remove(via); + pinlist_append(&Dest->Via, via); CLEAR_FLAG(WARNFLAG | FOUNDFLAG, via); Index: trunk/src/copy.c =================================================================== --- trunk/src/copy.c (revision 1179) +++ trunk/src/copy.c (revision 1180) @@ -344,7 +344,7 @@ /* finally the vias */ if (PCB->ViaOn) { - changed |= (PASTEBUFFER->Data->ViaN != 0); + changed |= (pinlist_length(&(PASTEBUFFER->Data->Via)) != 0); VIA_LOOP(PASTEBUFFER->Data); { CopyVia(via); Index: trunk/src/file.c =================================================================== --- trunk/src/file.c (revision 1179) +++ trunk/src/file.c (revision 1180) @@ -616,10 +616,11 @@ */ static void WriteViaData(FILE * FP, DataTypePtr Data) { - GList *iter; + gdl_iterator_t it; + PinType *via; + /* write information about vias */ - for (iter = Data->Via; iter != NULL; iter = g_list_next(iter)) { - PinType *via = iter->data; + pinlist_foreach(&Data->Via, &it, via) { pcb_fprintf(FP, "Via[%mr %mr %mr %mr %mr %mr ", via->X, via->Y, via->Thickness, via->Clearance, via->Mask, via->DrillingHole); PrintQuotedString(FP, (char *) EMPTY(via->Name)); Index: trunk/src/global.h =================================================================== --- trunk/src/global.h (revision 1179) +++ trunk/src/global.h (revision 1180) @@ -209,11 +209,10 @@ } LayerType, *LayerTypePtr; typedef struct { /* holds all objects */ - Cardinal ViaN, /* number of vias */ - ElementN, /* and elements */ + Cardinal ElementN, /* and elements */ RatN; /* and rat-lines */ int LayerN; /* number of layers in this board */ - GList *Via; + pinlist_t Via; GList *Element; GList *Rat; rtree_t *via_tree, *element_tree, *pin_tree, *pad_tree, *name_tree[3], /* for element names */ Index: trunk/src/hid/gtk/gui-top-window.c =================================================================== --- trunk/src/hid/gtk/gui-top-window.c (revision 1179) +++ trunk/src/hid/gtk/gui-top-window.c (revision 1180) @@ -507,7 +507,7 @@ break; case LAYER_BUTTON_VIAS: PCB->ViaOn = active; - redraw |= (PCB->Data->ViaN != 0); + redraw |= (pinlist_length(&PCB->Data->Via) != 0); break; case LAYER_BUTTON_FARSIDE: PCB->InvisibleObjectsOn = active; Index: trunk/src/macro.h =================================================================== --- trunk/src/macro.h (revision 1179) +++ trunk/src/macro.h (revision 1180) @@ -185,12 +185,9 @@ style = &(top)->RouteStyle[n] #define VIA_LOOP(top) do { \ - GList *__iter, *__next; \ - Cardinal n = 0; \ - for (__iter = (top)->Via, __next = g_list_next (__iter); \ - __iter != NULL; \ - __iter = __next, __next = g_list_next (__iter), n++) { \ - PinType *via = __iter->data; + PinType *via; \ + gdl_iterator_t __it__; \ + pinlist_foreach(&(top)->Via, &__it__, via) { #define DRILL_LOOP(top) do { \ Cardinal n; \ Index: trunk/src/misc.c =================================================================== --- trunk/src/misc.c (revision 1179) +++ trunk/src/misc.c (revision 1180) @@ -581,7 +581,7 @@ bool hasNoObjects; Cardinal i; - hasNoObjects = (Data->ViaN == 0); + hasNoObjects = (pinlist_length(&Data->Via) == 0); hasNoObjects &= (Data->ElementN == 0); for (i = 0; i < max_copper_layer + 2; i++) hasNoObjects = hasNoObjects && LAYER_IS_EMPTY(&(Data->Layer[i])); Index: trunk/src/mymem.c =================================================================== --- trunk/src/mymem.c (revision 1179) +++ trunk/src/mymem.c (revision 1180) @@ -212,14 +212,13 @@ { PinType *new_obj; - new_obj = g_slice_new0(PinType); - data->Via = g_list_append(data->Via, new_obj); - data->ViaN++; + new_obj = calloc(sizeof(PinType), 1); + pinlist_append(&data->Via, new_obj); return new_obj; } -static void FreeVia(PinType * data) +void RemoveFreeVia(PinType * data) { g_slice_free(PinType, data); } @@ -637,7 +636,7 @@ free(via->Name); } END_LOOP; - g_list_free_full(data->Via, (GDestroyNotify) FreeVia); + list_map0(&data->Via, PinType, RemoveFreeVia); ELEMENT_LOOP(data); { FreeElementMemory(element); Index: trunk/src/mymem.h =================================================================== --- trunk/src/mymem.h (revision 1179) +++ trunk/src/mymem.h (revision 1180) @@ -99,6 +99,7 @@ void RemoveFreePolygon(PolygonType * data); void RemoveFreePin(PinType * data); void RemoveFreePad(PadType * data); +void RemoveFreeVia(PinType * data); #ifdef NEED_STRDUP char *strdup(const char *); Index: trunk/src/remove.c =================================================================== --- trunk/src/remove.c (revision 1179) +++ trunk/src/remove.c (revision 1180) @@ -127,11 +127,7 @@ r_delete_entry(DestroyTarget->via_tree, (BoxTypePtr) Via); free(Via->Name); - DestroyTarget->Via = g_list_remove(DestroyTarget->Via, Via); - DestroyTarget->ViaN--; - - g_slice_free(PinType, Via); - + RemoveFreeVia(Via); return NULL; } Index: trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/search.c =================================================================== --- trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/search.c (revision 1179) +++ trunk/src_plugins/gpmi/pcb-gpmi/gpmi_plugin/gpmi_pkg/layout/search.c (revision 1180) @@ -112,16 +112,6 @@ search_append(ctx->search, obj); } -#define select(s, om, flag, lst) \ - do { \ - select_t ctx; \ - ctx.flag = flag; \ - ctx.search = s; \ - s->searching = om; \ - g_list_foreach(lst, select_cb, &ctx); \ - s->searching = 0; \ - } while(0) - #define select2(s, om, flag, lst) \ do { \ gdl_iterator_t it; \ @@ -147,8 +137,8 @@ select2(s, OM_TEXT, flag, &layer->Text); select2(s, OM_POLYGON, flag, &layer->Polygon); } - select(s, OM_VIA, flag, PCB->Data->Via); -/* select(s, OM_PIN, flag, PCB->Data->Pin, PCB->Data->PinN); /* TODO */ + select2(s, OM_VIA, flag, &PCB->Data->Via); +/* select2(s, OM_PIN, flag, &PCB->Data->Pin); /* TODO */ return s->used; }