optimizations in calc_drawing_bbox() (less get_tok_value() calls), optimizations in bus_hilight_hash_lookup() (less expandlabel() calls)

This commit is contained in:
Stefan Frederik 2021-12-07 02:18:23 +01:00
parent 4cd8642362
commit 19f0fd3c6e
4 changed files with 11 additions and 6 deletions

View File

@ -1265,14 +1265,18 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
updatebbox(count,boundbox,&tmp);
}
}
if(selected == 2 && xctx->hilight_nets) prepare_netlist_structs(0);
for(i=0;i<xctx->wires;i++)
{
int ov, y1, y2;
if(selected == 1 && !xctx->wire[i].sel) continue;
if(selected == 2) {
const char *str;
str = get_tok_value(xctx->wire[i].prop_ptr, "lab",0);
if(!str[0] || !bus_hilight_hash_lookup(str, 0,XLOOKUP)) continue;
/* const char *str;
* str = get_tok_value(xctx->wire[i].prop_ptr, "lab",0);
* if(!str[0] || !bus_hilight_hash_lookup(str, 0,XLOOKUP)) continue;
*/
if(!xctx->hilight_nets || !xctx->wire[i].node ||
!xctx->wire[i].node[0] || !bus_hilight_hash_lookup(xctx->wire[i].node, 0,XLOOKUP)) continue;
}
if(xctx->wire[i].bus){
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;

View File

@ -136,7 +136,8 @@ struct hilight_hashentry *bus_hilight_hash_lookup(const char *token, int value,
int mult;
if(token==NULL) return NULL;
if( token[0] == '#' || !strpbrk(token, "*[],.:")) {
/* if( token[0] == '#' || !strpbrk(token, "*[],.:")) { */
if( token[0] == '#' || !strpbrk(token, "*,.:")) {
ptr1=hilight_hash_lookup(token, value, what);
return ptr1;
}

View File

@ -2813,7 +2813,7 @@ const char *translate(int inst, const char* s)
}
if(!xctx->get_tok_size) { /* above lines did not find a value for token */
if(token[0] =='%') {
/* no definition found -> subst with token without leading $ */
/* no definition found -> subst with token without leading % */
tmp=token_pos -1 ; /* we need token_pos -1 chars, ( strlen(token+1) ) , excluding leading '%' */
STR_ALLOC(&result, tmp + result_pos, &size);
/* dbg(2, "translate(): token=%s, token_pos = %d\n", token, token_pos); */

View File

@ -660,7 +660,7 @@ void xwin_exit(void)
dbg(1, "xwin_exit(): deleted undo buffer\n");
if(errfp!=stderr) fclose(errfp);
errfp=stderr;
/* printf("\n");*/
if(!detach) printf("\n");
init_done=0; /* 20150409 to avoid multiple calls */
}