Index: trunk/src_plugins/export_excellon/aperture.c =================================================================== --- trunk/src_plugins/export_excellon/aperture.c (revision 29098) +++ trunk/src_plugins/export_excellon/aperture.c (revision 29099) @@ -13,7 +13,8 @@ void init_aperture_list(aperture_list_t *list) { list->data = NULL; - list->count = 0; + list->aperture_count_default = list->count = 0; + list->aperture_count = &list->aperture_count_default; } void uninit_aperture_list(aperture_list_t *list) @@ -30,8 +31,6 @@ aperture_t *add_aperture(aperture_list_t *list, pcb_coord_t width, aperture_shape_t shape) { - static int aperture_count; - aperture_t *app = (aperture_t *) malloc(sizeof *app); if (app == NULL) return NULL; @@ -38,7 +37,7 @@ app->width = width; app->shape = shape; - app->dCode = DCODE_BASE + aperture_count++; + app->dCode = DCODE_BASE + (*list->aperture_count)++; app->next = list->data; list->data = app; Index: trunk/src_plugins/export_excellon/aperture.h =================================================================== --- trunk/src_plugins/export_excellon/aperture.h (revision 29098) +++ trunk/src_plugins/export_excellon/aperture.h (revision 29099) @@ -24,6 +24,7 @@ typedef struct { aperture_t *data; int count; + int aperture_count_default, *aperture_count; } aperture_list_t; void init_aperture_list(aperture_list_t *list); Index: trunk/src_plugins/export_gerber/gerber.c =================================================================== --- trunk/src_plugins/export_gerber/gerber.c (revision 29098) +++ trunk/src_plugins/export_gerber/gerber.c (revision 29099) @@ -70,8 +70,8 @@ static int has_outline; static int gerber_debug; static int gerber_ovr; +static int gerber_global_aperture_cnt; - static aperture_list_t *layer_aptr_list; static aperture_list_t *curr_aptr_list; static int layer_list_max; @@ -122,6 +122,7 @@ init_aperture_list(&layer_aptr_list[i]); } curr_aptr_list = &layer_aptr_list[layer_idx]; + curr_aptr_list->aperture_count = &gerber_global_aperture_cnt; return curr_aptr_list; } @@ -523,6 +524,7 @@ pcb_xform_t xform; gerber_ovr = 0; + gerber_global_aperture_cnt = 0; conf_force_set_bool(conf_core.editor.thin_draw, 0); conf_force_set_bool(conf_core.editor.thin_draw_poly, 0);