Index: trunk/src_plugins/lib_netmap/map_2nets.c =================================================================== --- trunk/src_plugins/lib_netmap/map_2nets.c (revision 34939) +++ trunk/src_plugins/lib_netmap/map_2nets.c (revision 34940) @@ -59,8 +59,8 @@ if (htpp_get(&map->o2n, obj) != NULL) /* object already found */ return; - seg = pcb_qry_parent_net_len_mapseg(pcb, obj); - printf("seg=%p\n", (void *)seg); + seg = pcb_qry_parent_net_len_mapseg(map->ec, obj); + printf("seg=%p (%ld %p)\n", (void *)seg, seg->objs.used, seg->objs.array); for(n = 0, o = (pcb_any_obj_t **)seg->objs.array; n < seg->objs.used; n++,o++) { if (*o == NULL) { printf(" NULL\n"); @@ -95,6 +95,12 @@ int pcb_map_2nets_init(pcb_2netmap_t *map, pcb_board_t *pcb, pcb_2netmap_control_t how) { + pcb_qry_exec_t ec; + + pcb_qry_init(&ec, pcb, NULL, 0); + + map->ec = &ec; + htpp_init(&map->o2n, ptrhash, ptrkeyeq); pcb_loop_all(PCB, map, @@ -108,6 +114,8 @@ list_pstk_cb ); + pcb_qry_uninit(&ec); + return -1; } Index: trunk/src_plugins/lib_netmap/map_2nets.h =================================================================== --- trunk/src_plugins/lib_netmap/map_2nets.h (revision 34939) +++ trunk/src_plugins/lib_netmap/map_2nets.h (revision 34940) @@ -35,6 +35,9 @@ typedef struct pcb_2netmap_s { pcb_2netmap_control_t ctrl; htpp_t o2n; /* of (pcb_2netmap_net_t *); tells the net for an object */ + + /* internal */ + void *ec; } pcb_2netmap_t; Index: trunk/src_plugins/query/net_len.c =================================================================== --- trunk/src_plugins/query/net_len.c (revision 34939) +++ trunk/src_plugins/query/net_len.c (revision 34940) @@ -490,19 +490,10 @@ vtp0_uninit(&ns->objs); } -pcb_qry_netseg_len_t *pcb_qry_parent_net_len_mapseg(pcb_board_t *pcb, pcb_any_obj_t *from) +pcb_qry_netseg_len_t *pcb_qry_parent_net_len_mapseg(pcb_qry_exec_t *ec, pcb_any_obj_t *from) { - pcb_qry_netseg_len_t *res; - pcb_qry_exec_t ec = {0}; - - ec.pcb = pcb; - pcb_qry_parent_net_lenseg_init(&ec); - - res = pcb_qry_parent_net_lenseg_(&ec, from); - - pcb_qry_uninit(&ec); - - return res; + pcb_qry_parent_net_lenseg_init(ec); + return pcb_qry_parent_net_lenseg_(ec, from); } const char pcb_acts_QueryCalcNetLen[] = "QueryCalcNetLen(netname)"; Index: trunk/src_plugins/query/net_len.h =================================================================== --- trunk/src_plugins/query/net_len.h (revision 34939) +++ trunk/src_plugins/query/net_len.h (revision 34940) @@ -13,7 +13,7 @@ pcb_qry_netseg_len_t *pcb_qry_parent_net_lenseg(pcb_qry_exec_t *ec, pcb_any_obj_t *from); /* Return a segment (up to the first junction) starting from an object */ -pcb_qry_netseg_len_t *pcb_qry_parent_net_len_mapseg(pcb_board_t *pcb, pcb_any_obj_t *from); +pcb_qry_netseg_len_t *pcb_qry_parent_net_len_mapseg(pcb_qry_exec_t *ec, pcb_any_obj_t *from); void pcb_qry_lenseg_free_fields(pcb_qry_netseg_len_t *ns);