better memory tracking reporting (my_strcat and my_strncat allocations)

This commit is contained in:
stefan schippers 2023-02-01 11:38:28 +01:00
parent baca559ffc
commit 29ef08e84b
14 changed files with 59 additions and 59 deletions

View File

@ -835,7 +835,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710
for(j=0;j<k;j++) if(xctx->sel_array[j].type==ELEMENT) { for(j=0;j<k;j++) if(xctx->sel_array[j].type==ELEMENT) {
found=1; found=1;
my_strdup(_ALLOC_ID_, &prop, xctx->inst[xctx->sel_array[j].n].instname); my_strdup(_ALLOC_ID_, &prop, xctx->inst[xctx->sel_array[j].n].instname);
my_strcat(6, &prop, "_"); my_strcat(_ALLOC_ID_, &prop, "_");
tclsetvar("custom_label_prefix",prop); tclsetvar("custom_label_prefix",prop);
if(interactive && !do_all_inst) { if(interactive && !do_all_inst) {
@ -923,11 +923,11 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710
if(!skip) { if(!skip) {
my_strdup(_ALLOC_ID_, &prop, "name=p1 lab="); my_strdup(_ALLOC_ID_, &prop, "name=p1 lab=");
if(use_label_prefix) { if(use_label_prefix) {
my_strcat(10, &prop, (char *)tclgetvar("custom_label_prefix")); my_strcat(_ALLOC_ID_, &prop, (char *)tclgetvar("custom_label_prefix"));
} }
/* /20171005 */ /* /20171005 */
my_strcat(11, &prop, labname); my_strcat(_ALLOC_ID_, &prop, labname);
dir ^= flip; /* 20101129 20111030 */ dir ^= flip; /* 20101129 20111030 */
if(rotated_text ==-1) { if(rotated_text ==-1) {
rot1=rot; rot1=rot;
@ -1222,9 +1222,9 @@ void get_sch_from_sym(char *filename, xSymbol *sym)
if( (ptr = strstr(str_tmp, "@symname"))) { if( (ptr = strstr(str_tmp, "@symname"))) {
*ptr = '\0'; *ptr = '\0';
my_strdup2(_ALLOC_ID_, &sch, str_tmp); my_strdup2(_ALLOC_ID_, &sch, str_tmp);
my_strcat(1649, &sch, sym->name); my_strcat(_ALLOC_ID_, &sch, sym->name);
ptr += 8; ptr += 8;
my_strcat(1650, &sch, ptr); my_strcat(_ALLOC_ID_, &sch, ptr);
} else { } else {
my_strdup2(_ALLOC_ID_, &sch, str_tmp); my_strdup2(_ALLOC_ID_, &sch, str_tmp);
} }
@ -1350,9 +1350,9 @@ int descend_schematic(int instnumber)
if(inst_number <1 || inst_number > inst_mult) inst_number = 1; if(inst_number <1 || inst_number > inst_mult) inst_number = 1;
} }
dbg(1,"descend_schematic(): inst_number=%d\n", inst_number); dbg(1,"descend_schematic(): inst_number=%d\n", inst_number);
my_strcat(15, &xctx->sch_path[xctx->currsch+1], find_nth(str, ",", inst_number)); my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], find_nth(str, ",", inst_number));
dbg(1,"descend_schematic(): inst_number=%d\n", inst_number); dbg(1,"descend_schematic(): inst_number=%d\n", inst_number);
my_strcat(16, &xctx->sch_path[xctx->currsch+1], "."); my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], ".");
xctx->sch_inst_number[xctx->currsch+1] = inst_number; xctx->sch_inst_number[xctx->currsch+1] = inst_number;
dbg(1, "descend_schematic(): current path: %s\n", xctx->sch_path[xctx->currsch+1]); dbg(1, "descend_schematic(): current path: %s\n", xctx->sch_path[xctx->currsch+1]);
dbg(1, "descend_schematic(): inst_number=%d\n", inst_number); dbg(1, "descend_schematic(): inst_number=%d\n", inst_number);

View File

@ -21,7 +21,7 @@ BEGIN{
while(getline < filename) { while(getline < filename) {
if(create_id == 0) { if(create_id == 0) {
if(!start) f = f "\n" if(!start) f = f "\n"
str = gensub(/(my_(malloc|calloc|realloc|free|strdup|strdup2))\([0-9]+,/, "\\1(_ALLOC_ID_,", "G") str = gensub(/(my_(malloc|calloc|realloc|free|strcat|strncat|strdup|strdup2))\([0-9]+,/, "\\1(_ALLOC_ID_,", "G")
if(str != $0) changed = 1 if(str != $0) changed = 1
f = f str f = f str
} else { } else {

View File

@ -66,7 +66,7 @@ char *my_fgets(FILE *fd)
size_t len; size_t len;
while(fgets(buf, SIZE, fd)) { while(fgets(buf, SIZE, fd)) {
my_strcat(425, &s, buf); my_strcat(_ALLOC_ID_, &s, buf);
len = strlen(buf); len = strlen(buf);
if(buf[len - 1] == '\n') break; if(buf[len - 1] == '\n') break;
} }

View File

@ -191,11 +191,11 @@ void display_hilights(char **str)
for(i=0;i<HASHSIZE;i++) { for(i=0;i<HASHSIZE;i++) {
entry = xctx->hilight_table[i]; entry = xctx->hilight_table[i];
while(entry) { while(entry) {
if(!first) my_strcat(93, str, " "); if(!first) my_strcat(_ALLOC_ID_, str, " ");
my_strcat(943, str,"{"); my_strcat(_ALLOC_ID_, str,"{");
my_strcat(1190, str, entry->path+1); my_strcat(_ALLOC_ID_, str, entry->path+1);
my_strcat(1160, str, entry->token); my_strcat(_ALLOC_ID_, str, entry->token);
my_strcat(562, str,"}"); my_strcat(_ALLOC_ID_, str,"}");
first = 0; first = 0;
entry = entry->next; entry = entry->next;
} }
@ -314,13 +314,13 @@ void create_plot_cmd(void)
} }
fprintf(fd, "set color%d=rgb:%s\n", idx, color_str); fprintf(fd, "set color%d=rgb:%s\n", idx, color_str);
if(first) { if(first) {
my_strcat(164, &str, "plot "); my_strcat(_ALLOC_ID_, &str, "plot ");
first = 0; first = 0;
} }
my_strcat(160, &str, "\""); my_strcat(_ALLOC_ID_, &str, "\"");
my_strcat(161, &str, (entry->path)+1); my_strcat(_ALLOC_ID_, &str, (entry->path)+1);
my_strcat(162, &str, tok); my_strcat(_ALLOC_ID_, &str, tok);
my_strcat(163, &str, "\" "); my_strcat(_ALLOC_ID_, &str, "\" ");
} }
if(viewer == GAW) { if(viewer == GAW) {
char *t=NULL, *p=NULL; char *t=NULL, *p=NULL;
@ -957,10 +957,10 @@ static void send_net_to_graph(char **s, int simtype, const char *node)
if(simtype == 0 ) { /* ngspice */ if(simtype == 0 ) { /* ngspice */
dbg(1, "%s%s color=%d\n", path, t, c); dbg(1, "%s%s color=%d\n", path, t, c);
my_snprintf(ss, S(ss), "%s%s %d ", path, t, c); my_snprintf(ss, S(ss), "%s%s %d ", path, t, c);
my_strcat(1502, s, ss); my_strcat(_ALLOC_ID_, s, ss);
} else { /* Xyce */ } else { /* Xyce */
my_snprintf(ss, S(ss), "%s%s %d", path, t, c); my_snprintf(ss, S(ss), "%s%s %d", path, t, c);
my_strcat(536, s, ss); my_strcat(_ALLOC_ID_, s, ss);
} }
} }
@ -1105,14 +1105,14 @@ static void send_current_to_graph(char **s, int simtype, const char *node)
strtolower(t); strtolower(t);
if(!simtype) { /* ngspice */ if(!simtype) { /* ngspice */
my_snprintf(ss, S(ss), "i(%s%s%s) %d", there_is_hierarchy ? "v." : "", path, t, c); my_snprintf(ss, S(ss), "i(%s%s%s) %d", there_is_hierarchy ? "v." : "", path, t, c);
my_strcat(537, s, ss); my_strcat(_ALLOC_ID_, s, ss);
} else { /* Xyce */ } else { /* Xyce */
/* /*
my_snprintf(ss, S(ss), "%s%s%s#branch %d", there_is_hierarchy ? "v." : "", my_snprintf(ss, S(ss), "%s%s%s#branch %d", there_is_hierarchy ? "v." : "",
path, (there_is_hierarchy ? t+1 : t) , c); path, (there_is_hierarchy ? t+1 : t) , c);
*/ */
my_snprintf(ss, S(ss), "i(%s%s) %d", path, t, c); my_snprintf(ss, S(ss), "i(%s%s) %d", path, t, c);
my_strcat(535, s, ss); my_strcat(_ALLOC_ID_, s, ss);
} }
} }
my_free(_ALLOC_ID_, &p); my_free(_ALLOC_ID_, &p);

View File

@ -632,7 +632,7 @@ void copy_objects(int what)
xctx->deltax = xctx->deltay = 0.; xctx->deltax = xctx->deltay = 0.;
xctx->ui_state&=~STARTCOPY; xctx->ui_state&=~STARTCOPY;
my_strdup(_ALLOC_ID_, &str, user_conf_dir); my_strdup(_ALLOC_ID_, &str, user_conf_dir);
my_strcat(226, &str, "/.selection.sch"); my_strcat(_ALLOC_ID_, &str, "/.selection.sch");
xunlink(str); xunlink(str);
update_symbol_bboxes(0, 0); update_symbol_bboxes(0, 0);
my_free(_ALLOC_ID_, &str); my_free(_ALLOC_ID_, &str);

View File

@ -577,7 +577,7 @@ static int read_dataset(FILE *fd, const char *type)
ptr++; ptr++;
} }
if(xctx->graph_sim_type && !strcmp(xctx->graph_sim_type, "ac")) { /* AC */ if(xctx->graph_sim_type && !strcmp(xctx->graph_sim_type, "ac")) { /* AC */
my_strcat(415, &xctx->graph_names[i << 1], varname); my_strcat(_ALLOC_ID_, &xctx->graph_names[i << 1], varname);
int_hash_lookup(&xctx->graph_raw_table, xctx->graph_names[i << 1], (i << 1), XINSERT_NOREPLACE); int_hash_lookup(&xctx->graph_raw_table, xctx->graph_names[i << 1], (i << 1), XINSERT_NOREPLACE);
if(strstr(varname, "v(") == varname || strstr(varname, "i(") == varname) if(strstr(varname, "v(") == varname || strstr(varname, "i(") == varname)
my_mstrcat(664, &xctx->graph_names[(i << 1) + 1], "ph(", varname + 2, NULL); my_mstrcat(664, &xctx->graph_names[(i << 1) + 1], "ph(", varname + 2, NULL);
@ -585,7 +585,7 @@ static int read_dataset(FILE *fd, const char *type)
my_mstrcat(540, &xctx->graph_names[(i << 1) + 1], "ph(", varname, ")", NULL); my_mstrcat(540, &xctx->graph_names[(i << 1) + 1], "ph(", varname, ")", NULL);
int_hash_lookup(&xctx->graph_raw_table, xctx->graph_names[(i << 1) + 1], (i << 1) + 1, XINSERT_NOREPLACE); int_hash_lookup(&xctx->graph_raw_table, xctx->graph_names[(i << 1) + 1], (i << 1) + 1, XINSERT_NOREPLACE);
} else { } else {
my_strcat(541, &xctx->graph_names[i], varname); my_strcat(_ALLOC_ID_, &xctx->graph_names[i], varname);
int_hash_lookup(&xctx->graph_raw_table, xctx->graph_names[i], i, XINSERT_NOREPLACE); int_hash_lookup(&xctx->graph_raw_table, xctx->graph_names[i], i, XINSERT_NOREPLACE);
} }
/* use hash table to store index number of variables */ /* use hash table to store index number of variables */
@ -2803,7 +2803,7 @@ static void add_pinlayer_boxes(int *lastr, xRect **bb,
bb[PINLAYER][i].sel = 0; bb[PINLAYER][i].sel = 0;
/* add to symbol pins remaining attributes from schematic pins, except name= and lab= */ /* add to symbol pins remaining attributes from schematic pins, except name= and lab= */
my_strdup(_ALLOC_ID_, &pin_label, get_sym_template(prop_ptr, "lab")); /* remove name=... and lab=... */ my_strdup(_ALLOC_ID_, &pin_label, get_sym_template(prop_ptr, "lab")); /* remove name=... and lab=... */
my_strcat(159, &bb[PINLAYER][i].prop_ptr, pin_label); my_strcat(_ALLOC_ID_, &bb[PINLAYER][i].prop_ptr, pin_label);
my_free(_ALLOC_ID_, &pin_label); my_free(_ALLOC_ID_, &pin_label);
lastr[PINLAYER]++; lastr[PINLAYER]++;
} }
@ -3312,8 +3312,8 @@ int load_sym_def(const char *name, FILE *embed_fd)
int i; int i;
for(i = 1; i <level; i++) { for(i = 1; i <level; i++) {
const char *instname = get_tok_value(lcc[i].prop_ptr, "name", 0); const char *instname = get_tok_value(lcc[i].prop_ptr, "name", 0);
my_strcat(1582, &path, instname); my_strcat(_ALLOC_ID_, &path, instname);
my_strcat(1588, &path, "."); my_strcat(_ALLOC_ID_, &path, ".");
} }
} }
if(path) new_size += strlen(path); if(path) new_size += strlen(path);
@ -3333,8 +3333,8 @@ int load_sym_def(const char *name, FILE *embed_fd)
int i; int i;
for(i = 1; i <level; i++) { for(i = 1; i <level; i++) {
const char *instname = get_tok_value(lcc[i].prop_ptr, "name", 0); const char *instname = get_tok_value(lcc[i].prop_ptr, "name", 0);
my_strcat(1590, &path, instname); my_strcat(_ALLOC_ID_, &path, instname);
my_strcat(1591, &path, "."); my_strcat(_ALLOC_ID_, &path, ".");
} }
} }
if(path) new_size += strlen(path); if(path) new_size += strlen(path);
@ -3356,7 +3356,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
if(level > 0 && symtype && !strcmp(symtype, "label")) { if(level > 0 && symtype && !strcmp(symtype, "label")) {
char lay[30]; char lay[30];
my_snprintf(lay, S(lay), " layer=%d", WIRELAYER); my_snprintf(lay, S(lay), " layer=%d", WIRELAYER);
my_strcat(1163, &tt[i].prop_ptr, lay); my_strcat(_ALLOC_ID_, &tt[i].prop_ptr, lay);
} }
dbg(1, "l_s_d(): loaded text : t=%s p=%s\n", tt[i].txt_ptr, tt[i].prop_ptr ? tt[i].prop_ptr : "NULL"); dbg(1, "l_s_d(): loaded text : t=%s p=%s\n", tt[i].txt_ptr, tt[i].prop_ptr ? tt[i].prop_ptr : "NULL");
set_text_flags(&tt[i]); set_text_flags(&tt[i]);
@ -3764,8 +3764,8 @@ void descend_symbol(void)
/* build up current hierarchy path */ /* build up current hierarchy path */
my_strdup(_ALLOC_ID_, &str, xctx->inst[n].instname); my_strdup(_ALLOC_ID_, &str, xctx->inst[n].instname);
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(365, &xctx->sch_path[xctx->currsch+1], str); my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], str);
my_strcat(366, &xctx->sch_path[xctx->currsch+1], "."); my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], ".");
xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->sch_path_hash[xctx->currsch+1] = 0;
my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].prop_ptr, my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].prop_ptr,

View File

@ -1543,7 +1543,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
pin = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr, "name",0); pin = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr, "name",0);
if(!pin[0]) pin = "--ERROR--"; if(!pin[0]) pin = "--ERROR--";
my_mstrcat(655, &pins, "{", pin, "}", NULL); my_mstrcat(655, &pins, "{", pin, "}", NULL);
if(p< no_of_pins-1) my_strcat(377, &pins, " "); if(p< no_of_pins-1) my_strcat(_ALLOC_ID_, &pins, " ");
} }
Tcl_SetResult(interp, pins, TCL_VOLATILE); Tcl_SetResult(interp, pins, TCL_VOLATILE);
my_free(_ALLOC_ID_, &pins); my_free(_ALLOC_ID_, &pins);
@ -3256,10 +3256,10 @@ int tclvareval(const char *script, ...)
va_list args; va_list args;
va_start(args, script); va_start(args, script);
size = my_strcat(1379, &str, script); size = my_strcat(_ALLOC_ID_, &str, script);
dbg(1, "tclvareval(): script=%s, str=%s, size=%d\n", script, str, size); dbg(1, "tclvareval(): script=%s, str=%s, size=%d\n", script, str, size);
while( (p = va_arg(args, const char *)) ) { while( (p = va_arg(args, const char *)) ) {
size = my_strcat(1380, &str, p); size = my_strcat(_ALLOC_ID_, &str, p);
dbg(1, "tclvareval(): p=%s, str=%s, size=%d\n", p, str, size); dbg(1, "tclvareval(): p=%s, str=%s, size=%d\n", p, str, size);
} }
return_code = Tcl_EvalEx(interp, str, (int)size, TCL_EVAL_GLOBAL); return_code = Tcl_EvalEx(interp, str, (int)size, TCL_EVAL_GLOBAL);

View File

@ -55,10 +55,10 @@ void hier_psprint(char **res, int what) /* netlister driver */
zoom_full(0, 0, 1, 0.97); zoom_full(0, 0, 1, 0.97);
if(what & 1) ps_draw(2); /* page */ if(what & 1) ps_draw(2); /* page */
if(what & 2) { /* print cellname */ if(what & 2) { /* print cellname */
my_strcat(1637, res, hier_psprint_mtime(xctx->sch[xctx->currsch])); my_strcat(_ALLOC_ID_, res, hier_psprint_mtime(xctx->sch[xctx->currsch]));
my_strcat(1638, res, " {"); my_strcat(_ALLOC_ID_, res, " {");
my_strcat(1639, res, xctx->sch[xctx->currsch]); my_strcat(_ALLOC_ID_, res, xctx->sch[xctx->currsch]);
my_strcat(1640, res, "}\n"); my_strcat(_ALLOC_ID_, res, "}\n");
} }
dbg(1,"--> %s\n", skip_dir( xctx->sch[xctx->currsch]) ); dbg(1,"--> %s\n", skip_dir( xctx->sch[xctx->currsch]) );
unselect_all(1); unselect_all(1);
@ -67,7 +67,7 @@ void hier_psprint(char **res, int what) /* netlister driver */
xctx->pop_undo(2, 0); xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(1227, &xctx->sch_path[xctx->currsch+1], "->netlisting"); my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->sch_path_hash[xctx->currsch+1] = 0;
xctx->currsch++; xctx->currsch++;
subckt_name=NULL; subckt_name=NULL;
@ -92,10 +92,10 @@ void hier_psprint(char **res, int what) /* netlister driver */
zoom_full(0, 0, 1, 0.97); zoom_full(0, 0, 1, 0.97);
if(what & 1) ps_draw(2); /* page */ if(what & 1) ps_draw(2); /* page */
if(what & 2) { /* print cellname */ if(what & 2) { /* print cellname */
my_strcat(1641, res, hier_psprint_mtime(xctx->sch[xctx->currsch])); my_strcat(_ALLOC_ID_, res, hier_psprint_mtime(xctx->sch[xctx->currsch]));
my_strcat(1642, res, " {"); my_strcat(_ALLOC_ID_, res, " {");
my_strcat(1643, res, xctx->sch[xctx->currsch]); my_strcat(_ALLOC_ID_, res, xctx->sch[xctx->currsch]);
my_strcat(1644, res, "}\n"); my_strcat(_ALLOC_ID_, res, "}\n");
} }
dbg(1,"--> %s\n", skip_dir( xctx->sch[xctx->currsch]) ); dbg(1,"--> %s\n", skip_dir( xctx->sch[xctx->currsch]) );
} }
@ -130,7 +130,7 @@ static char *model_name(const char *m)
if(n<2) my_strncpy(model_name_result, m_lower, l); if(n<2) my_strncpy(model_name_result, m_lower, l);
else { else {
/* build a hash key value with no spaces to make device_model attributes with different spaces equivalent*/ /* build a hash key value with no spaces to make device_model attributes with different spaces equivalent*/
my_strcat(296, &model_name_result, modelname); my_strcat(_ALLOC_ID_, &model_name_result, modelname);
} }
my_free(_ALLOC_ID_, &modelname); my_free(_ALLOC_ID_, &modelname);
my_free(_ALLOC_ID_, &m_lower); my_free(_ALLOC_ID_, &m_lower);
@ -389,7 +389,7 @@ void global_spice_netlist(int global) /* netlister driver */
xctx->pop_undo(2, 0); xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(481, &xctx->sch_path[xctx->currsch+1], "->netlisting"); my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->sch_path_hash[xctx->currsch+1] = 0;
xctx->currsch++; xctx->currsch++;

View File

@ -187,7 +187,7 @@ void global_tedax_netlist(int global) /* netlister driver */
xctx->pop_undo(2, 0); xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(485, &xctx->sch_path[xctx->currsch+1], "->netlisting"); my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->sch_path_hash[xctx->currsch+1] = 0;
xctx->currsch++; xctx->currsch++;

View File

@ -2533,7 +2533,7 @@ void print_verilog_element(FILE *fd, int inst)
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "verilogprefix", 0)); get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "verilogprefix", 0));
if(verilogprefix) { if(verilogprefix) {
my_strdup(_ALLOC_ID_, &symname, verilogprefix); my_strdup(_ALLOC_ID_, &symname, verilogprefix);
my_strcat(1621, &symname, skip_dir(xctx->inst[inst].name)); my_strcat(_ALLOC_ID_, &symname, skip_dir(xctx->inst[inst].name));
} else { } else {
my_strdup(_ALLOC_ID_, &symname, skip_dir(xctx->inst[inst].name)); my_strdup(_ALLOC_ID_, &symname, skip_dir(xctx->inst[inst].name));
} }
@ -3539,8 +3539,8 @@ const char *translate2(Lcc *lcc, int level, char* s)
int i; int i;
for(i = 1; i <level; i++) { for(i = 1; i <level; i++) {
const char *instname = get_tok_value(lcc[i].prop_ptr, "name", 0); const char *instname = get_tok_value(lcc[i].prop_ptr, "name", 0);
my_strcat(440, &path, instname); my_strcat(_ALLOC_ID_, &path, instname);
my_strcat(1071, &path, "."); my_strcat(_ALLOC_ID_, &path, ".");
} }
} }
dbg(1, "path=%s\n", path); dbg(1, "path=%s\n", path);

View File

@ -75,7 +75,7 @@ END{
leak+= address[i] leak+= address[i]
print " address[ " i ", " idx[i] " ]= " address[i] print " address[ " i ", " idx[i] " ]= " address[i]
if(show_source) { if(show_source) {
pipe = "egrep -n 'my_(malloc|calloc|realloc|free|strdup|strdup2)\\(" idx[i] ",' *.c xschem.h" pipe = "egrep -n 'my_(malloc|calloc|realloc|free|strcat|strncat|strdup|strdup2)\\(" idx[i] ",' *.c xschem.h"
while( pipe | getline a) print " " a while( pipe | getline a) print " " a
close(pipe) close(pipe)
} }

View File

@ -344,7 +344,7 @@ void global_verilog_netlist(int global) /* netlister driver */
xctx->pop_undo(2, 0); xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(496, &xctx->sch_path[xctx->currsch+1], "->netlisting"); my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->sch_path_hash[xctx->currsch+1] = 0;
xctx->currsch++; xctx->currsch++;
@ -483,7 +483,7 @@ void verilog_block_netlist(FILE *fd, int i)
get_tok_value(xctx->sym[i].prop_ptr, "verilogprefix", 0)); get_tok_value(xctx->sym[i].prop_ptr, "verilogprefix", 0));
if(verilogprefix) { if(verilogprefix) {
my_strdup(_ALLOC_ID_, &symname, verilogprefix); my_strdup(_ALLOC_ID_, &symname, verilogprefix);
my_strcat(1626, &symname, skip_dir(xctx->sym[i].name)); my_strcat(_ALLOC_ID_, &symname, skip_dir(xctx->sym[i].name));
} else { } else {
my_strdup(_ALLOC_ID_, &symname, skip_dir(xctx->sym[i].name)); my_strdup(_ALLOC_ID_, &symname, skip_dir(xctx->sym[i].name));
} }

View File

@ -439,7 +439,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
xctx->pop_undo(2, 0); xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(509, &xctx->sch_path[xctx->currsch+1], "->netlisting"); my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->sch_path_hash[xctx->currsch+1] = 0;
xctx->currsch++; xctx->currsch++;

View File

@ -2020,11 +2020,11 @@ int Tcl_AppInit(Tcl_Interp *inter)
my_strdup(_ALLOC_ID_, &up_hier, "../../.."); my_strdup(_ALLOC_ID_, &up_hier, "../../..");
} }
else my_strdup(_ALLOC_ID_, &up_hier, ".."); else my_strdup(_ALLOC_ID_, &up_hier, "..");
/* my_strcat(415, &win_xschem_library_path, "."); */ /* my_strcat(_ALLOC_ID_, &win_xschem_library_path, "."); */
for (i = 0; i < WIN_XSCHEM_LIBRARY_PATH_NUM; ++i) { for (i = 0; i < WIN_XSCHEM_LIBRARY_PATH_NUM; ++i) {
my_snprintf(tmp, S(tmp),"%s/%s/%s", install_dir, up_hier, WIN_XSCHEM_LIBRARY_PATH[i]); my_snprintf(tmp, S(tmp),"%s/%s/%s", install_dir, up_hier, WIN_XSCHEM_LIBRARY_PATH[i]);
if (i > 0) my_strcat(416, &win_xschem_library_path, "\;"); if (i > 0) my_strcat(_ALLOC_ID_, &win_xschem_library_path, "\;");
my_strcat(431, &win_xschem_library_path, tmp); my_strcat(_ALLOC_ID_, &win_xschem_library_path, tmp);
} }
my_snprintf(tmp, S(tmp), "set tmp2 {%s}; " my_snprintf(tmp, S(tmp), "set tmp2 {%s}; "
"while {[regsub {([^/]*\\.*[^./]+[^/]*)/\\.\\./?} $tmp2 {} tmp2]} {}; ", win_xschem_library_path); "while {[regsub {([^/]*\\.*[^./]+[^/]*)/\\.\\./?} $tmp2 {} tmp2]} {}; ", win_xschem_library_path);