Index: file.c =================================================================== --- file.c (revision 25723) +++ file.c (revision 25724) @@ -633,41 +633,22 @@ } } -static pcb_layer_id_t pcb_layer_get_cached(pcb_board_t *pcb, pcb_layer_id_t *cache, unsigned int loc, unsigned int typ) +static pcb_layer_id_t pcb_layer_get_cached(pcb_board_t *pcb, unsigned int loc, unsigned int typ) { - pcb_layergrp_t *g; - - if (*cache < pcb->Data->LayerN) { /* check if the cache is still pointing to the right layer */ - pcb_layergrp_id_t gid = pcb->Data->Layer[*cache].meta.real.grp; - if ((gid >= 0) && (gid < pcb->LayerGroups.len)) { - g = &(pcb->LayerGroups.grp[gid]); - if ((g->ltype & loc) && (g->ltype & typ) && (g->lid[0] == *cache)) - return *cache; - } - } - - /* nope: need to resolve it again */ - g = pcb_get_grp(&pcb->LayerGroups, loc, typ); - if ((g == NULL) || (g->len == 0)) { - *cache = -1; + pcb_layergrp_t *g = pcb_get_grp(&pcb->LayerGroups, loc, typ); + if ((g == NULL) || (g->len == 0)) return -1; - } - *cache = g->lid[0]; - return *cache; + return g->lid[0]; } static pcb_layer_id_t pcb_layer_get_bottom_silk(void) { - static pcb_layer_id_t cache = -1; - pcb_layer_id_t id = pcb_layer_get_cached(PCB, &cache, PCB_LYT_BOTTOM, PCB_LYT_SILK); - return id; + return pcb_layer_get_cached(PCB, PCB_LYT_BOTTOM, PCB_LYT_SILK); } static pcb_layer_id_t pcb_layer_get_top_silk(void) { - static pcb_layer_id_t cache = -1; - pcb_layer_id_t id = pcb_layer_get_cached(PCB, &cache, PCB_LYT_TOP, PCB_LYT_SILK); - return id; + return pcb_layer_get_cached(PCB, PCB_LYT_TOP, PCB_LYT_SILK); } static void LayersFixup(void)