diff --git a/src/actions.c b/src/actions.c index 7bcc6d42..6cd692be 100644 --- a/src/actions.c +++ b/src/actions.c @@ -2010,7 +2010,6 @@ void get_additional_symbols(int what) if(xctx->tok_size && sch[0]) { /* "schematic" token exists and a schematic is specified */ int j; char *sym = NULL; - char *templ = NULL; char *symname_attr = NULL; int ignore_schematic = 0; xSymbol *symptr = xctx->inst[i].ptr + xctx->sym; @@ -2030,15 +2029,13 @@ void get_additional_symbols(int what) my_strdup2(_ALLOC_ID_, &sym, add_ext(rel_sym_path(sch), ".sym")); } - my_strdup2(_ALLOC_ID_, &templ, get_tok_value(symptr->prop_ptr, "template", 0)); my_mstrcat(_ALLOC_ID_, &symname_attr, "symname=", get_cell(sym, 0), NULL); my_mstrcat(_ALLOC_ID_, &symname_attr, " symref=", get_sym_name(i, 9999, 1, 1), NULL); my_strdup(_ALLOC_ID_, &spice_sym_def, translate3(spice_sym_def, 1, xctx->inst[i].prop_ptr, - templ, + symptr->templ, symname_attr)); dbg(1, "get_additional_symbols(): spice_sym_def=%s\n", spice_sym_def); - my_free(_ALLOC_ID_, &templ); my_free(_ALLOC_ID_, &symname_attr); /* if instance symbol has default_schematic set to ignore copy the symbol anyway, since * the base symbol will not be netlisted by *_block_netlist() */ @@ -2395,8 +2392,7 @@ int descend_schematic(int instnumber, int fallback, int alert, int set_title) my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].prop_ptr, xctx->inst[n].prop_ptr); - my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].templ, - get_tok_value(xctx->sym[xctx->inst[n].ptr].prop_ptr, "template", 0)); + my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].templ, xctx->sym[xctx->inst[n].ptr].templ); dbg(1,"descend_schematic(): inst_number=%d\n", inst_number); my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], find_nth(str, ",", "", 0, inst_number)); diff --git a/src/save.c b/src/save.c index c088b816..28f135cc 100644 --- a/src/save.c +++ b/src/save.c @@ -5140,7 +5140,7 @@ int descend_symbol(void) my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].prop_ptr, xctx->inst[n].prop_ptr); my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].templ, - get_tok_value(xctx->sym[xctx->inst[n].ptr].prop_ptr, "template", 0)); + xctx->sym[xctx->inst[n].ptr].templ); if(!xctx->inst[n].embed) /* use -1 to keep track we are descending into symbol from instance with no embed attr diff --git a/src/spice_netlist.c b/src/spice_netlist.c index 911289d1..6e17771d 100644 --- a/src/spice_netlist.c +++ b/src/spice_netlist.c @@ -641,14 +641,9 @@ int spice_block_netlist(FILE *fd, int i, int alert) my_strdup(_ALLOC_ID_, &sym_def, get_tok_value(xctx->sym[i].prop_ptr,"spice_sym_def",0)); if(sym_def) { char *symname_attr = NULL; - char *templ = NULL; const char *translated_sym_def; - my_strdup2(_ALLOC_ID_, &templ, get_tok_value(xctx->sym[i].prop_ptr, "template", 0)); my_mstrcat(_ALLOC_ID_, &symname_attr, "symname=", get_cell(name, 0), NULL); - translated_sym_def = translate3(sym_def, 1, "", - templ, - symname_attr); - my_free(_ALLOC_ID_, &templ); + translated_sym_def = translate3(sym_def, 1, "", xctx->sym[i].templ, symname_attr); my_free(_ALLOC_ID_, &symname_attr); fprintf(fd, "%s\n", translated_sym_def); my_free(_ALLOC_ID_, &sym_def); diff --git a/src/token.c b/src/token.c index e8e3d855..246f5d08 100644 --- a/src/token.c +++ b/src/token.c @@ -1856,7 +1856,6 @@ static int has_included_subcircuit(int inst, int symbol, char **result) if(xctx->tok_size) { char *symname = NULL; - char *templ = NULL; char *symname_attr = NULL; int no_of_pins = (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; int i; @@ -1865,7 +1864,6 @@ static int has_included_subcircuit(int inst, int symbol, char **result) Str_hashentry *entry; Str_hashtable table = {NULL, 0}; - my_strdup2(_ALLOC_ID_, &templ, get_tok_value(xctx->sym[symbol].prop_ptr, "template", 0)); my_strdup2(_ALLOC_ID_, &symname, get_tok_value(xctx->inst[inst].prop_ptr, "schematic", 0)); if(!symname[0]) { my_strdup2(_ALLOC_ID_, &symname, get_tok_value(xctx->sym[symbol].prop_ptr, "schematic", 0)); @@ -1876,7 +1874,7 @@ static int has_included_subcircuit(int inst, int symbol, char **result) my_mstrcat(_ALLOC_ID_, &symname_attr, "symname=", get_cell(symname, 0), NULL); my_mstrcat(_ALLOC_ID_, &symname_attr, " symref=", get_sym_name(inst, 9999, 1, 1), NULL); translated_sym_def = translate3(spice_sym_def, 1, xctx->inst[inst].prop_ptr, - templ, + xctx->sym[symbol].templ, symname_attr); dbg(1, "has_included_subcircuit(): translated_sym_def=%s\n", translated_sym_def); dbg(1, "has_included_subcircuit(): symname=%s\n", symname); @@ -1915,7 +1913,6 @@ static int has_included_subcircuit(int inst, int symbol, char **result) tclvareval("has_included_subcircuit {", get_cell(symname, 0), "} {", translated_sym_def, "} ", my_itoa(exp_no_of_pins), NULL); - my_free(_ALLOC_ID_, &templ); my_free(_ALLOC_ID_, &symname_attr); if(tclresult()[0]) { /* a valid spice_sym_def netlist was found */ char *subckt_pin, *pin_save;