From 19f0fd3c6efbab672a466b6b280a54b6e9785023 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Tue, 7 Dec 2021 02:18:23 +0100 Subject: [PATCH] optimizations in calc_drawing_bbox() (less get_tok_value() calls), optimizations in bus_hilight_hash_lookup() (less expandlabel() calls) --- src/actions.c | 10 +++++++--- src/hilight.c | 3 ++- src/token.c | 2 +- src/xinit.c | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/actions.c b/src/actions.c index 25125b30..c4104375 100644 --- a/src/actions.c +++ b/src/actions.c @@ -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;iwires;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; diff --git a/src/hilight.c b/src/hilight.c index ef73a657..c551aaa0 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -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; } diff --git a/src/token.c b/src/token.c index fbcb9c1a..b9e94b4f 100644 --- a/src/token.c +++ b/src/token.c @@ -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); */ diff --git a/src/xinit.c b/src/xinit.c index ca744bba..4da73804 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -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 */ }