From 1da5e47d4ad8e10c4f99257477b20504693dec42 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Mon, 23 Jan 2023 15:42:15 +0100 Subject: [PATCH] remove my*() allocation routines unique IDs and replace with _ALLOC_ID_ macro, to be substituted in debug sessions with create_alloc_ids.awk --- src/actions.c | 164 +++++------ src/callback.c | 124 ++++----- src/check.c | 24 +- src/create_alloc_ids.awk | 47 ++++ src/draw.c | 142 +++++----- src/editprop.c | 114 ++++---- src/expandlabel.y | 80 +++--- src/findnet.c | 4 +- src/font.c | 2 +- src/hash_iterator.c | 8 +- src/hilight.c | 176 ++++++------ src/in_memory_undo.c | 384 +++++++++++++------------- src/main.c | 6 +- src/move.c | 46 ++-- src/netlist.c | 136 +++++----- src/node_hash.c | 60 ++--- src/options.c | 6 +- src/parselabel.l | 20 +- src/paste.c | 28 +- src/psprint.c | 32 +-- src/save.c | 338 +++++++++++------------ src/scheduler.c | 62 ++--- src/select.c | 32 +-- src/spice_netlist.c | 126 ++++----- src/store.c | 50 ++-- src/svgdraw.c | 20 +- src/tedax_netlist.c | 20 +- src/token.c | 570 +++++++++++++++++++-------------------- src/verilog_netlist.c | 106 ++++---- src/vhdl_netlist.c | 104 +++---- src/xinit.c | 242 ++++++++--------- src/xschem.h | 5 +- 32 files changed, 1663 insertions(+), 1615 deletions(-) create mode 100755 src/create_alloc_ids.awk diff --git a/src/actions.c b/src/actions.c index b1eb2f93..729f04e5 100644 --- a/src/actions.c +++ b/src/actions.c @@ -51,7 +51,7 @@ unsigned int hash_file(const char *f, int skip_path_lines) /* skip lines of type: '** sch_path: ...' or '-- sch_path: ...' or '// sym_path: ...' */ if(skip_path_lines && strlen(line) > 14) { if(!strncmp(line+2, " sch_path: ", 11) || !strncmp(line+2, " sym_path: ", 11) ) { - my_free(1388, &line); + my_free(_ALLOC_ID_, &line); continue; } } @@ -60,7 +60,7 @@ unsigned int hash_file(const char *f, int skip_path_lines) /* skip CRs so hashes will match on unix / windows */ if(line[i] == '\r') { cr = 1; - my_free(1519, &line); + my_free(_ALLOC_ID_, &line); continue; } else if(line[i] == '\n' && cr) { cr = 0; @@ -70,7 +70,7 @@ unsigned int hash_file(const char *f, int skip_path_lines) } h += (h << 5) + (unsigned char)line[i]; } - my_free(1545, &line); + my_free(_ALLOC_ID_, &line); } if(cr) h += (h << 5) + '\r'; /* file ends with \r not followed by \n: keep it */ fclose(fd); @@ -461,7 +461,7 @@ void ask_new_file(void) remove_symbols(); load_schematic(1, f,1); /* 20180925.1 */ tclvareval("update_recent_file {", f, "}", NULL); - my_strdup(1, &xctx->sch_path[xctx->currsch],"."); + my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch],"."); xctx->sch_path_hash[xctx->currsch] = 0; xctx->sch_inst_number[xctx->currsch] = 1; zoom_full(1, 0, 1, 0.97); @@ -479,60 +479,60 @@ void remove_symbol(int j) xSymbol save; dbg(1,"clearing symbol %s\n", xctx->sym[j].name); - my_free(666, &xctx->sym[j].prop_ptr); - my_free(667, &xctx->sym[j].templ); - my_free(668, &xctx->sym[j].type); - my_free(684, &xctx->sym[j].name); + my_free(_ALLOC_ID_, &xctx->sym[j].prop_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].templ); + my_free(_ALLOC_ID_, &xctx->sym[j].type); + my_free(_ALLOC_ID_, &xctx->sym[j].name); /* /20150409 */ for(c=0;csym[j].polygons[c];i++) { if(xctx->sym[j].poly[c][i].prop_ptr != NULL) { - my_free(669, &xctx->sym[j].poly[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].poly[c][i].prop_ptr); } - my_free(670, &xctx->sym[j].poly[c][i].x); - my_free(671, &xctx->sym[j].poly[c][i].y); - my_free(672, &xctx->sym[j].poly[c][i].selected_point); + my_free(_ALLOC_ID_, &xctx->sym[j].poly[c][i].x); + my_free(_ALLOC_ID_, &xctx->sym[j].poly[c][i].y); + my_free(_ALLOC_ID_, &xctx->sym[j].poly[c][i].selected_point); } - my_free(673, &xctx->sym[j].poly[c]); + my_free(_ALLOC_ID_, &xctx->sym[j].poly[c]); xctx->sym[j].polygons[c] = 0; for(i=0;isym[j].lines[c];i++) { if(xctx->sym[j].line[c][i].prop_ptr != NULL) { - my_free(674, &xctx->sym[j].line[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].line[c][i].prop_ptr); } } - my_free(675, &xctx->sym[j].line[c]); + my_free(_ALLOC_ID_, &xctx->sym[j].line[c]); xctx->sym[j].lines[c] = 0; for(i=0;isym[j].arcs[c];i++) { if(xctx->sym[j].arc[c][i].prop_ptr != NULL) { - my_free(676, &xctx->sym[j].arc[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].arc[c][i].prop_ptr); } } - my_free(677, &xctx->sym[j].arc[c]); + my_free(_ALLOC_ID_, &xctx->sym[j].arc[c]); xctx->sym[j].arcs[c] = 0; for(i=0;isym[j].rects[c];i++) { if(xctx->sym[j].rect[c][i].prop_ptr != NULL) { - my_free(678, &xctx->sym[j].rect[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].rect[c][i].prop_ptr); } set_rect_extraptr(0, &xctx->sym[j].rect[c][i]); } - my_free(679, &xctx->sym[j].rect[c]); + my_free(_ALLOC_ID_, &xctx->sym[j].rect[c]); xctx->sym[j].rects[c] = 0; } for(i=0;isym[j].texts;i++) { if(xctx->sym[j].text[i].prop_ptr != NULL) { - my_free(680, &xctx->sym[j].text[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].text[i].prop_ptr); } if(xctx->sym[j].text[i].txt_ptr != NULL) { - my_free(681, &xctx->sym[j].text[i].txt_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].text[i].txt_ptr); } if(xctx->sym[j].text[i].font != NULL) { - my_free(682, &xctx->sym[j].text[i].font); + my_free(_ALLOC_ID_, &xctx->sym[j].text[i].font); } } - my_free(683, &xctx->sym[j].text); + my_free(_ALLOC_ID_, &xctx->sym[j].text); xctx->sym[j].texts = 0; save = xctx->sym[j]; /* save cleared symbol slot */ @@ -592,7 +592,7 @@ int set_rect_extraptr(int what, xRect *drptr) if(drptr->flags & 1024) { /* embedded image */ if(!drptr->extraptr) { xEmb_image *d; - d = my_malloc(1465, sizeof(xEmb_image)); + d = my_malloc(_ALLOC_ID_, sizeof(xEmb_image)); d->image = NULL; drptr->extraptr = d; } @@ -602,7 +602,7 @@ int set_rect_extraptr(int what, xRect *drptr) if(drptr->extraptr) { xEmb_image *d = drptr->extraptr; if(d->image) cairo_surface_destroy(d->image); - my_free(1476, &drptr->extraptr); + my_free(_ALLOC_ID_, &drptr->extraptr); } } } @@ -616,55 +616,55 @@ void clear_drawing(void) xctx->graph_lastsel = -1; del_inst_table(); del_wire_table(); - my_free(685, &xctx->schtedaxprop); - my_free(686, &xctx->schsymbolprop); - my_free(687, &xctx->schprop); - my_free(688, &xctx->schvhdlprop); - my_free(689, &xctx->version_string); - if(xctx->header_text) my_free(1654, &xctx->header_text); - my_free(690, &xctx->schverilogprop); + my_free(_ALLOC_ID_, &xctx->schtedaxprop); + my_free(_ALLOC_ID_, &xctx->schsymbolprop); + my_free(_ALLOC_ID_, &xctx->schprop); + my_free(_ALLOC_ID_, &xctx->schvhdlprop); + my_free(_ALLOC_ID_, &xctx->version_string); + if(xctx->header_text) my_free(_ALLOC_ID_, &xctx->header_text); + my_free(_ALLOC_ID_, &xctx->schverilogprop); for(i=0;iwires;i++) { - my_free(691, &xctx->wire[i].prop_ptr); - my_free(692, &xctx->wire[i].node); + my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->wire[i].node); } xctx->wires = 0; for(i=0;iinstances;i++) { - my_free(693, &xctx->inst[i].prop_ptr); - my_free(694, &xctx->inst[i].name); - my_free(695, &xctx->inst[i].instname); - my_free(874, &xctx->inst[i].lab); + my_free(_ALLOC_ID_, &xctx->inst[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->inst[i].name); + my_free(_ALLOC_ID_, &xctx->inst[i].instname); + my_free(_ALLOC_ID_, &xctx->inst[i].lab); delete_inst_node(i); } xctx->instances = 0; for(i=0;itexts;i++) { - my_free(696, &xctx->text[i].font); - my_free(697, &xctx->text[i].prop_ptr); - my_free(698, &xctx->text[i].txt_ptr); + my_free(_ALLOC_ID_, &xctx->text[i].font); + my_free(_ALLOC_ID_, &xctx->text[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->text[i].txt_ptr); } xctx->texts = 0; for(i=0;ilines[i];j++) { - my_free(699, &xctx->line[i][j].prop_ptr); + my_free(_ALLOC_ID_, &xctx->line[i][j].prop_ptr); } for(j=0;jrects[i];j++) { - my_free(700, &xctx->rect[i][j].prop_ptr); + my_free(_ALLOC_ID_, &xctx->rect[i][j].prop_ptr); set_rect_extraptr(0, &xctx->rect[i][j]); } for(j=0;jarcs[i];j++) { - my_free(701, &xctx->arc[i][j].prop_ptr); + my_free(_ALLOC_ID_, &xctx->arc[i][j].prop_ptr); } for(j=0;jpolygons[i]; j++) { - my_free(702, &xctx->poly[i][j].x); - my_free(703, &xctx->poly[i][j].y); - my_free(704, &xctx->poly[i][j].prop_ptr); - my_free(705, &xctx->poly[i][j].selected_point); + my_free(_ALLOC_ID_, &xctx->poly[i][j].x); + my_free(_ALLOC_ID_, &xctx->poly[i][j].y); + my_free(_ALLOC_ID_, &xctx->poly[i][j].prop_ptr); + my_free(_ALLOC_ID_, &xctx->poly[i][j].selected_point); } xctx->lines[i] = 0; xctx->arcs[i] = 0; @@ -799,8 +799,8 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 int use_label_prefix; int found=0; - my_strdup(1611, &symname_pin, tcleval("rel_sym_path [find_file lab_pin.sym]")); - my_strdup(1607, &symname_wire, tcleval("rel_sym_path [find_file lab_wire.sym]")); + my_strdup(_ALLOC_ID_, &symname_pin, tcleval("rel_sym_path [find_file lab_pin.sym]")); + my_strdup(_ALLOC_ID_, &symname_wire, tcleval("rel_sym_path [find_file lab_wire.sym]")); if(symname_pin && symname_wire) { rebuild_selected_array(); k = xctx->lastsel; @@ -808,7 +808,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 prepare_netlist_structs(0); for(j=0;jsel_array[j].type==ELEMENT) { found=1; - my_strdup(5, &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, "_"); tclsetvar("custom_label_prefix",prop); @@ -817,7 +817,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 tcleval("attach_labels_to_inst"); if(!strcmp(tclgetvar("rcode"),"") ) { bbox(END, 0., 0., 0., 0.); - my_free(706, &prop); + my_free(_ALLOC_ID_, &prop); return; } } @@ -831,7 +831,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 use_label_prefix = atoi(tclgetvar("use_label_prefix")); rot_txt = tclgetvar("rotated_text"); if(strcmp(rot_txt,"")) rotated_text=atoi(rot_txt); - my_strdup(7, &type,(xctx->inst[xctx->sel_array[j].n].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[xctx->sel_array[j].n].ptr+ xctx->sym)->type); if( type && IS_LABEL_OR_PIN(type) ) { continue; } @@ -851,7 +851,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 rct=symbol->rect[PINLAYER]; for(i=0;i labname=%s\n", labname); pinx0 = (rct[i].x1+rct[i].x2)/2; @@ -895,7 +895,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 wptr = wptr->next; } if(!skip) { - my_strdup(9, &prop, "name=p1 lab="); + my_strdup(_ALLOC_ID_, &prop, "name=p1 lab="); if(use_label_prefix) { my_strcat(10, &prop, (char *)tclgetvar("custom_label_prefix")); } @@ -920,9 +920,9 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 dbg(1, "attach_labels_to_inst(): %d %.16g %.16g %s\n", i, pinx0, piny0,labname); } } - my_free(707, &prop); - my_free(708, &labname); - my_free(709, &type); + my_free(_ALLOC_ID_, &prop); + my_free(_ALLOC_ID_, &labname); + my_free(_ALLOC_ID_, &type); if(!found) return; /* draw things */ bbox(SET , 0.0 , 0.0 , 0.0 , 0.0); @@ -932,8 +932,8 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 fprintf(errfp, "attach_labels_to_inst(): location of schematic labels not found\n"); tcleval("alert_ {attach_labels_to_inst(): location of schematic labels not found} {}"); } - my_free(1609, &symname_pin); - my_free(1610, &symname_wire); + my_free(_ALLOC_ID_, &symname_pin); + my_free(_ALLOC_ID_, &symname_wire); } void delete_files(void) @@ -1012,7 +1012,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot xctx->inst[n].instname=NULL; xctx->inst[n].lab=NULL; dbg(1, "place_symbol(): entering my_strdup: name=%s\n",name); /* 03-02-2000 */ - my_strdup2(12, &xctx->inst[n].name ,name); + my_strdup2(_ALLOC_ID_, &xctx->inst[n].name ,name); dbg(1, "place_symbol(): done my_strdup: name=%s\n",name); /* 03-02-2000 */ /* xctx->inst[n].x0=symbol_name ? x : xctx->mousex_snap; */ /* xctx->inst[n].y0=symbol_name ? y : xctx->mousey_snap; */ @@ -1041,7 +1041,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot type = xctx->sym[xctx->inst[n].ptr].type; cond= !type || !IS_LABEL_SH_OR_PIN(type); if(cond) xctx->inst[n].flags|=2; - else my_strdup(145, &xctx->inst[n].lab, get_tok_value(xctx->inst[n].prop_ptr,"lab",0)); + else my_strdup(_ALLOC_ID_, &xctx->inst[n].lab, get_tok_value(xctx->inst[n].prop_ptr,"lab",0)); xctx->inst[n].embed = !strcmp(get_tok_value(xctx->inst[n].prop_ptr, "embed", 2), "true"); if(first_call && (draw_sym & 3) ) bbox(START, 0.0 , 0.0 , 0.0 , 0.0); xctx->instances++; /* must be updated before calling symbol_bbox() */ @@ -1190,25 +1190,25 @@ void get_sch_from_sym(char *filename, xSymbol *sym) strstr(xctx->current_dirname, "https://") == xctx->current_dirname) { web_url = 1; } - my_strdup2(1646, &str_tmp, get_tok_value(sym->prop_ptr, "schematic", 2)); + my_strdup2(_ALLOC_ID_, &str_tmp, get_tok_value(sym->prop_ptr, "schematic", 2)); if(str_tmp[0]) { /* @symname in schematic attribute will be replaced with symbol name */ if( (ptr = strstr(str_tmp, "@symname"))) { *ptr = '\0'; - my_strdup2(1648, &sch, str_tmp); + my_strdup2(_ALLOC_ID_, &sch, str_tmp); my_strcat(1649, &sch, sym->name); ptr += 8; my_strcat(1650, &sch, ptr); } else { - my_strdup2(1252, &sch, str_tmp); + my_strdup2(_ALLOC_ID_, &sch, str_tmp); } dbg(1, "get_sch_from_sym(): sch=%s\n", sch); - my_strdup2(1651, &sch, tcl_hook2(&sch)); + my_strdup2(_ALLOC_ID_, &sch, tcl_hook2(&sch)); dbg(1, "get_sch_from_sym(): after tcl_hook2 sch=%s\n", sch); /* for schematics referenced from web symbols do not build absolute path */ if(web_url) my_strncpy(filename, sch, PATH_MAX); else my_strncpy(filename, abs_sym_path(sch, ""), PATH_MAX); - my_free(1253, &sch); + my_free(_ALLOC_ID_, &sch); } else { if(tclgetboolvar("search_schematic")) { /* for schematics referenced from web symbols do not build absolute path */ @@ -1220,7 +1220,7 @@ void get_sch_from_sym(char *filename, xSymbol *sym) else my_strncpy(filename, add_ext(abs_sym_path(sym->name, ""), ".sch"), PATH_MAX); } } - my_free(1647, &str_tmp); + my_free(_ALLOC_ID_, &str_tmp); dbg(1, "get_sch_from_sym(): sym->name=%s, filename=%s\n", sym->name, filename); } @@ -1293,11 +1293,11 @@ int descend_schematic(int instnumber) str = ""; inst_mult = 1; } - my_strdup(14, &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]); xctx->sch_path_hash[xctx->currsch+1] =0; - my_strdup(1516, &xctx->hier_attr[xctx->currsch].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].prop_ptr, xctx->inst[n].prop_ptr); - my_strdup(1613, &xctx->hier_attr[xctx->currsch].templ, + my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].templ, get_tok_value((xctx->inst[n].ptr+ xctx->sym)->prop_ptr, "template", 0)); inst_number = 1; if(inst_mult > 1) { /* on multiple instances ask where to descend, to correctly evaluate @@ -1311,7 +1311,7 @@ int descend_schematic(int instnumber) inum = tclresult(); dbg(1, "descend_schematic(): inum=%s\n", inum); if(!inum[0]) { - my_free(710, &xctx->sch_path[xctx->currsch+1]); + my_free(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1]); xctx->sch_path_hash[xctx->currsch+1] =0; return 0; } @@ -2088,7 +2088,7 @@ void change_layer() if(xctx->rectcolor != xctx->text[n].layer) { char *p; set_modify(1); - my_strdup(1386, &xctx->text[n].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->text[n].prop_ptr, subst_token(xctx->text[n].prop_ptr, "layer", dtoa(xctx->rectcolor) )); xctx->text[n].layer = xctx->rectcolor; p = xctx->text[n].prop_ptr; @@ -2312,8 +2312,8 @@ void new_polygon(int what) if(xctx->nl_points >= xctx->nl_maxpoints-1) { /* check storage for 2 xctx->nl_points */ xctx->nl_maxpoints = (1+xctx->nl_points / CADCHUNKALLOC) * CADCHUNKALLOC; - my_realloc(17, &xctx->nl_polyx, sizeof(double)*xctx->nl_maxpoints); - my_realloc(18, &xctx->nl_polyy, sizeof(double)*xctx->nl_maxpoints); + my_realloc(_ALLOC_ID_, &xctx->nl_polyx, sizeof(double)*xctx->nl_maxpoints); + my_realloc(_ALLOC_ID_, &xctx->nl_polyy, sizeof(double)*xctx->nl_maxpoints); } if( what & PLACE ) { @@ -2360,8 +2360,8 @@ void new_polygon(int what) drawtemppolygon(xctx->gc[xctx->rectcolor], NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points); xctx->ui_state &= ~STARTPOLYGON; drawpolygon(xctx->rectcolor, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points, 0, 0); - my_free(711, &xctx->nl_polyx); - my_free(712, &xctx->nl_polyy); + my_free(_ALLOC_ID_, &xctx->nl_polyx); + my_free(_ALLOC_ID_, &xctx->nl_polyy); xctx->nl_maxpoints = xctx->nl_points = 0; } if(what & RUBBER) @@ -2400,7 +2400,7 @@ int text_bbox(const char *str, double xscale, double yscale, ww=0.; hh=1.; c=0; *cairo_lines=1; - my_strdup2(1158, &s, str); + my_strdup2(_ALLOC_ID_, &s, str); str_ptr = s; while( s && s[c] ) { if(s[c] == '\n') { @@ -2423,7 +2423,7 @@ int text_bbox(const char *str, double xscale, double yscale, maxw = ext.x_advance > ext.width ? ext.x_advance : ext.width; if(maxw > ww) ww= maxw; } - my_free(1159, &s); + my_free(_ALLOC_ID_, &s); hh = hh*fext.height * cairo_font_line_spacing; *cairo_longest_line = ww; @@ -2580,7 +2580,7 @@ int place_text(int draw_text, double mx, double my) t->txt_ptr=NULL; t->prop_ptr=NULL; /* 20111006 added missing initialization of pointer */ t->font=NULL; - my_strdup(19, &t->txt_ptr, txt); + my_strdup(_ALLOC_ID_, &t->txt_ptr, txt); t->x0=mx; t->y0=my; t->rot=0; @@ -2588,7 +2588,7 @@ int place_text(int draw_text, double mx, double my) t->sel=0; t->xscale= atof(tclgetvar("hsize")); t->yscale= atof(tclgetvar("vsize")); - my_strdup(20, &t->prop_ptr, (char *)tclgetvar("props")); + my_strdup(_ALLOC_ID_, &t->prop_ptr, (char *)tclgetvar("props")); /* debug ... */ /* t->prop_ptr=NULL; */ dbg(1, "place_text(): done text input\n"); @@ -2611,7 +2611,7 @@ int place_text(int draw_text, double mx, double my) str = get_tok_value(t->prop_ptr, "hide", 0); t->flags |= strcmp(str, "true") ? 0 : HIDE_TEXT; - my_strdup(21, &t->font, get_tok_value(t->prop_ptr, "font", 0)); + my_strdup(_ALLOC_ID_, &t->font, get_tok_value(t->prop_ptr, "font", 0)); textlayer = t->layer; if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER; #if HAS_CAIRO==1 diff --git a/src/callback.c b/src/callback.c index 14eaa668..436b3800 100644 --- a/src/callback.c +++ b/src/callback.c @@ -575,8 +575,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(fabs(xctx->my_double_save - xctx->mousey_snap) > fabs(gr->dcy * delta) * delta_threshold) { yy1 = gr->ypos1 + (xctx->my_double_save - xctx->mousey_snap) / gr->dcy; yy2 = gr->ypos2 + (xctx->my_double_save - xctx->mousey_snap) / gr->dcy; - my_strdup(1424, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); - my_strdup(1425, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); xctx->my_double_save = xctx->mousey_snap; need_redraw = 1; } @@ -586,8 +586,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(fabs(xctx->my_double_save - xctx->mousey_snap) > fabs(gr->cy * delta) * delta_threshold) { yy1 = gr->gy1 + (xctx->my_double_save - xctx->mousey_snap) / gr->cy; yy2 = gr->gy2 + (xctx->my_double_save - xctx->mousey_snap) / gr->cy; - my_strdup(1435, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(1437, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); xctx->my_double_save = xctx->mousey_snap; need_redraw = 1; } @@ -603,8 +603,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(fabs(xctx->mx_double_save - xctx->mousex_snap) > fabs(gr->cx * delta) * delta_threshold) { xx1 = gr->gx1 + (xctx->mx_double_save - xctx->mousex_snap) / gr->cx; xx2 = gr->gx2 + (xctx->mx_double_save - xctx->mousex_snap) / gr->cx; - my_strdup(1410, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(1411, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -618,16 +618,16 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta = gr->posh * 0.05; yy1 = gr->ypos1 + delta; yy2 = gr->ypos2 + delta; - my_strdup(1456, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); - my_strdup(1457, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); need_redraw = 1; } else { delta = gr->gh/ gr->divy; delta_threshold = 1.0; yy1 = gr->gy1 + delta * delta_threshold; yy2 = gr->gy2 + delta * delta_threshold; - my_strdup(1420, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(1421, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); need_redraw = 1; } } @@ -638,8 +638,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta_threshold = 0.05; xx1 = gr->gx1 - delta * delta_threshold; xx2 =gr->gx2 - delta * delta_threshold; - my_strdup(1428, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(1429, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -649,7 +649,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int const char *unlocked = strstr(get_tok_value(r->prop_ptr, "flags", 0), "unlocked"); if(i == xctx->graph_master || !unlocked) { gr->dataset = track_dset; - my_strdup(1448, &r->prop_ptr, subst_token(r->prop_ptr, "dataset", my_itoa(track_dset))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "dataset", my_itoa(track_dset))); } if((xctx->graph_flags & 4) && tclgetboolvar("live_cursor2_backannotate")) { if(i == xctx->graph_master) backannotate_at_cursor_b_pos(r, gr); @@ -671,8 +671,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = delta * 0.2; yy2 = gr->gy2 + var * b / delta; yy1 = gr->gy1 - var * a / delta; - my_strdup(1451, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(1517, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); need_redraw = 1; } } else { @@ -680,8 +680,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta_threshold = 0.05; xx1 = gr->gx1 - delta * delta_threshold; xx2 = gr->gx2 - delta * delta_threshold; - my_strdup(1395, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(1396, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -693,16 +693,16 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta = gr->posh * 0.05; yy1 = gr->ypos1 - delta; yy2 = gr->ypos2 - delta; - my_strdup(1416, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); - my_strdup(1417, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); need_redraw = 1; } else { delta = gr->gh / gr->divy; delta_threshold = 1.0; yy1 = gr->gy1 - delta * delta_threshold; yy2 = gr->gy2 - delta * delta_threshold; - my_strdup(1458, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(1434, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); need_redraw = 1; } } @@ -713,8 +713,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta_threshold = 0.05; xx1 = gr->gx1 + delta * delta_threshold; xx2 = gr->gx2 + delta * delta_threshold; - my_strdup(1397, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(1398, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -730,8 +730,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = delta * 0.2; yy2 = gr->gy2 - var * b / delta; yy1 = gr->gy1 + var * a / delta; - my_strdup(1433, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(1439, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); need_redraw = 1; } } else { @@ -739,8 +739,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta_threshold = 0.05; xx1 = gr->gx1 + delta * delta_threshold; xx2 = gr->gx2 + delta * delta_threshold; - my_strdup(1430, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(1431, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -755,8 +755,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = delta * 0.05; yy2 = gr->ypos2 + var * b / delta; yy1 = gr->ypos1 - var * a / delta; - my_strdup(1461, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); - my_strdup(1459, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); need_redraw = 1; } else { @@ -767,8 +767,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = delta * 0.2; yy2 = gr->gy2 + var * b / delta; yy1 = gr->gy1 - var * a / delta; - my_strdup(1460, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(1438, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); need_redraw = 1; } } @@ -778,8 +778,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = 0.2 * gr->gw; xx2 = gr->gx2 + var * (1 - zoom_m); xx1 = gr->gx1 - var * zoom_m; - my_strdup(1399, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(1400, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -791,8 +791,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = 0.2 * gr->gw; xx2 = gr->gx2 + var * (1 - zoom_m); xx1 = gr->gx1 - var * zoom_m; - my_strdup(1418, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(1432, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -808,8 +808,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = delta * 0.05; yy2 = gr->ypos2 - var * b / delta; yy1 = gr->ypos1 + var * a / delta; - my_strdup(1447, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); - my_strdup(1436, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); need_redraw = 1; } else { double m = G_Y(xctx->mousey); @@ -819,8 +819,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = delta * 0.2; yy2 = gr->gy2 - var * b / delta; yy1 = gr->gy1 + var * a / delta; - my_strdup(1419, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(1444, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); need_redraw = 1; } } @@ -830,8 +830,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = 0.2 * gr->gw; xx2 = gr->gx2 - var * (1 - zoom_m); xx1 = gr->gx1 + var * zoom_m; - my_strdup(1449, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(1450, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -843,8 +843,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = 0.2 * gr->gw; xx2 = gr->gx2 - var * (1 - zoom_m); xx1 = gr->gx1 + var * zoom_m; - my_strdup(1445, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(1446, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -862,8 +862,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double min=0.0, max=0.0; int first = 1; char *saves, *sptr, *stok, *sweep = NULL, *saven, *nptr, *ntok, *node = NULL; - my_strdup2(1426, &node, get_tok_value(r->prop_ptr,"node",0)); - my_strdup2(542, &sweep, get_tok_value(r->prop_ptr,"sweep",0)); + my_strdup2(_ALLOC_ID_, &node, get_tok_value(r->prop_ptr,"node",0)); + my_strdup2(_ALLOC_ID_, &sweep, get_tok_value(r->prop_ptr,"sweep",0)); nptr = node; sptr = sweep; start = (gr->gx1 <= gr->gx2) ? gr->gx1 : gr->gx2; @@ -881,9 +881,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(!bus_msb) { char *express = NULL; if(strstr(ntok, ";")) { - my_strdup2(1505, &express, find_nth(ntok, ";", 2)); + my_strdup2(_ALLOC_ID_, &express, find_nth(ntok, ";", 2)); } else { - my_strdup2(1506, &express, ntok); + my_strdup2(_ALLOC_ID_, &express, ntok); } if(strpbrk(express, " \n\t")) { /* just probe a single point to get the index. custom data column already calculated */ @@ -891,7 +891,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int } else { j = get_raw_index(express); } - my_free(1507, &express); + my_free(_ALLOC_ID_, &express); } if(j >= 0) { int ofs = 0; @@ -918,15 +918,15 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(max == min) max += 0.01; min = floor_to_n_digits(min, 2); max = ceil_to_n_digits(max, 2); - my_free(1427, &node); - my_free(573, &sweep); - my_strdup(1422, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(min))); - my_strdup(1423, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(max))); + my_free(_ALLOC_ID_, &node); + my_free(_ALLOC_ID_, &sweep); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(min))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(max))); need_redraw = 1; } else { /* digital plot */ - my_strdup(1497, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", get_tok_value(r->prop_ptr, "y1", 0) )); - my_strdup(1498, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", get_tok_value(r->prop_ptr, "y2", 0) )); need_redraw = 1; } @@ -943,8 +943,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int xx1 = mylog10(xx1); xx2 = mylog10(xx2); } - my_strdup(1409, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(1412, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -979,8 +979,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int xx2 = pp + delta / 2.0; */ - my_strdup(1442, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(1443, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -1008,8 +1008,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(xx1 == xx2) xx2 += 1e-6; */ - my_strdup(1440, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(1441, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -2051,11 +2051,11 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key, if(!tool) { tool = atoi(tclgetvar("sim(spicewave,default)")); my_snprintf(str, S(str), "sim(spicewave,%d,name)", tool); - my_strdup(1271, &tool_name, tclgetvar(str)); + my_strdup(_ALLOC_ID_, &tool_name, tclgetvar(str)); dbg(1,"callback(): tool_name=%s\n", tool_name); if(strstr(tool_name, "Gaw")) tool=GAW; else if(strstr(tool_name, "Bespice")) tool=BESPICE; - my_free(1272, &tool_name); + my_free(_ALLOC_ID_, &tool_name); } } if(tool) { diff --git a/src/check.c b/src/check.c index 38dc0a37..7474495d 100644 --- a/src/check.c +++ b/src/check.c @@ -189,14 +189,14 @@ void trim_wires(void) xctx->wire[xctx->wires].y2=y0; xctx->wire[xctx->wires].sel=0; xctx->wire[xctx->wires].prop_ptr=NULL; - my_strdup(27, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[j].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[j].prop_ptr); if(!strcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true")) xctx->wire[xctx->wires].bus=1; else xctx->wire[xctx->wires].bus=0; xctx->wire[xctx->wires].node=NULL; - my_strdup(28, &xctx->wire[xctx->wires].node, xctx->wire[j].node); + my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].node, xctx->wire[j].node); xctx->wire[j].x1 = x0; xctx->wire[j].y1 = y0; hash_wire(XINSERT, xctx->wires, 0); @@ -212,7 +212,7 @@ void trim_wires(void) } /* dbg(1, "trim_wires(): break: %g\n", timer(1)); */ /* reduce included wires */ - my_realloc(29, &wireflag, xctx->wires*sizeof(unsigned short)); + my_realloc(_ALLOC_ID_, &wireflag, xctx->wires*sizeof(unsigned short)); memset(wireflag, 0, xctx->wires*sizeof(unsigned short)); for(i=0;iwires;i++) { if(wireflag[i]) continue; @@ -255,8 +255,8 @@ void trim_wires(void) if(wireflag[i]) { j++; /* hash_wire(XDELETE, i, 0);*/ /* can not be done since wire deletions change wire idexes in array */ - my_free(114, &xctx->wire[i].prop_ptr); - my_free(368, &xctx->wire[i].node); + my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->wire[i].node); continue; } if(j) { @@ -273,7 +273,7 @@ void trim_wires(void) /* after wire deletions full rehash is needed */ hash_wires(); - my_realloc(30, &wireflag, xctx->wires*sizeof(unsigned short)); + my_realloc(_ALLOC_ID_, &wireflag, xctx->wires*sizeof(unsigned short)); memset(wireflag, 0, xctx->wires*sizeof(unsigned short)); /* dbg(1, "trim_wires(): hash_wires_2: %g\n", timer(1)); */ @@ -351,8 +351,8 @@ void trim_wires(void) if(wireflag[i]) { j++; /* hash_wire(XDELETE, i, 0);*/ /* can not be done since wire deletions change wire idexes in array */ - my_free(116, &xctx->wire[i].prop_ptr); - my_free(331, &xctx->wire[i].node); + my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->wire[i].node); continue; } if(j) { @@ -374,7 +374,7 @@ void trim_wires(void) } } while(changed); dbg(1, "trim_wires(): doloops=%d changed=%d\n", doloops, changed); - my_free(115, &wireflag); + my_free(_ALLOC_ID_, &wireflag); update_conn_cues(WIRELAYER, 0, 0); } @@ -413,14 +413,14 @@ void break_wires_at_pins(void) xctx->wire[xctx->wires].y2=y0; xctx->wire[xctx->wires].sel=0; xctx->wire[xctx->wires].prop_ptr=NULL; - my_strdup(31, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr); if(!strcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true")) xctx->wire[xctx->wires].bus=1; else xctx->wire[xctx->wires].bus=0; xctx->wire[xctx->wires].node=NULL; hash_wire(XINSERT, xctx->wires, 0); /* insertion happens at beginning of list */ - my_strdup(32, &xctx->wire[xctx->wires].node, xctx->wire[i].node); + my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].node, xctx->wire[i].node); xctx->need_reb_sel_arr=1; xctx->wires++; xctx->wire[i].x1 = x0; @@ -469,7 +469,7 @@ void break_wires_at_pins(void) xctx->wire[xctx->wires].y2=y0; xctx->wire[xctx->wires].sel=0; xctx->wire[xctx->wires].prop_ptr=NULL; - my_strdup(33, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr); if(!strcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true")) xctx->wire[xctx->wires].bus=1; else diff --git a/src/create_alloc_ids.awk b/src/create_alloc_ids.awk new file mode 100755 index 00000000..431bd846 --- /dev/null +++ b/src/create_alloc_ids.awk @@ -0,0 +1,47 @@ +#!/usr/bin/gawk -f +# replaces _ALLOC_ID_ in all source files with unique ID for memory tracking + +BEGIN{ + + if(ARGC <= 1) { + print "Usage: " ENVIRON["_"] " create|reset" + exit + } + create_id = 0 + if(ARGV[1] == "create") create_id = 1 + ARGC = 1 + cnt = 0; + while("ls *.[chyl]" |getline) { + if($0 ~ /expandlabel\.c/) continue + if($0 ~ /expandlabel\.h/) continue + if($0 ~ /parselabel\.c/) continue + filename = $0 + f = "" + start = 1 + changed = 0 + while(getline < filename) { + if(create_id == 0) { + if(!start) f = f "\n" + start = 0 + str = gensub(/(my_(malloc|calloc|realloc|free|strdup|strdup2))\([0-9]+,/, "\\1(_ALLOC_ID_,", "G") + if(str != $0) changed = 1 + f = f str + } else { + if(!start) f = f "\n" + start = 0 + if($0 !~ /^#define *_ALLOC_ID_/) { + while(sub(/_ALLOC_ID_/, cnt)) { + changed = 1 + cnt++ + } + } + f = f $0 + } + } + close(filename) + if(changed) { + print f > filename + close(filename) + } + } +} diff --git a/src/draw.c b/src/draw.c index 2c4b1273..aacfa2d7 100644 --- a/src/draw.c +++ b/src/draw.c @@ -304,7 +304,7 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in dbg(1, "draw_string(): size * mooz=%g height=%g ascent=%g descent=%g\n", size * xctx->mooz, fext.height, fext.ascent, fext.descent); llength=0; - my_strdup2(73, &sss, str); + my_strdup2(_ALLOC_ID_, &sss, str); tt=ss=sss; for(;;) { c=*ss; @@ -325,7 +325,7 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in } ss++; } - my_free(1157, &sss); + my_free(_ALLOC_ID_, &sss); } #else /* !HAS_CAIRO */ @@ -504,16 +504,16 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot, for(j=0;j< symptr->polygons[layer];j++) { polygon = &(symptr->poly[layer])[j]; - x = my_malloc(34, sizeof(double) * polygon->points); - y = my_malloc(35, sizeof(double) * polygon->points); + x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); + y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); for(k=0;kpoints;k++) { ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]); x[k]+= x0; y[k] += y0; } drawpolygon(c, NOW, x, y, polygon->points, polygon->fill, polygon->dash); /* added fill */ - my_free(718, &x); - my_free(719, &y); + my_free(_ALLOC_ID_, &x); + my_free(_ALLOC_ID_, &y); } for(j=0;j< symptr->arcs[layer];j++) { @@ -683,16 +683,16 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot { /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */ int k; - double *x = my_malloc(36, sizeof(double) * polygon->points); - double *y = my_malloc(37, sizeof(double) * polygon->points); + double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); + double *y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); for(k=0;kpoints;k++) { ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]); x[k] += x0; y[k] += y0; } drawtemppolygon(gc, NOW, x, y, polygon->points); - my_free(720, &x); - my_free(721, &y); + my_free(_ALLOC_ID_, &x); + my_free(_ALLOC_ID_, &y); } } @@ -1504,7 +1504,7 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil return; } if(!xctx->only_probes && (x2-x1)<1.0 && (y2-y1)<1.0) return; - p = my_malloc(38, sizeof(XPoint) * points); + p = my_malloc(_ALLOC_ID_, sizeof(XPoint) * points); if(what) { for(i=0;igc[c], INT_WIDTH(xctx->lw) ,LineSolid, LINECAP , LINEJOIN); } - my_free(722, &p); + my_free(_ALLOC_ID_, &p); } void drawtemppolygon(GC g, int what, double *x, double *y, int points) @@ -1551,7 +1551,7 @@ void drawtemppolygon(GC g, int what, double *x, double *y, int points) y1=Y_TO_SCREEN(y1); x2=X_TO_SCREEN(x2); y2=Y_TO_SCREEN(y2); - p = my_malloc(39, sizeof(XPoint) * points); + p = my_malloc(_ALLOC_ID_, sizeof(XPoint) * points); if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) ) { for(i=0;iwindow, g, p, points, CoordModeOrigin); } - my_free(723, &p); + my_free(_ALLOC_ID_, &p); } void drawrect(int c, int what, double rectx1,double recty1,double rectx2,double recty2, int dash) @@ -1834,9 +1834,9 @@ static SPICE_DATA **get_bus_idx_array(const char *ntok, int *n_bits) *n_bits = count_items(ntok, ";,", "") - 1; /* dbg(0, "get_bus_idx_array(): ntok=%s\n", ntok); */ /* dbg(0, "get_bus_idx_array(): *n_bits=%d\n", *n_bits); */ - idx_arr = my_malloc(1454, (*n_bits) * sizeof(SPICE_DATA *)); + idx_arr = my_malloc(_ALLOC_ID_, (*n_bits) * sizeof(SPICE_DATA *)); p = 0; - my_strdup2(1402, &ntok_copy, ntok); + my_strdup2(_ALLOC_ID_, &ntok_copy, ntok); nptr = ntok_copy; my_strtok_r(nptr, ";,", "", &saven); /*strip off bus name (1st field) */ while( (bit_name = my_strtok_r(NULL, ";,", "", &saven)) ) { @@ -1850,7 +1850,7 @@ static SPICE_DATA **get_bus_idx_array(const char *ntok, int *n_bits) /* dbg(0, "get_bus_idx_array(): bit_name=%s, p=%d\n", bit_name, p); */ p++; } - my_free(1404, &ntok_copy); + my_free(_ALLOC_ID_, &ntok_copy); return idx_arr; } @@ -2333,18 +2333,18 @@ static void draw_graph_variables(int wcnt, int wave_color, int n_nodes, int swee char *ntok_ptr = NULL; char *alias_ptr = NULL; if(strstr(ntok, ";")) { - my_strdup2(646, &alias_ptr, find_nth(ntok, ";", 1)); - my_strdup2(665, &ntok_ptr, find_nth(ntok, ";", 2)); + my_strdup2(_ALLOC_ID_, &alias_ptr, find_nth(ntok, ";", 1)); + my_strdup2(_ALLOC_ID_, &ntok_ptr, find_nth(ntok, ";", 2)); } else { - my_strdup2(925, &alias_ptr, ntok); - my_strdup2(1155, &ntok_ptr, ntok); + my_strdup2(_ALLOC_ID_, &alias_ptr, ntok); + my_strdup2(_ALLOC_ID_, &ntok_ptr, ntok); } if(gr->unity != 1.0) my_snprintf(tmpstr, S(tmpstr), "%s[%c]", alias_ptr, gr->unity_suffix); else my_snprintf(tmpstr, S(tmpstr), "%s", alias_ptr); - my_free(1188, &alias_ptr); - my_free(1189, &ntok_ptr); + my_free(_ALLOC_ID_, &alias_ptr); + my_free(_ALLOC_ID_, &ntok_ptr); } if(gr->digital) { double xt = gr->x1 - 15 * gr->txtsizelab; @@ -2474,8 +2474,8 @@ int embed_rawfile(const char *rawfile) xctx->push_undo(); set_modify(1); ptr = base64_from_file(rawfile, &len); - my_strdup2(1466, &i->prop_ptr, subst_token(i->prop_ptr, "spice_data", ptr)); - my_free(1481, &ptr); + my_strdup2(_ALLOC_ID_, &i->prop_ptr, subst_token(i->prop_ptr, "spice_data", ptr)); + my_free(_ALLOC_ID_, &ptr); } return res; } @@ -2499,9 +2499,9 @@ int edit_wave_attributes(int what, int i, Graph_ctx *gr) xRect *r = &xctx->rect[GRIDLAYER][i]; /* get plot data */ - my_strdup2(1491, &node, get_tok_value(r->prop_ptr,"node",0)); - my_strdup2(1492, &color, get_tok_value(r->prop_ptr,"color",0)); - my_strdup2(1493, &sweep, get_tok_value(r->prop_ptr,"sweep",0)); + my_strdup2(_ALLOC_ID_, &node, get_tok_value(r->prop_ptr,"node",0)); + my_strdup2(_ALLOC_ID_, &color, get_tok_value(r->prop_ptr,"color",0)); + my_strdup2(_ALLOC_ID_, &sweep, get_tok_value(r->prop_ptr,"sweep",0)); nptr = node; cptr = color; sptr = sweep; @@ -2539,10 +2539,10 @@ int edit_wave_attributes(int what, int i, Graph_ctx *gr) } else { if(gr->hilight_wave == wcnt) { gr->hilight_wave = -1; - my_strdup2(1522, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); } else { gr->hilight_wave = wcnt; - my_strdup2(1525, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); } } } @@ -2564,19 +2564,19 @@ int edit_wave_attributes(int what, int i, Graph_ctx *gr) } else { if(gr->hilight_wave == wcnt) { gr->hilight_wave = -1; - my_strdup2(1538, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); } else { gr->hilight_wave = wcnt; - my_strdup2(1539, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); } } } } wcnt++; } /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", &saven)) ) */ - my_free(1494, &node); - my_free(1495, &color); - my_free(1496, &sweep); + my_free(_ALLOC_ID_, &node); + my_free(_ALLOC_ID_, &color); + my_free(_ALLOC_ID_, &sweep); return ret; } @@ -2663,8 +2663,8 @@ int find_closest_wave(int i, Graph_ctx *gr) yval = G_Y(xctx->mousey); xval = G_X(xctx->mousex); /* get data to plot */ - my_strdup2(474, &node, get_tok_value(r->prop_ptr,"node",0)); - my_strdup2(1012, &sweep, get_tok_value(r->prop_ptr,"sweep",0)); + my_strdup2(_ALLOC_ID_, &node, get_tok_value(r->prop_ptr,"node",0)); + my_strdup2(_ALLOC_ID_, &sweep, get_tok_value(r->prop_ptr,"sweep",0)); nptr = node; sptr = sweep; /* process each node given in "node" attribute, get also associated sweep var if any*/ @@ -2686,9 +2686,9 @@ int find_closest_wave(int i, Graph_ctx *gr) expression = 0; if(xctx->graph_values) { if(strstr(ntok, ";")) { - my_strdup2(1191, &express, find_nth(ntok, ";", 2)); + my_strdup2(_ALLOC_ID_, &express, find_nth(ntok, ";", 2)); } else { - my_strdup2(1192, &express, ntok); + my_strdup2(_ALLOC_ID_, &express, ntok); } if(strpbrk(express, " \n\t")) { expression = 1; @@ -2767,9 +2767,9 @@ int find_closest_wave(int i, Graph_ctx *gr) wcnt++; } /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", &saven)) ) */ dbg(0, "closest dataset=%d\n", closest_dataset); - if(express) my_free(1487, &express); - my_free(478, &node); - my_free(1262, &sweep); + if(express) my_free(_ALLOC_ID_, &express); + my_free(_ALLOC_ID_, &node); + my_free(_ALLOC_ID_, &sweep); return closest_dataset; } @@ -2820,9 +2820,9 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct) /* graph box, gridlines and axes */ draw_graph_grid(gr, ct); /* get data to plot */ - my_strdup2(1389, &node, get_tok_value(r->prop_ptr,"node",0)); - my_strdup2(1390, &color, get_tok_value(r->prop_ptr,"color",0)); - my_strdup2(1407, &sweep, get_tok_value(r->prop_ptr,"sweep",0)); + my_strdup2(_ALLOC_ID_, &node, get_tok_value(r->prop_ptr,"node",0)); + my_strdup2(_ALLOC_ID_, &color, get_tok_value(r->prop_ptr,"color",0)); + my_strdup2(_ALLOC_ID_, &sweep, get_tok_value(r->prop_ptr,"sweep",0)); nptr = node; cptr = color; sptr = sweep; @@ -2830,7 +2830,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct) /* process each node given in "node" attribute, get also associated color/sweep var if any*/ while( (ntok = my_strtok_r(nptr, "\n\t ", "\"", &saven)) ) { if(strstr(ntok, ",")) { - my_strdup2(1452, &bus_msb, find_nth(ntok, ";,", 2)); + my_strdup2(_ALLOC_ID_, &bus_msb, find_nth(ntok, ";,", 2)); } ctok = my_strtok_r(cptr, " ", "", &savec); stok = my_strtok_r(sptr, "\t\n ", "\"", &saves); @@ -2851,9 +2851,9 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct) expression = 0; if(xctx->graph_values && !bus_msb) { if(strstr(ntok, ";")) { - my_strdup2(460, &express, find_nth(ntok, ";", 2)); + my_strdup2(_ALLOC_ID_, &express, find_nth(ntok, ";", 2)); } else { - my_strdup2(473, &express, ntok); + my_strdup2(_ALLOC_ID_, &express, ntok); } if(strpbrk(express, " \n\t")) { expression = 1; @@ -2892,7 +2892,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct) else wave_color = wc; first = -1; poly_npoints = 0; - my_realloc(1401, &point, xctx->graph_npoints[dset] * sizeof(XPoint)); + my_realloc(_ALLOC_ID_, &point, xctx->graph_npoints[dset] * sizeof(XPoint)); /* Process "npoints" simulation items * p loop split repeated 2 timed (for x and y points) to preserve cache locality */ prev_prev_x = prev_x = 0; @@ -2966,16 +2966,16 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct) if(measure_p != -1) show_node_measures(measure_p, measure_x, measure_prev_x, bus_msb, wave_color, idx, idx_arr, n_bits, n_nodes, ntok, wcnt, gr); - my_free(1403, &point); - if(idx_arr) my_free(1455, &idx_arr); + my_free(_ALLOC_ID_, &point); + if(idx_arr) my_free(_ALLOC_ID_, &idx_arr); } /* if( expression || (idx = get_raw_index(bus_msb ? bus_msb : express)) != -1 ) */ wcnt++; - if(bus_msb) my_free(1453, &bus_msb); + if(bus_msb) my_free(_ALLOC_ID_, &bus_msb); } /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", &saven)) ) */ - if(express) my_free(1520, &express); - my_free(1391, &node); - my_free(1392, &color); - my_free(1408, &sweep); + if(express) my_free(_ALLOC_ID_, &express); + my_free(_ALLOC_ID_, &node); + my_free(_ALLOC_ID_, &color); + my_free(_ALLOC_ID_, &sweep); } /* if(flags & 8) */ bbox(START, 0.0, 0.0, 0.0, 0.0); bbox(ADD, gr->rx1, gr->ry1, gr->rx2, gr->ry2); @@ -3075,7 +3075,7 @@ static cairo_status_t png_writer(void *in_closure, const unsigned char *in_data, png_to_byte_closure_t *closure = (png_to_byte_closure_t *) in_closure; if(!in_data) return CAIRO_STATUS_WRITE_ERROR; if(closure->pos + length > closure->size) { - my_realloc(1472, &closure->buffer, closure->pos + length + 65536); + my_realloc(_ALLOC_ID_, &closure->buffer, closure->pos + length + 65536); closure->size = closure->pos + length + 65536; } memcpy(closure->buffer + closure->pos, in_data, length); @@ -3122,7 +3122,7 @@ void draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2 cairo_save(xctx->cairo_save_ctx); } my_strncpy(filename, get_tok_value(r->prop_ptr, "image", 0), S(filename)); - my_strdup(1484, &filter, get_tok_value(r->prop_ptr, "filter", 0)); + my_strdup(_ALLOC_ID_, &filter, get_tok_value(r->prop_ptr, "filter", 0)); /* read PNG from in-memory buffer ... */ if(emb_ptr && emb_ptr->image) { @@ -3137,7 +3137,7 @@ void draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2 closure.buffer = NULL; filterdata = (char *)base64_decode(attr, strlen(attr), &filtersize); filter_data(filterdata, filtersize, (char **)&closure.buffer, &data_size, filter); - my_free(1488, &filterdata); + my_free(_ALLOC_ID_, &filterdata); } else { closure.buffer = base64_decode(attr, strlen(attr), &data_size); } @@ -3145,7 +3145,7 @@ void draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2 closure.size = data_size; /* should not be necessary */ emb_ptr->image = cairo_image_surface_create_from_png_stream(png_reader, &closure); if(closure.buffer == NULL) dbg(0, "draw_image(): image creation failed\n"); - my_free(1467, &closure.buffer); + my_free(_ALLOC_ID_, &closure.buffer); dbg(1, "draw_image(): length2 = %d\n", closure.pos); /* ... or read PNG from file (image attribute) */ } else if(filename[0] && !stat(filename, &buf)) { @@ -3161,7 +3161,7 @@ void draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2 if(filtersize) { fd = fopen(filename, "r"); if(fd) { - filterdata = my_malloc(1490, filtersize); + filterdata = my_malloc(_ALLOC_ID_, filtersize); fread(filterdata, filtersize, 1, fd); fclose(fd); } @@ -3172,7 +3172,7 @@ void draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2 closure.pos = 0; emb_ptr->image = cairo_image_surface_create_from_png_stream(png_reader, &closure); image_data = base64_encode((unsigned char *)filterdata, filtersize, &olength, 0); - my_free(1489, &filterdata); + my_free(_ALLOC_ID_, &filterdata); } else { closure.buffer = NULL; closure.size = 0; @@ -3181,25 +3181,25 @@ void draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2 /* write PNG to in-memory buffer */ cairo_surface_write_to_png_stream(emb_ptr->image, png_writer, &closure); image_data = base64_encode(closure.buffer, closure.pos, &olength, 0); - my_free(1468, &closure.buffer); + my_free(_ALLOC_ID_, &closure.buffer); } /* put base64 encoded data to rect image_data attrinute */ - my_strdup2(1473, &r->prop_ptr, subst_token(r->prop_ptr, "image_data", image_data)); - my_free(1474, &image_data); + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "image_data", image_data)); + my_free(_ALLOC_ID_, &image_data); if(cairo_surface_status(emb_ptr->image) != CAIRO_STATUS_SUCCESS) { - my_free(442, &filter); + my_free(_ALLOC_ID_, &filter); return; } dbg(1, "draw_image(): length3 = %d\n", closure.pos); } else { - my_free(453, &filter); + my_free(_ALLOC_ID_, &filter); return; } if(cairo_surface_status(emb_ptr->image) != CAIRO_STATUS_SUCCESS) { - my_free(434, &filter); + my_free(_ALLOC_ID_, &filter); return; } - my_free(1485, &filter); + my_free(_ALLOC_ID_, &filter); ptr = get_tok_value(r->prop_ptr, "alpha", 0); alpha = 1.0; if(ptr[0]) alpha = atof(ptr); @@ -3334,7 +3334,7 @@ void svg_embedded_graph(FILE *fd, xRect *r, double rx1, double ry1, double rx2, closure.pos = 0; cairo_surface_write_to_png_stream(png_sfc, png_writer, &closure); ptr = base64_encode(closure.buffer, closure.pos, &olength, 1); - my_free(1547, &closure.buffer); + my_free(_ALLOC_ID_, &closure.buffer); cairo_surface_destroy(png_sfc); xctx->draw_pixmap=1; xctx->draw_window=save_draw_window; @@ -3357,7 +3357,7 @@ void svg_embedded_graph(FILE *fd, xRect *r, double rx1, double ry1, double rx2, "xlink:href=\"data:image/png;base64,%s\"/>\n", 0.0, 0.0, w, h, transform, ptr); } - my_free(1546, &ptr); + my_free(_ALLOC_ID_, &ptr); #endif } diff --git a/src/editprop.c b/src/editprop.c index 73f77a21..a18fc391 100644 --- a/src/editprop.c +++ b/src/editprop.c @@ -126,7 +126,7 @@ size_t my_strdup(int id, char **dest, const char *src) /* empty source string -- dbg(3,"my_strdup(%d,): duplicated string %s\n", id, src); return len-1; } else if(*dest) { - my_free(1146, dest); + my_free(_ALLOC_ID_, dest); dbg(3,"my_strdup(%d,): freed destination ptr\n", id); } @@ -139,7 +139,7 @@ void my_strndup(int id, char **dest, const char *src, size_t n) /* empty source { if(*dest!=NULL) { dbg(3," my_strndup: calling my_free\n"); - my_free(1147, dest); + my_free(_ALLOC_ID_, dest); } if(src!=NULL && src[0]!='\0') { @@ -303,7 +303,7 @@ size_t my_strdup2(int id, char **dest, const char *src) /* 20150409 duplicates a dbg(3,"my_strdup2(%d,): duplicated string %s\n", id, src); return len-1; } else if(*dest) { - my_free(1148, dest); + my_free(_ALLOC_ID_, dest); dbg(3,"my_strdup2(%d,): freed destination ptr\n", id); } return 0; @@ -584,12 +584,12 @@ void set_inst_prop(int i) ptr = (xctx->inst[i].ptr+ xctx->sym)->templ; dbg(1, "set_inst_prop(): i=%d, name=%s, prop_ptr = %s, template=%s\n", i, xctx->inst[i].name, xctx->inst[i].prop_ptr, ptr); - my_strdup(69, &xctx->inst[i].prop_ptr, ptr); - my_strdup2(70, &xctx->inst[i].instname, get_tok_value(ptr, "name",0)); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, ptr); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].instname, get_tok_value(ptr, "name",0)); if(xctx->inst[i].instname[0]) { - my_strdup(101, &tmp, xctx->inst[i].prop_ptr); + my_strdup(_ALLOC_ID_, &tmp, xctx->inst[i].prop_ptr); new_prop_string(i, tmp, 0, tclgetboolvar("disable_unique_names")); - my_free(724, &tmp); + my_free(_ALLOC_ID_, &tmp); } } @@ -600,7 +600,7 @@ static void edit_rect_property(int x) const char *dash, *fill; int preserve; char *oldprop=NULL; - my_strdup(67, &oldprop, xctx->rect[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); + my_strdup(_ALLOC_ID_, &oldprop, xctx->rect[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); if(oldprop && oldprop[0]) { tclsetvar("retval",oldprop); } else { @@ -629,7 +629,7 @@ static void edit_rect_property(int x) set_different_token(&xctx->rect[c][n].prop_ptr, (char *) tclgetvar("retval"), oldprop, 0, 0); } else { - my_strdup(99, &xctx->rect[c][n].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->rect[c][n].prop_ptr, (char *) tclgetvar("retval")); } set_rect_flags(&xctx->rect[c][n]); /* set cached .flags bitmask from on attributes */ @@ -665,7 +665,7 @@ static void edit_rect_property(int x) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); } } - my_free(725, &oldprop); + my_free(_ALLOC_ID_, &oldprop); } static void edit_line_property(void) @@ -674,7 +674,7 @@ static void edit_line_property(void) const char *dash; int preserve; char *oldprop=NULL; - my_strdup(46, &oldprop, xctx->line[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); + my_strdup(_ALLOC_ID_, &oldprop, xctx->line[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); if(oldprop && oldprop[0]) { tclsetvar("retval", oldprop); } else { @@ -698,7 +698,7 @@ static void edit_line_property(void) set_different_token(&xctx->line[c][n].prop_ptr, (char *) tclgetvar("retval"), oldprop, 0, 0); } else { - my_strdup(102, &xctx->line[c][n].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->line[c][n].prop_ptr, (char *) tclgetvar("retval")); } xctx->line[c][n].bus = !strcmp(get_tok_value(xctx->line[c][n].prop_ptr,"bus",0), "true"); @@ -719,7 +719,7 @@ static void edit_line_property(void) draw(); bbox(END , 0.0 , 0.0 , 0.0 , 0.0); } - my_free(726, &oldprop); + my_free(_ALLOC_ID_, &oldprop); } @@ -730,7 +730,7 @@ static void edit_wire_property(void) char *oldprop=NULL; const char *bus_ptr; - my_strdup(47, &oldprop, xctx->wire[xctx->sel_array[0].n].prop_ptr); + my_strdup(_ALLOC_ID_, &oldprop, xctx->wire[xctx->sel_array[0].n].prop_ptr); if(oldprop && oldprop[0]) { tclsetvar("retval", oldprop); } else { @@ -758,7 +758,7 @@ static void edit_wire_property(void) set_different_token(&xctx->wire[k].prop_ptr, (char *) tclgetvar("retval"), oldprop, 0, 0); } else { - my_strdup(100, &xctx->wire[k].prop_ptr,(char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->wire[k].prop_ptr,(char *) tclgetvar("retval")); } bus_ptr = get_tok_value(xctx->wire[k].prop_ptr,"bus",0); if(!strcmp(bus_ptr, "true")) { @@ -783,7 +783,7 @@ static void edit_wire_property(void) draw(); bbox(END , 0.0 , 0.0 , 0.0 , 0.0); } - my_free(727, &oldprop); + my_free(_ALLOC_ID_, &oldprop); } static void edit_arc_property(void) @@ -795,7 +795,7 @@ static void edit_arc_property(void) const char *dash; int preserve; - my_strdup(98, &oldprop, xctx->arc[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); + my_strdup(_ALLOC_ID_, &oldprop, xctx->arc[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); if(oldprop && oldprop[0]) { tclsetvar("retval", oldprop); } else { @@ -819,7 +819,7 @@ static void edit_arc_property(void) set_different_token(&xctx->arc[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop, 0, 0); } else { - my_strdup(156, &xctx->arc[c][i].prop_ptr, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->arc[c][i].prop_ptr, (char *) tclgetvar("retval")); } old_fill = xctx->arc[c][i].fill; if( !strcmp(get_tok_value(xctx->arc[c][i].prop_ptr,"fill",0),"true") ) @@ -864,7 +864,7 @@ static void edit_polygon_property(void) int preserve; dbg(1, "edit_property(): input property:\n"); - my_strdup(112, &oldprop, xctx->poly[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); + my_strdup(_ALLOC_ID_, &oldprop, xctx->poly[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); if(oldprop && oldprop[0]) { tclsetvar("retval", oldprop); } else { @@ -887,7 +887,7 @@ static void edit_polygon_property(void) if(oldprop && preserve == 1) { set_different_token(&xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop, 0, 0); } else { - my_strdup(113, &xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval")); } old_fill = xctx->poly[c][i].fill; old_dash = xctx->poly[c][i].dash; @@ -942,7 +942,7 @@ static void edit_text_property(int x) dbg(1, "edit_text_property(): entering\n"); sel = xctx->sel_array[0].n; - my_strdup(656, &oldprop, xctx->text[sel].prop_ptr); + my_strdup(_ALLOC_ID_, &oldprop, xctx->text[sel].prop_ptr); if(oldprop && oldprop[0]) tclsetvar("props", oldprop); else @@ -1035,24 +1035,24 @@ static void edit_text_property(int x) (fabs(yy1 - pcy) < cg*3 || fabs(yy2 - pcy) < cg*3) ) ) { if(x==0) - my_strdup(71, &xctx->rect[PINLAYER][l].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->rect[PINLAYER][l].prop_ptr, subst_token(xctx->rect[PINLAYER][l].prop_ptr, "name", (char *) tclgetvar("retval")) ); else - my_strdup(72, &xctx->rect[PINLAYER][l].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->rect[PINLAYER][l].prop_ptr, subst_token(xctx->rect[PINLAYER][l].prop_ptr, "name", (char *) tclgetvar("retval")) ); } } } - my_strdup(74, &xctx->text[sel].txt_ptr, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->text[sel].txt_ptr, (char *) tclgetvar("retval")); } if(x==0 && props_changed) { if(oldprop && preserve) set_different_token(&xctx->text[sel].prop_ptr, (char *) tclgetvar("props"), oldprop, 0, 0); else - my_strdup(75, &xctx->text[sel].prop_ptr,(char *) tclgetvar("props")); - my_strdup(76, &xctx->text[sel].font, get_tok_value(xctx->text[sel].prop_ptr, "font", 0)); + my_strdup(_ALLOC_ID_, &xctx->text[sel].prop_ptr,(char *) tclgetvar("props")); + my_strdup(_ALLOC_ID_, &xctx->text[sel].font, get_tok_value(xctx->text[sel].prop_ptr, "font", 0)); str = get_tok_value(xctx->text[sel].prop_ptr, "hcenter", 0); xctx->text[sel].hcenter = strcmp(str, "true") ? 0 : 1; str = get_tok_value(xctx->text[sel].prop_ptr, "vcenter", 0); @@ -1093,7 +1093,7 @@ static void edit_text_property(int x) draw(); bbox(END,0.0,0.0,0.0,0.0); } - my_free(890, &oldprop); + my_free(_ALLOC_ID_, &oldprop); } /* x=0 use text widget x=1 use vim editor */ @@ -1116,19 +1116,19 @@ static void update_symbol(const char *result, int x) *ii=xctx->sel_array[0].n; if(!result) { dbg(1, "update_symbol(): edit symbol prop aborted\n"); - my_free(1289, &xctx->old_prop); + my_free(_ALLOC_ID_, &xctx->old_prop); return; } /* create new_prop updated attribute string */ if(*netl_com && x==1) { - my_strdup(79, &new_prop, + my_strdup(_ALLOC_ID_, &new_prop, subst_token(xctx->old_prop, "value", (char *) tclgetvar("retval") ) ); dbg(1, "update_symbol(): new_prop=%s\n", new_prop); dbg(1, "update_symbol(): tcl retval==%s\n", tclgetvar("retval")); } else { - my_strdup(80, &new_prop, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &new_prop, (char *) tclgetvar("retval")); dbg(1, "update_symbol(): new_prop=%s\n", new_prop); } my_strncpy(symbol, (char *) tclgetvar("symbol") , S(symbol)); @@ -1169,7 +1169,7 @@ static void update_symbol(const char *result, int x) delete_inst_node(*ii); /* 20180208 fix crashing bug: delete node info if changing symbol */ /* if number of pins is different we must delete these data *before* */ /* changing ysmbol, otherwise *ii might end up deleting non allocated data. */ - my_strdup2(82, &xctx->inst[*ii].name, rel_sym_path(symbol)); + my_strdup2(_ALLOC_ID_, &xctx->inst[*ii].name, rel_sym_path(symbol)); xctx->inst[*ii].ptr=sym_number; /* update instance to point to new symbol */ } bbox(ADD, xctx->inst[*ii].x1, xctx->inst[*ii].y1, @@ -1181,13 +1181,13 @@ static void update_symbol(const char *result, int x) dbg(1, "update_symbol(): no_change_props=%d\n", no_change_props); if(only_different) { char * ss=NULL; - my_strdup(119, &ss, xctx->inst[*ii].prop_ptr); + my_strdup(_ALLOC_ID_, &ss, xctx->inst[*ii].prop_ptr); if( set_different_token(&ss, new_prop, xctx->old_prop, 0, 0) ) { if(!pushed) { xctx->push_undo(); pushed=1;} - my_strdup(111, &xctx->inst[*ii].prop_ptr, ss); + my_strdup(_ALLOC_ID_, &xctx->inst[*ii].prop_ptr, ss); set_modify(1); } - my_free(729, &ss); + my_free(_ALLOC_ID_, &ss); } else { if(new_prop) { @@ -1195,39 +1195,39 @@ static void update_symbol(const char *result, int x) dbg(1, "update_symbol(): changing prop: |%s| -> |%s|\n", xctx->inst[*ii].prop_ptr, new_prop); if(!pushed) { xctx->push_undo(); pushed=1;} - my_strdup(84, &xctx->inst[*ii].prop_ptr, new_prop); + my_strdup(_ALLOC_ID_, &xctx->inst[*ii].prop_ptr, new_prop); set_modify(1); } } else { if(!pushed) { xctx->push_undo(); pushed=1;} - my_strdup(86, &xctx->inst[*ii].prop_ptr, ""); + my_strdup(_ALLOC_ID_, &xctx->inst[*ii].prop_ptr, ""); set_modify(1); } } } /* if symbol changed ensure instance name (with new prefix char) is unique */ /* preserve backslashes in name ----------------------------------->. */ - my_strdup(152, &name, get_tok_value(xctx->inst[*ii].prop_ptr, "name", 1)); + my_strdup(_ALLOC_ID_, &name, get_tok_value(xctx->inst[*ii].prop_ptr, "name", 1)); if(name && name[0] ) { dbg(1, "update_symbol(): prefix!='\\0', name=%s\n", name); /* 20110325 only modify prefix if prefix not NUL */ if(prefix) name[0]=(char)prefix; /* change prefix if changing symbol type; */ dbg(1, "update_symbol(): name=%s, inst[*ii].prop_ptr=%s\n", name, xctx->inst[*ii].prop_ptr); - my_strdup(89, &ptr,subst_token(xctx->inst[*ii].prop_ptr, "name", name) ); + my_strdup(_ALLOC_ID_, &ptr,subst_token(xctx->inst[*ii].prop_ptr, "name", name) ); /* set name of current inst */ if(!pushed) { xctx->push_undo(); pushed=1;} if(!k) hash_all_names(); new_prop_string(*ii, ptr, k, tclgetboolvar("disable_unique_names")); /* set new prop_ptr */ } else { - my_strdup2(367, &xctx->inst[*ii].instname, ""); + my_strdup2(_ALLOC_ID_, &xctx->inst[*ii].instname, ""); } type=xctx->sym[xctx->inst[*ii].ptr].type; cond= !type || !IS_LABEL_SH_OR_PIN(type); if(cond) xctx->inst[*ii].flags |= 2; /* bit 1: flag for different textlayer for pin/labels */ else { xctx->inst[*ii].flags &= ~2; - my_strdup(880, &xctx->inst[*ii].lab, + my_strdup(_ALLOC_ID_, &xctx->inst[*ii].lab, get_tok_value(xctx->inst[*ii].prop_ptr, "lab",0)); } if(!strcmp(get_tok_value(xctx->inst[*ii].prop_ptr,"highlight",0), "true")) @@ -1251,10 +1251,10 @@ static void update_symbol(const char *result, int x) dbg(1, "update_symbol(): redrawing inst_ptr.txtprop string\n"); draw(); bbox(END,0.0,0.0,0.0,0.0); - my_free(731, &name); - my_free(732, &ptr); - my_free(733, &new_prop); - my_free(734, &xctx->old_prop); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &ptr); + my_free(_ALLOC_ID_, &new_prop); + my_free(_ALLOC_ID_, &xctx->old_prop); } /* x=0 use text widget x=1 use vim editor */ @@ -1279,12 +1279,12 @@ static void edit_symbol_property(int x) else { tclsetvar("retval",""); } - my_strdup(91, &xctx->old_prop, xctx->inst[*ii].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->old_prop, xctx->inst[*ii].prop_ptr); tclsetvar("symbol",xctx->inst[*ii].name); if(x==0) { tcleval("edit_prop {Input property:}"); - my_strdup(77, &result, tclresult()); + my_strdup(_ALLOC_ID_, &result, tclresult()); } else { /* edit_vi_netlist_prop will replace \" with " before editing, @@ -1293,11 +1293,11 @@ static void edit_symbol_property(int x) if(*netl_com && x==1) tcleval("edit_vi_netlist_prop {Input property:}"); else if(x==1) tcleval("edit_vi_prop {Input property:}"); else if(x==2) tcleval("viewdata $::retval"); - my_strdup(78, &result, tclresult()); + my_strdup(_ALLOC_ID_, &result, tclresult()); } dbg(1, "edit_symbol_property(): before update_symbol, modified=%d\n", xctx->modified); update_symbol(result, x); - my_free(728, &result); + my_free(_ALLOC_ID_, &result); dbg(1, "edit_symbol_property(): done update_symbol, modified=%d\n", xctx->modified); *ii=-1; } @@ -1370,7 +1370,7 @@ char *str_replace(const char *s, const char *rep, const char *with) size_t with_len; if(s==NULL || rep == NULL || with == NULL || rep[0] == '\0') { - my_free(1244, &result); + my_free(_ALLOC_ID_, &result); size = 0; return NULL; } @@ -1379,7 +1379,7 @@ char *str_replace(const char *s, const char *rep, const char *with) dbg(1, "str_replace(): %s, %s, %s\n", s, rep, with); if( size == 0 ) { size = CADCHUNKALLOC; - my_realloc(1245, &result, size); + my_realloc(_ALLOC_ID_, &result, size); } while(*s) { STR_ALLOC(&result, result_pos + with_len + 1, &size); @@ -1451,9 +1451,9 @@ void edit_property(int x) dbg(1, "edit_property(): done executing edit_vi_prop, result=%s\n",tclresult()); dbg(1, "edit_property(): rcode=%s\n",tclgetvar("rcode") ); - my_strdup(650, &new_prop, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &new_prop, (char *) tclgetvar("retval")); tclsetvar("retval", new_prop); - my_free(893, &new_prop); + my_free(_ALLOC_ID_, &new_prop); if(strcmp(tclgetvar("rcode"),"") ) @@ -1461,27 +1461,27 @@ void edit_property(int x) if(xctx->netlist_type==CAD_SYMBOL_ATTRS && (!xctx->schsymbolprop || strcmp(xctx->schsymbolprop, tclgetvar("retval") ) ) ) { set_modify(1); xctx->push_undo(); - my_strdup(422, &xctx->schsymbolprop, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->schsymbolprop, (char *) tclgetvar("retval")); } else if(xctx->netlist_type==CAD_VERILOG_NETLIST && (!xctx->schverilogprop || strcmp(xctx->schverilogprop, tclgetvar("retval") ) ) ) { set_modify(1); xctx->push_undo(); - my_strdup(94, &xctx->schverilogprop, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->schverilogprop, (char *) tclgetvar("retval")); } else if(xctx->netlist_type==CAD_SPICE_NETLIST && (!xctx->schprop || strcmp(xctx->schprop, tclgetvar("retval") ) ) ) { set_modify(1); xctx->push_undo(); - my_strdup(95, &xctx->schprop, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->schprop, (char *) tclgetvar("retval")); } else if(xctx->netlist_type==CAD_TEDAX_NETLIST && (!xctx->schtedaxprop || strcmp(xctx->schtedaxprop, tclgetvar("retval") ) ) ) { set_modify(1); xctx->push_undo(); - my_strdup(96, &xctx->schtedaxprop, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->schtedaxprop, (char *) tclgetvar("retval")); } else if(xctx->netlist_type==CAD_VHDL_NETLIST && (!xctx->schvhdlprop || strcmp(xctx->schvhdlprop, tclgetvar("retval") ) ) ) { set_modify(1); xctx->push_undo(); - my_strdup(97, &xctx->schvhdlprop, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->schvhdlprop, (char *) tclgetvar("retval")); } } diff --git a/src/expandlabel.y b/src/expandlabel.y index 6dad6c1d..9517a8d7 100644 --- a/src/expandlabel.y +++ b/src/expandlabel.y @@ -69,13 +69,13 @@ static char *expandlabel_strdup(char *src) char *ptr; if(src==NULL || src[0]=='\0') { ptr=NULL; - my_strdup(121, &ptr,""); + my_strdup(_ALLOC_ID_, &ptr,""); return ptr; } else { ptr=NULL; - my_strdup(122, &ptr,src); + my_strdup(_ALLOC_ID_, &ptr,src); dbg(3, "expandlabel_strdup(): duplicated %lu string %s\n",(unsigned long)ptr,src); return ptr; } @@ -89,7 +89,7 @@ static char *expandlabel_strcat(char *s1, char *s2) if(s1) l1=strlen(s1); if(s2) l2=strlen(s2); - res=my_malloc(730, l1+l2+1); /* 2 strings plus '\0' */ + res=my_malloc(_ALLOC_ID_, l1+l2+1); /* 2 strings plus '\0' */ if(s1) memcpy(res, s1, l1); if(s2) memcpy(res + l1 , s2, l2+1); else memcpy(res + l1 , "", 1); @@ -104,7 +104,7 @@ static char *expandlabel_strcat_char(char *s1, char c, char *s2) if(s1) l1=strlen(s1); if(s2) l2=strlen(s2); - res=my_malloc(123, l1+l2+2); /* 2 strings plus 'c' and '\0' */ + res=my_malloc(_ALLOC_ID_, l1+l2+2); /* 2 strings plus 'c' and '\0' */ if(s1) memcpy(res, s1, l1); res[l1] = c; if(s2) memcpy(res + l1 + 1, s2, l2+1); @@ -127,7 +127,7 @@ static char *expandlabel_strmult2(int n, char *s) if(n==0) return expandlabel_strdup(""); len=strlen(s); prev=s; - ss = str=my_malloc(124, (len+1)*n); + ss = str=my_malloc(_ALLOC_ID_, (len+1)*n); str[0]='\0'; for(pos=s;pos<=s+len;pos++) { if(*pos==',' || *pos=='\0') { @@ -161,7 +161,7 @@ static char *expandlabel_strmult(int n, char *s) if(n==0) return expandlabel_strdup(""); len=strlen(s); - str=pos=my_malloc(125, (len+1)*n); + str=pos=my_malloc(_ALLOC_ID_, (len+1)*n); for(i=1;i<=n;i++) { /* strcpy(pos,s); */ @@ -179,8 +179,8 @@ static char *expandlabel_strbus(char *s, int *n) int tmplen; char *res=NULL; char *tmp=NULL; - my_realloc(126, &res, n[0]*(strlen(s)+20)); - my_realloc(127, &tmp, strlen(s)+30); + my_realloc(_ALLOC_ID_, &res, n[0]*(strlen(s)+20)); + my_realloc(_ALLOC_ID_, &tmp, strlen(s)+30); l=0; for(i=1;iinst[i].y0; rot = xctx->inst[i].rot; flip = xctx->inst[i].flip; - my_strdup(133, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if(!type) continue; no_of_pin_rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER]; @@ -169,7 +169,7 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y) } *x = min_dist_x; *y = min_dist_y; - my_free(752, &type); + my_free(_ALLOC_ID_, &type); } static void find_closest_arc(double mx,double my) diff --git a/src/font.c b/src/font.c index 3c5ea5e2..1c32f3f9 100644 --- a/src/font.c +++ b/src/font.c @@ -38,7 +38,7 @@ void compile_font(void) select_inside(code*FONTOFFSET-1,-FONTHEIGHT-1, code*FONTOFFSET+FONTWIDTH+1,FONTWHITESPACE + FONTDESCENT+1, 1); rebuild_selected_array(); - character[code] = my_calloc(134, xctx->lastsel*4+1, sizeof(double)); + character[code] = my_calloc(_ALLOC_ID_, xctx->lastsel*4+1, sizeof(double)); character[code][0] = (double)xctx->lastsel; dbg(2, "compile_font(): character[%d][]={%.16g",code,character[code][0]); for(i=0;ilastsel;i++) diff --git a/src/hash_iterator.c b/src/hash_iterator.c index 62fddd72..874e013d 100644 --- a/src/hash_iterator.c +++ b/src/hash_iterator.c @@ -28,7 +28,7 @@ void init_inst_iterator(Iterator_ctx *ctx, double x1, double y1, double x2, doub dbg(3, "init_inst_iterator(): instances=%d\n", xctx->instances); if(xctx->instances) { - my_realloc(135, &ctx->instflag, xctx->instances*sizeof(unsigned short)); + my_realloc(_ALLOC_ID_, &ctx->instflag, xctx->instances*sizeof(unsigned short)); memset(ctx->instflag, 0, xctx->instances*sizeof(unsigned short)); } /* calculate square 4 1st corner of drawing area */ @@ -72,7 +72,7 @@ Instentry *inst_iterator_next(Iterator_ctx *ctx) ctx->tmpj = ctx->j % NBOXES; if(ctx->tmpj < 0) ctx->tmpj += NBOXES; ctx->instanceptr = xctx->inst_spatial_table[ctx->tmpi][ctx->tmpj]; } else { - my_free(753, &ctx->instflag); + my_free(_ALLOC_ID_, &ctx->instflag); return NULL; } } @@ -83,7 +83,7 @@ void init_wire_iterator(Iterator_ctx *ctx, double x1, double y1, double x2, doub ctx->wireflag = NULL; dbg(3, "init_wire_iterator(): wires=%d\n", xctx->wires); if(xctx->wires) { - my_realloc(136, &ctx->wireflag, xctx->wires*sizeof(unsigned short)); + my_realloc(_ALLOC_ID_, &ctx->wireflag, xctx->wires*sizeof(unsigned short)); memset(ctx->wireflag, 0, xctx->wires*sizeof(unsigned short)); } /* calculate square 4 1st corner of drawing area */ @@ -127,7 +127,7 @@ Wireentry *wire_iterator_next(Iterator_ctx *ctx) ctx->tmpj = ctx->j % NBOXES; if(ctx->tmpj < 0) ctx->tmpj += NBOXES; ctx->wireptr = xctx->wire_spatial_table[ctx->tmpi][ctx->tmpj]; } else { - my_free(754, &ctx->wireflag); + my_free(_ALLOC_ID_, &ctx->wireflag); return NULL; } } diff --git a/src/hilight.c b/src/hilight.c index 1954c94d..7113c478 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -48,9 +48,9 @@ static void hilight_hash_free_entry(Hilight_hashentry *entry) Hilight_hashentry *tmp; while(entry) { tmp = entry->next; - my_free(1287, &entry->token); - my_free(1288, &entry->path); - my_free(757, &entry); + my_free(_ALLOC_ID_, &entry->token); + my_free(_ALLOC_ID_, &entry->path); + my_free(_ALLOC_ID_, &entry); entry = tmp; } } @@ -92,11 +92,11 @@ static Hilight_hashentry *hilight_hash_lookup(const char *token, int value, int size_t lenp = strlen(xctx->sch_path[xctx->currsch]) + 1; if( what==XINSERT || what == XINSERT_NOREPLACE) { /* insert data */ s=sizeof( Hilight_hashentry ); - entry= (Hilight_hashentry *)my_malloc(137, s ); + entry= (Hilight_hashentry *)my_malloc(_ALLOC_ID_, s ); entry->next = NULL; - entry->token = my_malloc(778, lent); + entry->token = my_malloc(_ALLOC_ID_, lent); memcpy(entry->token, token, lent); - entry->path = my_malloc(779, lenp); + entry->path = my_malloc(_ALLOC_ID_, lenp); memcpy(entry->path, xctx->sch_path[xctx->currsch], lenp); entry->oldvalue = value-1000; /* no old value, set different value anyway*/ entry->value = value; @@ -111,9 +111,9 @@ static Hilight_hashentry *hilight_hash_lookup(const char *token, int value, int !strcmp(xctx->sch_path[xctx->currsch], entry->path) ) { /* found matching tok */ if(what==XDELETE) { /* remove token from the hash table ... */ saveptr=entry->next; - my_free(1145, &entry->token); - my_free(1198, &entry->path); - my_free(764, &entry); + my_free(_ALLOC_ID_, &entry->token); + my_free(_ALLOC_ID_, &entry->path); + my_free(_ALLOC_ID_, &entry); *preventry=saveptr; } else if(what == XINSERT ) { entry->oldvalue = entry->value; @@ -134,11 +134,11 @@ Hilight_hashentry *inst_hilight_hash_lookup(const char *token, int value, int wh size_t len = strlen(token) + 2; /* token plus one more character and \0 */ Hilight_hashentry *entry; dbg(1, "inst_hilight_hash_lookup: token=%s value=%d what=%d\n", token, value, what); - inst_tok = my_malloc(1568, len); + inst_tok = my_malloc(_ALLOC_ID_, len); /* instance name uglyfication: add a space at beginning so it will never match a valid net name */ my_snprintf(inst_tok, len, " %s", token); entry = hilight_hash_lookup(inst_tok, value, what); - my_free(1569, &inst_tok); + my_free(_ALLOC_ID_, &inst_tok); return entry; } @@ -156,7 +156,7 @@ Hilight_hashentry *bus_hilight_hash_lookup(const char *token, int value, int wha ptr1=hilight_hash_lookup(token, value, what); return ptr1; } - my_strdup(141, &string, expandlabel(token,&mult)); + my_strdup(_ALLOC_ID_, &string, expandlabel(token,&mult)); if(string==NULL) { return NULL; } @@ -179,7 +179,7 @@ Hilight_hashentry *bus_hilight_hash_lookup(const char *token, int value, int wha string_ptr++; } /* if something found return first pointer */ - my_free(765, &string); + my_free(_ALLOC_ID_, &string); return ptr2; } @@ -271,12 +271,12 @@ void create_plot_cmd(void) if(exists) { viewer = atoi(tclgetvar("sim(spicewave,default)")); my_snprintf(tcl_str, S(tcl_str), "sim(spicewave,%d,name)", viewer); - my_strdup(1269, &viewer_name, tclgetvar(tcl_str)); + my_strdup(_ALLOC_ID_, &viewer_name, tclgetvar(tcl_str)); dbg(1,"create_plot_cmd(): viewer_name=%s\n", viewer_name); if(strstr(viewer_name, "Gaw")) viewer=GAW; else if(strstr(viewer_name, "Bespice")) viewer=BESPICE; else if(strstr(viewer_name, "Ngspice")) viewer=NGSPICE; - my_free(1270, &viewer_name); + my_free(_ALLOC_ID_, &viewer_name); } if(!exists || !viewer) return; my_snprintf(plotfile, S(plotfile), "%s/xplot", tclgetvar("netlist_dir")); @@ -310,7 +310,7 @@ void create_plot_cmd(void) fprintf(fd, "%s", str); fprintf(fd, "\n"); first = 1; - my_free(758, &str); + my_free(_ALLOC_ID_, &str); } fprintf(fd, "set color%d=rgb:%s\n", idx, color_str); if(first) { @@ -326,8 +326,8 @@ void create_plot_cmd(void) char *t=NULL, *p=NULL; sprintf(color_str, "%02x%02x%02x", xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8, xctx->xcolor_array[c].blue>>8); - my_strdup(1273, &t, tok); - my_strdup2(1274, &p, (entry->path)+1); + my_strdup(_ALLOC_ID_, &t, tok); + my_strdup2(_ALLOC_ID_, &p, (entry->path)+1); if(simtype == 0 ) { /* spice */ tclvareval("puts $gaw_fd {copyvar v(", strtolower(p), strtolower(t), ") sel #", color_str, "}\nvwait gaw_fd\n", NULL); @@ -340,15 +340,15 @@ void create_plot_cmd(void) tclvareval("puts $gaw_fd {copyvar ", strtoupper(p), strtoupper(t), " sel #", color_str, "}\nvwait gaw_fd\n", NULL); } - my_free(1275, &p); - my_free(1276, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } if(viewer == BESPICE) { char *t=NULL, *p=NULL; sprintf(color_str, "%d %d %d", xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8, xctx->xcolor_array[c].blue>>8); - my_strdup(241, &t, tok); - my_strdup2(245, &p, (entry->path)+1); + my_strdup(_ALLOC_ID_, &t, tok); + my_strdup2(_ALLOC_ID_, &p, (entry->path)+1); if(simtype == 0 ) { /* spice */ tclvareval( @@ -384,8 +384,8 @@ void create_plot_cmd(void) "\" \"\"}", NULL); } - my_free(759, &p); - my_free(760, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } } entry = entry->next; @@ -394,7 +394,7 @@ void create_plot_cmd(void) if(viewer == NGSPICE) { fprintf(fd, "%s", str); fprintf(fd, "\nremcirc\n.endc\n"); - my_free(761, &str); + my_free(_ALLOC_ID_, &str); fclose(fd); } if(viewer == GAW) { @@ -434,16 +434,16 @@ void hilight_net_pin_mismatches(void) for(k=0; klastsel; k++) { if(xctx->sel_array[k].type!=ELEMENT) continue; j = xctx->sel_array[k].n ; - my_strdup(23, &type,(xctx->inst[j].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[j].ptr+ xctx->sym)->type); if( type && IS_LABEL_SH_OR_PIN(type)) break; symbol = xctx->sym + xctx->inst[j].ptr; npin = symbol->rects[PINLAYER]; rct=symbol->rect[PINLAYER]; dbg(1, "hilight_net_pin_mismatches(): \n"); for(i=0;ihilight_nets) propagate_hilights(1, 0, XINSERT_NOREPLACE); redraw_hilights(0); } @@ -481,11 +481,11 @@ void hilight_parent_pins(void) for(j=0;jinst[i].node[j]) continue; - my_strdup(445, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult)); + my_strdup(_ALLOC_ID_, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult)); dbg(1, "hilight_parent_pins(): net_node=%s\n", net_node); pin_name = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0); if(!pin_name[0]) continue; - my_strdup(450, &pin_node, expandlabel(pin_name, &mult)); + my_strdup(_ALLOC_ID_, &pin_node, expandlabel(pin_name, &mult)); dbg(1, "hilight_parent_pins(): pin_node=%s\n", pin_node); for(k = 1; k<=mult; k++) { @@ -504,8 +504,8 @@ void hilight_parent_pins(void) } } } - my_free(767, &pin_node); - my_free(768, &net_node); + my_free(_ALLOC_ID_, &pin_node); + my_free(_ALLOC_ID_, &net_node); } void hilight_child_pins(void) @@ -527,11 +527,11 @@ void hilight_child_pins(void) dbg(1, "hilight_child_pins(): inst_number=%d\n", inst_number); if(!xctx->inst[i].node[j]) continue; - my_strdup(508, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult)); + my_strdup(_ALLOC_ID_, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult)); dbg(1, "hilight_child_pins(): net_node=%s\n", net_node); pin_name = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0); if(!pin_name[0]) continue; - my_strdup(521, &pin_node, expandlabel(pin_name, &mult)); + my_strdup(_ALLOC_ID_, &pin_node, expandlabel(pin_name, &mult)); dbg(1, "hilight_child_pins(): pin_node=%s\n", pin_node); for(k = 1; k<=mult; k++) { dbg(1, "hilight_child_pins(): looking nth net:%d, k=%d, inst_number=%d, mult=%d\n", @@ -552,8 +552,8 @@ void hilight_child_pins(void) } } /* for(k..) */ } - my_free(769, &pin_node); - my_free(770, &net_node); + my_free(_ALLOC_ID_, &pin_node); + my_free(_ALLOC_ID_, &net_node); } @@ -615,7 +615,7 @@ int search(const char *tok, const char *val, int sub, int sel) } else if(!strcmp(tok,"cell::propstring")) { has_token = (str = (xctx->inst[i].ptr+ xctx->sym)->prop_ptr) ? 1 : 0; } else if(!strncmp(tok,"cell::", 6)) { /* cell::xxx looks for xxx in global symbol attributes */ - my_strdup(142, &tmpname,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,tok+6,0)); + my_strdup(_ALLOC_ID_, &tmpname,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,tok+6,0)); has_token = xctx->tok_size; if(tmpname) { str = tmpname; @@ -768,7 +768,7 @@ int search(const char *tok, const char *val, int sub, int sel) regfree(&re); #endif xctx->draw_window = save_draw; - my_free(771, &tmpname); + my_free(_ALLOC_ID_, &tmpname); return found; } @@ -796,7 +796,7 @@ static void drill_hilight(int mode) hilight_connected_inst = en_hi && ((xctx->inst[i].flags & HILIGHT_CONN) || (symbol->flags & HILIGHT_CONN)); for(j=0; jinst[i].instname, j, netname, mult); for(k = 1; k <= mult; k++) { @@ -807,7 +807,7 @@ static void drill_hilight(int mode) xctx->inst[i].color = entry->value; inst_hilight_hash_lookup(xctx->inst[i].instname, entry->value, XINSERT_NOREPLACE); } - my_strdup(1225, &propagate_str, get_tok_value(rct[j].prop_ptr, "propag", 0)); + my_strdup(_ALLOC_ID_, &propagate_str, get_tok_value(rct[j].prop_ptr, "propag", 0)); if(propagate_str) { int n = 1; const char *propag; @@ -822,7 +822,7 @@ static void drill_hilight(int mode) } /* expandlabel(rct[propagate].name, &pinmult); */ /* get net to propagate hilight to...*/ - my_strdup2(144, &propagated_net, net_name(i, propagate, &mult2, 1, 0)); + my_strdup2(_ALLOC_ID_, &propagated_net, net_name(i, propagate, &mult2, 1, 0)); netbitname = find_nth(propagated_net, ",", k); dbg(1, "netbitname=%s\n", netbitname); /* add net to highlight list */ @@ -837,9 +837,9 @@ static void drill_hilight(int mode) } /* for(i...) */ if(!found) break; } /* while(1) */ - my_free(772, &netname); - if(propagated_net) my_free(773, &propagated_net); - if(propagate_str) my_free(1226, &propagate_str); + my_free(_ALLOC_ID_, &netname); + if(propagated_net) my_free(_ALLOC_ID_, &propagated_net); + if(propagate_str) my_free(_ALLOC_ID_, &propagate_str); } int hilight_netname(const char *name) @@ -879,9 +879,9 @@ static void send_net_to_bespice(int simtype, const char *node) sprintf(color_str, "%d %d %d", xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8, xctx->xcolor_array[c].blue>>8); expanded_tok = expandlabel(tok, &tok_mult); - my_strdup2(1278, &p, xctx->sch_path[xctx->currsch]+1); + my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); for(k=1; k<=tok_mult; k++) { - my_strdup(1277, &t, find_nth(expanded_tok, ",", k)); + my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", k)); if(simtype == 0 ) { /* spice */ tclvareval( "puts $bespice_server_getdata(sock) ", @@ -917,8 +917,8 @@ static void send_net_to_bespice(int simtype, const char *node) NULL); } } - my_free(1279, &p); - my_free(1280, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } } @@ -939,7 +939,7 @@ static void send_net_to_graph(char **s, int simtype, const char *node) int start_level; c = get_color(xctx->hilight_color); expanded_tok = expandlabel(tok, &tok_mult); - my_strdup2(1499, &p, xctx->sch_path[xctx->currsch]+1); + my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); path = p; start_level = sch_waves_loaded(); if(path) { @@ -952,7 +952,7 @@ static void send_net_to_graph(char **s, int simtype, const char *node) } strtolower(path); for(k=1; k<=tok_mult; k++) { - my_strdup(1503, &t, find_nth(expanded_tok, ",", k)); + my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", k)); strtolower(t); if(simtype == 0 ) { /* ngspice */ dbg(1, "%s%s color=%d\n", path, t, c); @@ -964,8 +964,8 @@ static void send_net_to_graph(char **s, int simtype, const char *node) } } - my_free(1500, &p); - my_free(1501, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } } @@ -990,11 +990,11 @@ static void send_net_to_gaw(int simtype, const char *node) expanded_tok = expandlabel(tok, &tok_mult); tcleval("setup_tcp_gaw"); if(tclresult()[0] == '0') return; - my_strdup2(254, &p, xctx->sch_path[xctx->currsch]+1); + my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); path = p; strtolower(path); for(k=1; k<=tok_mult; k++) { - my_strdup(246, &t, find_nth(expanded_tok, ",", k)); + my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", k)); strtolower(t); if(simtype == 0 ) { /* ngspice */ tclvareval("puts $gaw_fd {copyvar v(", path, t, @@ -1004,8 +1004,8 @@ static void send_net_to_gaw(int simtype, const char *node) ") sel #", color_str, "}\nvwait gaw_fd\n", NULL); } } - my_free(774, &p); - my_free(775, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } } @@ -1028,9 +1028,9 @@ static void send_current_to_bespice(int simtype, const char *node) sprintf(color_str, "%d %d %d", xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8, xctx->xcolor_array[c].blue>>8); expanded_tok = expandlabel(tok, &tok_mult); - my_strdup2(1282, &p, xctx->sch_path[xctx->currsch]+1); + my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); for(k=1; k<=tok_mult; k++) { - my_strdup(1281, &t, find_nth(expanded_tok, ",", k)); + my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", k)); if(!simtype) { /* spice */ tclvareval( "puts $bespice_server_getdata(sock) ", @@ -1071,8 +1071,8 @@ static void send_current_to_bespice(int simtype, const char *node) NULL); } } - my_free(1283, &p); - my_free(1284, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } static void send_current_to_graph(char **s, int simtype, const char *node) @@ -1087,7 +1087,7 @@ static void send_current_to_graph(char **s, int simtype, const char *node) tok = node; c = get_color(xctx->hilight_color); expanded_tok = expandlabel(tok, &tok_mult); - my_strdup2(523, &p, xctx->sch_path[xctx->currsch]+1); + my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); path = p; start_level = sch_waves_loaded(); if(path) { @@ -1101,7 +1101,7 @@ static void send_current_to_graph(char **s, int simtype, const char *node) strtolower(path); there_is_hierarchy = (strstr(path, ".") != NULL); for(k=1; k<=tok_mult; k++) { - my_strdup(376, &t, find_nth(expanded_tok, ",", k)); + my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", k)); strtolower(t); if(!simtype) { /* ngspice */ my_snprintf(ss, S(ss), "i(%s%s%s) %d", there_is_hierarchy ? "v." : "", path, t, c); @@ -1115,8 +1115,8 @@ static void send_current_to_graph(char **s, int simtype, const char *node) my_strcat(535, s, ss); } } - my_free(533, &p); - my_free(662, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } static void send_current_to_gaw(int simtype, const char *node) @@ -1136,12 +1136,12 @@ static void send_current_to_gaw(int simtype, const char *node) expanded_tok = expandlabel(tok, &tok_mult); tcleval("setup_tcp_gaw"); if(tclresult()[0] == '0') return; - my_strdup2(1180, &p, xctx->sch_path[xctx->currsch]+1); + my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); path = p; strtolower(path); there_is_hierarchy = (xctx->currsch > 0); for(k=1; k<=tok_mult; k++) { - my_strdup(1179, &t, find_nth(expanded_tok, ",", k)); + my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", k)); strtolower(t); if(!simtype) { /* spice */ tclvareval("puts $gaw_fd {copyvar i(", there_is_hierarchy ? "v." : "", path, t, @@ -1161,8 +1161,8 @@ static void send_current_to_gaw(int simtype, const char *node) " sel #", color_str, "}\nvwait gaw_fd\n", NULL); } } - my_free(1181, &p); - my_free(1182, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } /* hilight/clear pin/label instances attached to hilight nets, or instances with "hilight=true" @@ -1438,21 +1438,21 @@ static void create_simdata(void) int i, j; const char *str; free_simdata(); - my_realloc(60, &xctx->simdata, xctx->instances * sizeof(Simdata)); + my_realloc(_ALLOC_ID_, &xctx->simdata, xctx->instances * sizeof(Simdata)); xctx->simdata_ninst = xctx->instances; for(i = 0; i < xctx->instances; i++) { xSymbol *symbol = xctx->inst[i].ptr + xctx->sym; int npin = symbol->rects[PINLAYER]; xctx->simdata[i].pin = NULL; - if(npin) my_realloc(61, &xctx->simdata[i].pin, npin * sizeof(Simdata_pin)); + if(npin) my_realloc(_ALLOC_ID_, &xctx->simdata[i].pin, npin * sizeof(Simdata_pin)); xctx->simdata[i].npin = npin; for(j = 0; j < npin; j++) { char function[20]; xctx->simdata[i].pin[j].function=NULL; xctx->simdata[i].pin[j].go_to=NULL; my_snprintf(function, S(function), "function%d", j); - my_strdup(717, &xctx->simdata[i].pin[j].function, get_tok_value(symbol->prop_ptr, function, 0)); - my_strdup(963, &xctx->simdata[i].pin[j].go_to, + my_strdup(_ALLOC_ID_, &xctx->simdata[i].pin[j].function, get_tok_value(symbol->prop_ptr, function, 0)); + my_strdup(_ALLOC_ID_, &xctx->simdata[i].pin[j].go_to, get_tok_value(symbol->rect[PINLAYER][j].prop_ptr, "goto", 0)); str = get_tok_value(symbol->rect[PINLAYER][j].prop_ptr, "clock", 0); xctx->simdata[i].pin[j].clock = str[0] ? str[0] - '0' : -1; @@ -1468,12 +1468,12 @@ void free_simdata(void) for(i = 0; i < xctx->simdata_ninst; i++) { /* can not use xctx->instances if a new sch is loaded */ int npin = xctx->simdata[i].npin; for(j = 0; j < npin; j++) { - my_free(1219, &xctx->simdata[i].pin[j].function); - my_free(1220, &xctx->simdata[i].pin[j].go_to); + my_free(_ALLOC_ID_, &xctx->simdata[i].pin[j].function); + my_free(_ALLOC_ID_, &xctx->simdata[i].pin[j].go_to); } - if(npin) my_free(1221, &xctx->simdata[i].pin); + if(npin) my_free(_ALLOC_ID_, &xctx->simdata[i].pin); } - my_free(1222, &xctx->simdata); + my_free(_ALLOC_ID_, &xctx->simdata); } xctx->simdata_ninst = 0; } @@ -1594,7 +1594,7 @@ static void propagate_logic() if( tclresult()[0] == '1') break; iter++; } /* while(1) */ - /* my_free(1222, &propagated_net); */ + /* my_free(_ALLOC_ID_, &propagated_net); */ } void logic_set(int value, int num) @@ -1715,7 +1715,7 @@ void hilight_net(int viewer) } if( viewer == XSCHEM_GRAPH && s) { tclvareval("graph_add_nodes_from_list {", s, "}", NULL); - my_free(1504, &s); + my_free(_ALLOC_ID_, &s); } if(!incr_hi) incr_hilight_color(); if(xctx->hilight_nets) propagate_hilights(1, 0, XINSERT_NOREPLACE); @@ -1947,14 +1947,14 @@ void print_hilight_net(int show) fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr); return; } - my_strdup(147, &filetmp2, filename_ptr); + my_strdup(_ALLOC_ID_, &filetmp2, filename_ptr); fclose(fd); if(!(fd = open_tmpfile("hilight1_", &filename_ptr))) { fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr); - my_free(776, &filetmp2); + my_free(_ALLOC_ID_, &filetmp2); return; } - my_strdup(148, &filetmp1, filename_ptr); + my_strdup(_ALLOC_ID_, &filetmp1, filename_ptr); my_snprintf(cmd, S(cmd), "awk -f \"%s/order_labels.awk\"", tclgetvar("XSCHEM_SHAREDIR")); my_snprintf(cmd2, S(cmd2), "%s %s > %s", cmd, filetmp1, filetmp2); my_snprintf(cmd3, S(cmd3), "awk -f \"%s/sort_labels.awk\" %s", tclgetvar("XSCHEM_SHAREDIR"), filetmp1); @@ -2027,8 +2027,8 @@ void print_hilight_net(int show) xctx->prep_hi_structs=0; xctx->prep_net_structs=0; - my_free(781, &filetmp1); - my_free(782, &filetmp2); + my_free(_ALLOC_ID_, &filetmp1); + my_free(_ALLOC_ID_, &filetmp2); } void list_hilights(void) diff --git a/src/in_memory_undo.c b/src/in_memory_undo.c index b70dc63a..f9dc28b2 100644 --- a/src/in_memory_undo.c +++ b/src/in_memory_undo.c @@ -28,9 +28,9 @@ static void free_undo_lines(int slot) for(c = 0;cuslot[slot].lines[c]; i++) { - my_free(783, &xctx->uslot[slot].lptr[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].lptr[c][i].prop_ptr); } - my_free(784, &xctx->uslot[slot].lptr[c]); + my_free(_ALLOC_ID_, &xctx->uslot[slot].lptr[c]); xctx->uslot[slot].lines[c] = 0; } } @@ -41,9 +41,9 @@ static void free_undo_rects(int slot) for(c = 0;cuslot[slot].rects[c]; i++) { - my_free(785, &xctx->uslot[slot].bptr[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].bptr[c][i].prop_ptr); } - my_free(786, &xctx->uslot[slot].bptr[c]); + my_free(_ALLOC_ID_, &xctx->uslot[slot].bptr[c]); xctx->uslot[slot].rects[c] = 0; } } @@ -54,12 +54,12 @@ static void free_undo_polygons(int slot) for(c = 0;cuslot[slot].polygons[c]; i++) { - my_free(787, &xctx->uslot[slot].pptr[c][i].prop_ptr); - my_free(788, &xctx->uslot[slot].pptr[c][i].x); - my_free(789, &xctx->uslot[slot].pptr[c][i].y); - my_free(790, &xctx->uslot[slot].pptr[c][i].selected_point); + my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].x); + my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].y); + my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].selected_point); } - my_free(791, &xctx->uslot[slot].pptr[c]); + my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c]); xctx->uslot[slot].polygons[c] = 0; } } @@ -70,9 +70,9 @@ static void free_undo_arcs(int slot) for(c = 0;cuslot[slot].arcs[c]; i++) { - my_free(792, &xctx->uslot[slot].aptr[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].aptr[c][i].prop_ptr); } - my_free(793, &xctx->uslot[slot].aptr[c]); + my_free(_ALLOC_ID_, &xctx->uslot[slot].aptr[c]); xctx->uslot[slot].arcs[c] = 0; } } @@ -82,9 +82,9 @@ static void free_undo_wires(int slot) int i; for(i = 0;iuslot[slot].wires; i++) { - my_free(794, &xctx->uslot[slot].wptr[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].wptr[i].prop_ptr); } - my_free(795, &xctx->uslot[slot].wptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].wptr); xctx->uslot[slot].wires = 0; } @@ -93,11 +93,11 @@ static void free_undo_texts(int slot) int i; for(i = 0;iuslot[slot].texts; i++) { - my_free(796, &xctx->uslot[slot].tptr[i].prop_ptr); - my_free(797, &xctx->uslot[slot].tptr[i].txt_ptr); - my_free(798, &xctx->uslot[slot].tptr[i].font); + my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].txt_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].font); } - my_free(799, &xctx->uslot[slot].tptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr); xctx->uslot[slot].texts = 0; } @@ -106,12 +106,12 @@ static void free_undo_instances(int slot) int i; for(i = 0;iuslot[slot].instances; i++) { - my_free(800, &xctx->uslot[slot].iptr[i].name); - my_free(801, &xctx->uslot[slot].iptr[i].prop_ptr); - my_free(802, &xctx->uslot[slot].iptr[i].instname); - my_free(104, &xctx->uslot[slot].iptr[i].lab); + my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].name); + my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].instname); + my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].lab); } - my_free(803, &xctx->uslot[slot].iptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr); xctx->uslot[slot].instances = 0; } @@ -123,70 +123,70 @@ static void free_undo_symbols(int slot) symbols = xctx->uslot[slot].symbols; for(i = 0;i < symbols; i++) { sym = &xctx->uslot[slot].symptr[i]; - my_free(354, &sym->name); - my_free(355, &sym->prop_ptr); - my_free(373, &sym->type); - my_free(660, &sym->templ); + my_free(_ALLOC_ID_, &sym->name); + my_free(_ALLOC_ID_, &sym->prop_ptr); + my_free(_ALLOC_ID_, &sym->type); + my_free(_ALLOC_ID_, &sym->templ); for(c = 0;cpolygons[c];j++) { if(sym->poly[c][j].prop_ptr != NULL) { - my_free(892, &sym->poly[c][j].prop_ptr); + my_free(_ALLOC_ID_, &sym->poly[c][j].prop_ptr); } - my_free(914, &sym->poly[c][j].x); - my_free(915, &sym->poly[c][j].y); - my_free(918, &sym->poly[c][j].selected_point); + my_free(_ALLOC_ID_, &sym->poly[c][j].x); + my_free(_ALLOC_ID_, &sym->poly[c][j].y); + my_free(_ALLOC_ID_, &sym->poly[c][j].selected_point); } - my_free(1137, &sym->poly[c]); + my_free(_ALLOC_ID_, &sym->poly[c]); sym->polygons[c] = 0; for(j = 0;jlines[c];j++) { if(sym->line[c][j].prop_ptr != NULL) { - my_free(1142, &sym->line[c][j].prop_ptr); + my_free(_ALLOC_ID_, &sym->line[c][j].prop_ptr); } } - my_free(1290, &sym->line[c]); + my_free(_ALLOC_ID_, &sym->line[c]); sym->lines[c] = 0; for(j = 0;jarcs[c];j++) { if(sym->arc[c][j].prop_ptr != NULL) { - my_free(1291, &sym->arc[c][j].prop_ptr); + my_free(_ALLOC_ID_, &sym->arc[c][j].prop_ptr); } } - my_free(1292, &sym->arc[c]); + my_free(_ALLOC_ID_, &sym->arc[c]); sym->arcs[c] = 0; for(j = 0;jrects[c];j++) { if(sym->rect[c][j].prop_ptr != NULL) { - my_free(1293, &sym->rect[c][j].prop_ptr); + my_free(_ALLOC_ID_, &sym->rect[c][j].prop_ptr); } } - my_free(1294, &sym->rect[c]); + my_free(_ALLOC_ID_, &sym->rect[c]); sym->rects[c] = 0; } for(j = 0;jtexts;j++) { if(sym->text[j].prop_ptr != NULL) { - my_free(1297, &sym->text[j].prop_ptr); + my_free(_ALLOC_ID_, &sym->text[j].prop_ptr); } if(sym->text[j].txt_ptr != NULL) { - my_free(1298, &sym->text[j].txt_ptr); + my_free(_ALLOC_ID_, &sym->text[j].txt_ptr); } if(sym->text[j].font != NULL) { - my_free(1299, &sym->text[j].font); + my_free(_ALLOC_ID_, &sym->text[j].font); } } - my_free(1300, &sym->text); + my_free(_ALLOC_ID_, &sym->text); sym->texts = 0; - my_free(1301, &sym->line); - my_free(1302, &sym->rect); - my_free(1303, &sym->poly); - my_free(1304, &sym->arc); - my_free(1305, &sym->lines); - my_free(1306, &sym->rects); - my_free(1307, &sym->polygons); - my_free(1308, &sym->arcs); + my_free(_ALLOC_ID_, &sym->line); + my_free(_ALLOC_ID_, &sym->rect); + my_free(_ALLOC_ID_, &sym->poly); + my_free(_ALLOC_ID_, &sym->arc); + my_free(_ALLOC_ID_, &sym->lines); + my_free(_ALLOC_ID_, &sym->rects); + my_free(_ALLOC_ID_, &sym->polygons); + my_free(_ALLOC_ID_, &sym->arcs); } - my_free(48, &xctx->uslot[slot].symptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].symptr); xctx->uslot[slot].symbols = 0; } @@ -197,14 +197,14 @@ static void mem_init_undo(void) dbg(1, "mem_init_undo(): undo_initialized = %d\n", xctx->undo_initialized); if(!xctx->undo_initialized) { for(slot = 0;slotuslot[slot].lines = my_calloc(165, cadlayers, sizeof(int)); - xctx->uslot[slot].rects = my_calloc(166, cadlayers, sizeof(int)); - xctx->uslot[slot].arcs = my_calloc(167, cadlayers, sizeof(int)); - xctx->uslot[slot].polygons = my_calloc(168, cadlayers, sizeof(int)); - xctx->uslot[slot].lptr = my_calloc(169, cadlayers, sizeof(xLine *)); - xctx->uslot[slot].bptr = my_calloc(170, cadlayers, sizeof(xRect *)); - xctx->uslot[slot].aptr = my_calloc(171, cadlayers, sizeof(xArc *)); - xctx->uslot[slot].pptr = my_calloc(172, cadlayers, sizeof(xPoly *)); + xctx->uslot[slot].lines = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->uslot[slot].rects = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->uslot[slot].arcs = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->uslot[slot].polygons = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->uslot[slot].lptr = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *)); + xctx->uslot[slot].bptr = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xRect *)); + xctx->uslot[slot].aptr = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *)); + xctx->uslot[slot].pptr = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *)); } xctx->undo_initialized = 1; } @@ -239,14 +239,14 @@ void mem_delete_undo(void) if(!xctx->undo_initialized) return; mem_clear_undo(); for(slot = 0;slotuslot[slot].lines); - my_free(805, &xctx->uslot[slot].rects); - my_free(806, &xctx->uslot[slot].arcs); - my_free(807, &xctx->uslot[slot].polygons); - my_free(808, &xctx->uslot[slot].lptr); - my_free(809, &xctx->uslot[slot].bptr); - my_free(810, &xctx->uslot[slot].aptr); - my_free(811, &xctx->uslot[slot].pptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].lines); + my_free(_ALLOC_ID_, &xctx->uslot[slot].rects); + my_free(_ALLOC_ID_, &xctx->uslot[slot].arcs); + my_free(_ALLOC_ID_, &xctx->uslot[slot].polygons); + my_free(_ALLOC_ID_, &xctx->uslot[slot].lptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].bptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].aptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr); } xctx->undo_initialized = 0; } @@ -261,11 +261,11 @@ void mem_push_undo(void) mem_init_undo(); slot = xctx->cur_undo_ptr%MAX_UNDO; - my_strdup(173, &xctx->uslot[slot].gptr, xctx->schvhdlprop); - my_strdup(174, &xctx->uslot[slot].vptr, xctx->schverilogprop); - my_strdup(175, &xctx->uslot[slot].sptr, xctx->schprop); - my_strdup(359, &xctx->uslot[slot].kptr, xctx->schsymbolprop); - my_strdup(176, &xctx->uslot[slot].eptr, xctx->schtedaxprop); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].gptr, xctx->schvhdlprop); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].vptr, xctx->schverilogprop); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].sptr, xctx->schprop); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].kptr, xctx->schsymbolprop); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].eptr, xctx->schtedaxprop); free_undo_lines(slot); free_undo_rects(slot); @@ -281,15 +281,15 @@ void mem_push_undo(void) memcpy(xctx->uslot[slot].arcs, xctx->arcs, sizeof(xctx->arcs[0]) * cadlayers); memcpy(xctx->uslot[slot].polygons, xctx->polygons, sizeof(xctx->polygons[0]) * cadlayers); for(c = 0;cuslot[slot].lptr[c] = my_calloc(177, xctx->lines[c], sizeof(xLine)); - xctx->uslot[slot].bptr[c] = my_calloc(178, xctx->rects[c], sizeof(xRect)); - xctx->uslot[slot].pptr[c] = my_calloc(179, xctx->polygons[c], sizeof(xPoly)); - xctx->uslot[slot].aptr[c] = my_calloc(180, xctx->arcs[c], sizeof(xArc)); + xctx->uslot[slot].lptr[c] = my_calloc(_ALLOC_ID_, xctx->lines[c], sizeof(xLine)); + xctx->uslot[slot].bptr[c] = my_calloc(_ALLOC_ID_, xctx->rects[c], sizeof(xRect)); + xctx->uslot[slot].pptr[c] = my_calloc(_ALLOC_ID_, xctx->polygons[c], sizeof(xPoly)); + xctx->uslot[slot].aptr[c] = my_calloc(_ALLOC_ID_, xctx->arcs[c], sizeof(xArc)); } - xctx->uslot[slot].wptr = my_calloc(181, xctx->wires, sizeof(xWire)); - xctx->uslot[slot].tptr = my_calloc(182, xctx->texts, sizeof(xText)); - xctx->uslot[slot].iptr = my_calloc(183, xctx->instances, sizeof(xInstance)); - xctx->uslot[slot].symptr = my_calloc(353, xctx->symbols, sizeof(xSymbol)); + xctx->uslot[slot].wptr = my_calloc(_ALLOC_ID_, xctx->wires, sizeof(xWire)); + xctx->uslot[slot].tptr = my_calloc(_ALLOC_ID_, xctx->texts, sizeof(xText)); + xctx->uslot[slot].iptr = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(xInstance)); + xctx->uslot[slot].symptr = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(xSymbol)); xctx->uslot[slot].texts = xctx->texts; xctx->uslot[slot].instances = xctx->instances; xctx->uslot[slot].symbols = xctx->symbols; @@ -300,34 +300,34 @@ void mem_push_undo(void) for(i = 0;ilines[c];i++) { xctx->uslot[slot].lptr[c][i] = xctx->line[c][i]; xctx->uslot[slot].lptr[c][i].prop_ptr = NULL; - my_strdup(184, &xctx->uslot[slot].lptr[c][i].prop_ptr, xctx->line[c][i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].lptr[c][i].prop_ptr, xctx->line[c][i].prop_ptr); } /* rects */ for(i = 0;irects[c];i++) { xctx->uslot[slot].bptr[c][i] = xctx->rect[c][i]; xctx->uslot[slot].bptr[c][i].prop_ptr = NULL; xctx->uslot[slot].bptr[c][i].extraptr = NULL; - my_strdup(185, &xctx->uslot[slot].bptr[c][i].prop_ptr, xctx->rect[c][i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].bptr[c][i].prop_ptr, xctx->rect[c][i].prop_ptr); } /* arcs */ for(i = 0;iarcs[c];i++) { xctx->uslot[slot].aptr[c][i] = xctx->arc[c][i]; xctx->uslot[slot].aptr[c][i].prop_ptr = NULL; - my_strdup(186, &xctx->uslot[slot].aptr[c][i].prop_ptr, xctx->arc[c][i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].aptr[c][i].prop_ptr, xctx->arc[c][i].prop_ptr); } /*polygons */ for(i = 0;ipolygons[c];i++) { int points = xctx->poly[c][i].points; xctx->uslot[slot].pptr[c][i] = xctx->poly[c][i]; xctx->uslot[slot].pptr[c][i].prop_ptr = NULL; - xctx->uslot[slot].pptr[c][i].x = my_malloc(187, points * sizeof(double)); - xctx->uslot[slot].pptr[c][i].y = my_malloc(188, points * sizeof(double)); - xctx->uslot[slot].pptr[c][i].selected_point = my_malloc(189, points * sizeof(unsigned short)); + xctx->uslot[slot].pptr[c][i].x = my_malloc(_ALLOC_ID_, points * sizeof(double)); + xctx->uslot[slot].pptr[c][i].y = my_malloc(_ALLOC_ID_, points * sizeof(double)); + xctx->uslot[slot].pptr[c][i].selected_point = my_malloc(_ALLOC_ID_, points * sizeof(unsigned short)); memcpy(xctx->uslot[slot].pptr[c][i].x, xctx->poly[c][i].x, points * sizeof(double)); memcpy(xctx->uslot[slot].pptr[c][i].y, xctx->poly[c][i].y, points * sizeof(double)); memcpy(xctx->uslot[slot].pptr[c][i].selected_point, xctx->poly[c][i].selected_point, points * sizeof(unsigned short)); - my_strdup(190, &xctx->uslot[slot].pptr[c][i].prop_ptr, xctx->poly[c][i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].prop_ptr, xctx->poly[c][i].prop_ptr); } } /* instances */ @@ -338,10 +338,10 @@ void mem_push_undo(void) xctx->uslot[slot].iptr[i].instname = NULL; xctx->uslot[slot].iptr[i].lab = NULL; xctx->uslot[slot].iptr[i].node = NULL; - my_strdup(330, &xctx->uslot[slot].iptr[i].lab, xctx->inst[i].lab); - my_strdup2(191, &xctx->uslot[slot].iptr[i].instname, xctx->inst[i].instname); - my_strdup(192, &xctx->uslot[slot].iptr[i].prop_ptr, xctx->inst[i].prop_ptr); - my_strdup2(193, &xctx->uslot[slot].iptr[i].name, xctx->inst[i].name); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].lab, xctx->inst[i].lab); + my_strdup2(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].instname, xctx->inst[i].instname); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].prop_ptr, xctx->inst[i].prop_ptr); + my_strdup2(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].name, xctx->inst[i].name); } /* symbols */ @@ -352,19 +352,19 @@ void mem_push_undo(void) sym->prop_ptr = NULL; sym->type = NULL; sym->templ = NULL; - my_strdup2(1316, &sym->name, xctx->sym[i].name); - my_strdup2(1317, &sym->type, xctx->sym[i].type); - my_strdup2(1318, &sym->templ, xctx->sym[i].templ); - my_strdup2(1319, &sym->prop_ptr, xctx->sym[i].prop_ptr); - sym->line = my_calloc(1309, cadlayers, sizeof(xLine *)); - sym->poly = my_calloc(1324, cadlayers, sizeof(xPoly *)); - sym->arc = my_calloc(1310, cadlayers, sizeof(xArc *)); - sym->rect = my_calloc(1311, cadlayers, sizeof(xRect *)); - sym->lines = my_calloc(1312, cadlayers, sizeof(int)); - sym->rects = my_calloc(1313, cadlayers, sizeof(int)); - sym->arcs = my_calloc(1314, cadlayers, sizeof(int)); - sym->polygons = my_calloc(1315, cadlayers, sizeof(int)); - sym->text = my_calloc(1320, xctx->sym[i].texts, sizeof(xText)); + my_strdup2(_ALLOC_ID_, &sym->name, xctx->sym[i].name); + my_strdup2(_ALLOC_ID_, &sym->type, xctx->sym[i].type); + my_strdup2(_ALLOC_ID_, &sym->templ, xctx->sym[i].templ); + my_strdup2(_ALLOC_ID_, &sym->prop_ptr, xctx->sym[i].prop_ptr); + sym->line = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *)); + sym->poly = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *)); + sym->arc = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *)); + sym->rect = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xRect *)); + sym->lines = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + sym->rects = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + sym->arcs = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + sym->polygons = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + sym->text = my_calloc(_ALLOC_ID_, xctx->sym[i].texts, sizeof(xText)); memcpy(sym->lines, xctx->sym[i].lines, sizeof(sym->lines[0]) * cadlayers); memcpy(sym->rects, xctx->sym[i].rects, sizeof(sym->rects[0]) * cadlayers); @@ -372,37 +372,37 @@ void mem_push_undo(void) memcpy(sym->polygons, xctx->sym[i].polygons, sizeof(sym->polygons[0]) * cadlayers); for(c = 0;cline[c] = my_calloc(1359, xctx->sym[i].lines[c], sizeof(xLine)); + sym->line[c] = my_calloc(_ALLOC_ID_, xctx->sym[i].lines[c], sizeof(xLine)); for(j = 0; j < xctx->sym[i].lines[c]; j++) { sym->line[c][j] = xctx->sym[i].line[c][j]; sym->line[c][j].prop_ptr = NULL; - my_strdup(1358, &sym->line[c][j].prop_ptr, xctx->sym[i].line[c][j].prop_ptr); + my_strdup(_ALLOC_ID_, &sym->line[c][j].prop_ptr, xctx->sym[i].line[c][j].prop_ptr); } /* symbol rects */ - sym->rect[c] = my_calloc(1360, xctx->sym[i].rects[c], sizeof(xRect)); + sym->rect[c] = my_calloc(_ALLOC_ID_, xctx->sym[i].rects[c], sizeof(xRect)); for(j = 0; j < xctx->sym[i].rects[c]; j++) { sym->rect[c][j] = xctx->sym[i].rect[c][j]; sym->rect[c][j].prop_ptr = NULL; sym->rect[c][j].extraptr = NULL; - my_strdup(1362, &sym->rect[c][j].prop_ptr, xctx->sym[i].rect[c][j].prop_ptr); + my_strdup(_ALLOC_ID_, &sym->rect[c][j].prop_ptr, xctx->sym[i].rect[c][j].prop_ptr); } /* symbol arcs */ - sym->arc[c] = my_calloc(1361, xctx->sym[i].arcs[c], sizeof(xArc)); + sym->arc[c] = my_calloc(_ALLOC_ID_, xctx->sym[i].arcs[c], sizeof(xArc)); for(j = 0; j < xctx->sym[i].arcs[c]; j++) { sym->arc[c][j] = xctx->sym[i].arc[c][j]; sym->arc[c][j].prop_ptr = NULL; - my_strdup(1375, &sym->arc[c][j].prop_ptr, xctx->sym[i].arc[c][j].prop_ptr); + my_strdup(_ALLOC_ID_, &sym->arc[c][j].prop_ptr, xctx->sym[i].arc[c][j].prop_ptr); } /* symbol polygons */ - sym->poly[c] = my_calloc(1363, xctx->sym[i].polygons[c], sizeof(xPoly)); + sym->poly[c] = my_calloc(_ALLOC_ID_, xctx->sym[i].polygons[c], sizeof(xPoly)); for(j = 0; j < xctx->sym[i].polygons[c]; j++) { int points = xctx->sym[i].poly[c][j].points; sym->poly[c][j] = xctx->sym[i].poly[c][j]; sym->poly[c][j].prop_ptr = NULL; - sym->poly[c][j].x = my_malloc(1365, points * sizeof(double)); - sym->poly[c][j].y = my_malloc(1366, points * sizeof(double)); - sym->poly[c][j].selected_point = my_malloc(1367, points * sizeof(unsigned short)); - my_strdup(1364, &sym->poly[c][j].prop_ptr, xctx->sym[i].poly[c][j].prop_ptr); + sym->poly[c][j].x = my_malloc(_ALLOC_ID_, points * sizeof(double)); + sym->poly[c][j].y = my_malloc(_ALLOC_ID_, points * sizeof(double)); + sym->poly[c][j].selected_point = my_malloc(_ALLOC_ID_, points * sizeof(unsigned short)); + my_strdup(_ALLOC_ID_, &sym->poly[c][j].prop_ptr, xctx->sym[i].poly[c][j].prop_ptr); memcpy(sym->poly[c][j].x, xctx->sym[i].poly[c][j].x, points * sizeof(double)); memcpy(sym->poly[c][j].y, xctx->sym[i].poly[c][j].y, points * sizeof(double)); memcpy(sym->poly[c][j].selected_point, xctx->sym[i].poly[c][j].selected_point, @@ -415,9 +415,9 @@ void mem_push_undo(void) sym->text[j].prop_ptr = NULL; sym->text[j].txt_ptr = NULL; sym->text[j].font = NULL; - my_strdup(1321, &sym->text[j].prop_ptr, xctx->sym[i].text[j].prop_ptr); - my_strdup(1322, &sym->text[j].txt_ptr, xctx->sym[i].text[j].txt_ptr); - my_strdup(1323, &sym->text[j].font, xctx->sym[i].text[j].font); + my_strdup(_ALLOC_ID_, &sym->text[j].prop_ptr, xctx->sym[i].text[j].prop_ptr); + my_strdup(_ALLOC_ID_, &sym->text[j].txt_ptr, xctx->sym[i].text[j].txt_ptr); + my_strdup(_ALLOC_ID_, &sym->text[j].font, xctx->sym[i].text[j].font); } } @@ -427,9 +427,9 @@ void mem_push_undo(void) xctx->uslot[slot].tptr[i].prop_ptr = NULL; xctx->uslot[slot].tptr[i].txt_ptr = NULL; xctx->uslot[slot].tptr[i].font = NULL; - my_strdup(194, &xctx->uslot[slot].tptr[i].prop_ptr, xctx->text[i].prop_ptr); - my_strdup(195, &xctx->uslot[slot].tptr[i].txt_ptr, xctx->text[i].txt_ptr); - my_strdup(196, &xctx->uslot[slot].tptr[i].font, xctx->text[i].font); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].prop_ptr, xctx->text[i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].txt_ptr, xctx->text[i].txt_ptr); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].font, xctx->text[i].font); } /* wires */ @@ -437,7 +437,7 @@ void mem_push_undo(void) xctx->uslot[slot].wptr[i] = xctx->wire[i]; xctx->uslot[slot].wptr[i].prop_ptr = NULL; xctx->uslot[slot].wptr[i].node = NULL; - my_strdup(197, &xctx->uslot[slot].wptr[i].prop_ptr, xctx->wire[i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].wptr[i].prop_ptr, xctx->wire[i].prop_ptr); } @@ -480,78 +480,78 @@ void mem_pop_undo(int redo, int set_modify_status) slot = xctx->cur_undo_ptr%MAX_UNDO; clear_drawing(); unselect_all(1); - my_free(1345, &xctx->wire); - my_free(1346, &xctx->text); - my_free(1347, &xctx->inst); + my_free(_ALLOC_ID_, &xctx->wire); + my_free(_ALLOC_ID_, &xctx->text); + my_free(_ALLOC_ID_, &xctx->inst); for(i = 0;irect[i]); - my_free(1342, &xctx->line[i]); - my_free(1343, &xctx->poly[i]); - my_free(1344, &xctx->arc[i]); + my_free(_ALLOC_ID_, &xctx->rect[i]); + my_free(_ALLOC_ID_, &xctx->line[i]); + my_free(_ALLOC_ID_, &xctx->poly[i]); + my_free(_ALLOC_ID_, &xctx->arc[i]); } remove_symbols(); for(i = 0;imaxs;i++) { - my_free(1349, &xctx->sym[i].line); - my_free(1350, &xctx->sym[i].rect); - my_free(1351, &xctx->sym[i].arc); - my_free(1352, &xctx->sym[i].poly); - my_free(1353, &xctx->sym[i].lines); - my_free(1354, &xctx->sym[i].polygons); - my_free(1355, &xctx->sym[i].arcs); - my_free(1356, &xctx->sym[i].rects); + my_free(_ALLOC_ID_, &xctx->sym[i].line); + my_free(_ALLOC_ID_, &xctx->sym[i].rect); + my_free(_ALLOC_ID_, &xctx->sym[i].arc); + my_free(_ALLOC_ID_, &xctx->sym[i].poly); + my_free(_ALLOC_ID_, &xctx->sym[i].lines); + my_free(_ALLOC_ID_, &xctx->sym[i].polygons); + my_free(_ALLOC_ID_, &xctx->sym[i].arcs); + my_free(_ALLOC_ID_, &xctx->sym[i].rects); } - my_free(0, &xctx->sym); + my_free(_ALLOC_ID_, &xctx->sym); - my_strdup(198, &xctx->schvhdlprop, xctx->uslot[slot].gptr); - my_strdup(199, &xctx->schverilogprop, xctx->uslot[slot].vptr); - my_strdup(200, &xctx->schprop, xctx->uslot[slot].sptr); - my_strdup(389, &xctx->schsymbolprop, xctx->uslot[slot].kptr); - my_strdup(201, &xctx->schtedaxprop, xctx->uslot[slot].eptr); + my_strdup(_ALLOC_ID_, &xctx->schvhdlprop, xctx->uslot[slot].gptr); + my_strdup(_ALLOC_ID_, &xctx->schverilogprop, xctx->uslot[slot].vptr); + my_strdup(_ALLOC_ID_, &xctx->schprop, xctx->uslot[slot].sptr); + my_strdup(_ALLOC_ID_, &xctx->schsymbolprop, xctx->uslot[slot].kptr); + my_strdup(_ALLOC_ID_, &xctx->schtedaxprop, xctx->uslot[slot].eptr); for(c = 0;cmaxl[c] = xctx->lines[c] = xctx->uslot[slot].lines[c]; - xctx->line[c] = my_calloc(202, xctx->lines[c], sizeof(xLine)); + xctx->line[c] = my_calloc(_ALLOC_ID_, xctx->lines[c], sizeof(xLine)); for(i = 0;ilines[c];i++) { xctx->line[c][i] = xctx->uslot[slot].lptr[c][i]; xctx->line[c][i].prop_ptr = NULL; - my_strdup(203, &xctx->line[c][i].prop_ptr, xctx->uslot[slot].lptr[c][i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->line[c][i].prop_ptr, xctx->uslot[slot].lptr[c][i].prop_ptr); } /* rects */ xctx->maxr[c] = xctx->rects[c] = xctx->uslot[slot].rects[c]; - xctx->rect[c] = my_calloc(204, xctx->rects[c], sizeof(xRect)); + xctx->rect[c] = my_calloc(_ALLOC_ID_, xctx->rects[c], sizeof(xRect)); for(i = 0;irects[c];i++) { xctx->rect[c][i] = xctx->uslot[slot].bptr[c][i]; xctx->rect[c][i].prop_ptr = NULL; xctx->rect[c][i].extraptr = NULL; - my_strdup(205, &xctx->rect[c][i].prop_ptr, xctx->uslot[slot].bptr[c][i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->rect[c][i].prop_ptr, xctx->uslot[slot].bptr[c][i].prop_ptr); } /* arcs */ xctx->maxa[c] = xctx->arcs[c] = xctx->uslot[slot].arcs[c]; - xctx->arc[c] = my_calloc(206, xctx->arcs[c], sizeof(xArc)); + xctx->arc[c] = my_calloc(_ALLOC_ID_, xctx->arcs[c], sizeof(xArc)); for(i = 0;iarcs[c];i++) { xctx->arc[c][i] = xctx->uslot[slot].aptr[c][i]; xctx->arc[c][i].prop_ptr = NULL; - my_strdup(207, &xctx->arc[c][i].prop_ptr, xctx->uslot[slot].aptr[c][i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->arc[c][i].prop_ptr, xctx->uslot[slot].aptr[c][i].prop_ptr); } /* polygons */ xctx->maxp[c] = xctx->polygons[c] = xctx->uslot[slot].polygons[c]; - xctx->poly[c] = my_calloc(208, xctx->polygons[c], sizeof(xPoly)); + xctx->poly[c] = my_calloc(_ALLOC_ID_, xctx->polygons[c], sizeof(xPoly)); for(i = 0;ipolygons[c];i++) { int points = xctx->uslot[slot].pptr[c][i].points; xctx->poly[c][i] = xctx->uslot[slot].pptr[c][i]; xctx->poly[c][i].prop_ptr = NULL; - my_strdup(209, &xctx->poly[c][i].prop_ptr, xctx->uslot[slot].pptr[c][i].prop_ptr); - xctx->poly[c][i].x = my_malloc(210, points * sizeof(double)); - xctx->poly[c][i].y = my_malloc(211, points * sizeof(double)); - xctx->poly[c][i].selected_point = my_malloc(212, points * sizeof(unsigned short)); + my_strdup(_ALLOC_ID_, &xctx->poly[c][i].prop_ptr, xctx->uslot[slot].pptr[c][i].prop_ptr); + xctx->poly[c][i].x = my_malloc(_ALLOC_ID_, points * sizeof(double)); + xctx->poly[c][i].y = my_malloc(_ALLOC_ID_, points * sizeof(double)); + xctx->poly[c][i].selected_point = my_malloc(_ALLOC_ID_, points * sizeof(unsigned short)); memcpy(xctx->poly[c][i].x, xctx->uslot[slot].pptr[c][i].x, points * sizeof(double)); memcpy(xctx->poly[c][i].y, xctx->uslot[slot].pptr[c][i].y, points * sizeof(double)); memcpy(xctx->poly[c][i].selected_point, xctx->uslot[slot].pptr[c][i].selected_point, @@ -561,22 +561,22 @@ void mem_pop_undo(int redo, int set_modify_status) /* instances */ xctx->maxi = xctx->instances = xctx->uslot[slot].instances; - xctx->inst = my_calloc(213, xctx->instances, sizeof(xInstance)); + xctx->inst = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(xInstance)); for(i = 0;iinstances;i++) { xctx->inst[i] = xctx->uslot[slot].iptr[i]; xctx->inst[i].prop_ptr = NULL; xctx->inst[i].name = NULL; xctx->inst[i].instname = NULL; xctx->inst[i].lab = NULL; - my_strdup(214, &xctx->inst[i].prop_ptr, xctx->uslot[slot].iptr[i].prop_ptr); - my_strdup2(215, &xctx->inst[i].name, xctx->uslot[slot].iptr[i].name); - my_strdup2(216, &xctx->inst[i].instname, xctx->uslot[slot].iptr[i].instname); - my_strdup(766, &xctx->inst[i].lab, xctx->uslot[slot].iptr[i].lab); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, xctx->uslot[slot].iptr[i].prop_ptr); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].name, xctx->uslot[slot].iptr[i].name); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].instname, xctx->uslot[slot].iptr[i].instname); + my_strdup(_ALLOC_ID_, &xctx->inst[i].lab, xctx->uslot[slot].iptr[i].lab); } /* symbols */ xctx->maxs = xctx->symbols = xctx->uslot[slot].symbols; - xctx->sym = my_calloc(1325, xctx->symbols, sizeof(xSymbol)); + xctx->sym = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(xSymbol)); for(i = 0;isymbols;i++) { sym = &xctx->uslot[slot].symptr[i]; @@ -585,20 +585,20 @@ void mem_pop_undo(int redo, int set_modify_status) xctx->sym[i].prop_ptr = NULL; xctx->sym[i].type = NULL; xctx->sym[i].templ = NULL; - my_strdup2(1326, &xctx->sym[i].name, sym->name); - my_strdup2(1327, &xctx->sym[i].type, sym->type); - my_strdup2(1328, &xctx->sym[i].templ, sym->templ); - my_strdup2(1329, &xctx->sym[i].prop_ptr, sym->prop_ptr); + my_strdup2(_ALLOC_ID_, &xctx->sym[i].name, sym->name); + my_strdup2(_ALLOC_ID_, &xctx->sym[i].type, sym->type); + my_strdup2(_ALLOC_ID_, &xctx->sym[i].templ, sym->templ); + my_strdup2(_ALLOC_ID_, &xctx->sym[i].prop_ptr, sym->prop_ptr); - xctx->sym[i].line = my_calloc(1330, cadlayers, sizeof(xLine *)); - xctx->sym[i].poly = my_calloc(1331, cadlayers, sizeof(xPoly *)); - xctx->sym[i].arc = my_calloc(1332, cadlayers, sizeof(xArc *)); - xctx->sym[i].rect = my_calloc(1333, cadlayers, sizeof(xRect *)); - xctx->sym[i].lines = my_calloc(1334, cadlayers, sizeof(int)); - xctx->sym[i].rects = my_calloc(1335, cadlayers, sizeof(int)); - xctx->sym[i].arcs = my_calloc(1336, cadlayers, sizeof(int)); - xctx->sym[i].polygons = my_calloc(1337, cadlayers, sizeof(int)); - xctx->sym[i].text = my_calloc(1338, xctx->sym[i].texts, sizeof(xText)); + xctx->sym[i].line = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *)); + xctx->sym[i].poly = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *)); + xctx->sym[i].arc = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *)); + xctx->sym[i].rect = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xRect *)); + xctx->sym[i].lines = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->sym[i].rects = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->sym[i].arcs = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->sym[i].polygons = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->sym[i].text = my_calloc(_ALLOC_ID_, xctx->sym[i].texts, sizeof(xText)); memcpy(xctx->sym[i].lines, sym->lines, sizeof(sym->lines[0]) * cadlayers); memcpy(xctx->sym[i].rects, sym->rects, sizeof(sym->rects[0]) * cadlayers); @@ -607,41 +607,41 @@ void mem_pop_undo(int redo, int set_modify_status) for(c = 0;csym[i].line[c] = my_calloc(1371, sym->lines[c], sizeof(xLine)); + xctx->sym[i].line[c] = my_calloc(_ALLOC_ID_, sym->lines[c], sizeof(xLine)); for(j = 0; j < xctx->sym[i].lines[c]; j++) { xctx->sym[i].line[c][j] = sym->line[c][j]; xctx->sym[i].line[c][j].prop_ptr = NULL; - my_strdup(1368, & xctx->sym[i].line[c][j].prop_ptr, sym->line[c][j].prop_ptr); + my_strdup(_ALLOC_ID_, & xctx->sym[i].line[c][j].prop_ptr, sym->line[c][j].prop_ptr); } /* symbol rects */ - xctx->sym[i].rect[c] = my_calloc(1372, sym->rects[c], sizeof(xRect)); + xctx->sym[i].rect[c] = my_calloc(_ALLOC_ID_, sym->rects[c], sizeof(xRect)); for(j = 0; j < xctx->sym[i].rects[c]; j++) { xctx->sym[i].rect[c][j] = sym->rect[c][j]; xctx->sym[i].rect[c][j].prop_ptr = NULL; xctx->sym[i].rect[c][j].extraptr = NULL; - my_strdup(1369, & xctx->sym[i].rect[c][j].prop_ptr, sym->rect[c][j].prop_ptr); + my_strdup(_ALLOC_ID_, & xctx->sym[i].rect[c][j].prop_ptr, sym->rect[c][j].prop_ptr); } /* symbol arcs */ - xctx->sym[i].arc[c] = my_calloc(1373, sym->arcs[c], sizeof(xArc)); + xctx->sym[i].arc[c] = my_calloc(_ALLOC_ID_, sym->arcs[c], sizeof(xArc)); for(j = 0; j < xctx->sym[i].arcs[c]; j++) { xctx->sym[i].arc[c][j] = sym->arc[c][j]; xctx->sym[i].arc[c][j].prop_ptr = NULL; - my_strdup(1370, & xctx->sym[i].arc[c][j].prop_ptr, sym->arc[c][j].prop_ptr); + my_strdup(_ALLOC_ID_, & xctx->sym[i].arc[c][j].prop_ptr, sym->arc[c][j].prop_ptr); } /* symbol polygons */ - xctx->sym[i].poly[c] = my_calloc(1374, sym->polygons[c], sizeof(xPoly)); + xctx->sym[i].poly[c] = my_calloc(_ALLOC_ID_, sym->polygons[c], sizeof(xPoly)); for(j = 0; j < xctx->sym[i].polygons[c]; j++) { int points = sym->poly[c][j].points; xctx->sym[i].poly[c][j] = sym->poly[c][j]; xctx->sym[i].poly[c][j].prop_ptr = NULL; - xctx->sym[i].poly[c][j].x = my_malloc(1376, points * sizeof(double)); - xctx->sym[i].poly[c][j].y = my_malloc(1377, points * sizeof(double)); - xctx->sym[i].poly[c][j].selected_point = my_malloc(1378, points * sizeof(unsigned short)); + xctx->sym[i].poly[c][j].x = my_malloc(_ALLOC_ID_, points * sizeof(double)); + xctx->sym[i].poly[c][j].y = my_malloc(_ALLOC_ID_, points * sizeof(double)); + xctx->sym[i].poly[c][j].selected_point = my_malloc(_ALLOC_ID_, points * sizeof(unsigned short)); memcpy(xctx->sym[i].poly[c][j].x, sym->poly[c][j].x, points * sizeof(double)); memcpy(xctx->sym[i].poly[c][j].y, sym->poly[c][j].y, points * sizeof(double)); memcpy(xctx->sym[i].poly[c][j].selected_point, sym->poly[c][j].selected_point, points * sizeof(unsigned short)); - my_strdup(1357, & xctx->sym[i].poly[c][j].prop_ptr, sym->poly[c][j].prop_ptr); + my_strdup(_ALLOC_ID_, & xctx->sym[i].poly[c][j].prop_ptr, sym->poly[c][j].prop_ptr); } } /* symbol texts */ @@ -650,33 +650,33 @@ void mem_pop_undo(int redo, int set_modify_status) xctx->sym[i].text[j].prop_ptr = NULL; xctx->sym[i].text[j].txt_ptr = NULL; xctx->sym[i].text[j].font = NULL; - my_strdup(1339, &xctx->sym[i].text[j].prop_ptr, sym->text[j].prop_ptr); - my_strdup(1340, &xctx->sym[i].text[j].txt_ptr, sym->text[j].txt_ptr); - my_strdup(1341, &xctx->sym[i].text[j].font, sym->text[j].font); + my_strdup(_ALLOC_ID_, &xctx->sym[i].text[j].prop_ptr, sym->text[j].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->sym[i].text[j].txt_ptr, sym->text[j].txt_ptr); + my_strdup(_ALLOC_ID_, &xctx->sym[i].text[j].font, sym->text[j].font); } } /* texts */ xctx->maxt = xctx->texts = xctx->uslot[slot].texts; - xctx->text = my_calloc(217, xctx->texts, sizeof(xText)); + xctx->text = my_calloc(_ALLOC_ID_, xctx->texts, sizeof(xText)); for(i = 0;itexts;i++) { xctx->text[i] = xctx->uslot[slot].tptr[i]; xctx->text[i].txt_ptr = NULL; xctx->text[i].font = NULL; xctx->text[i].prop_ptr = NULL; - my_strdup(218, &xctx->text[i].prop_ptr, xctx->uslot[slot].tptr[i].prop_ptr); - my_strdup(219, &xctx->text[i].txt_ptr, xctx->uslot[slot].tptr[i].txt_ptr); - my_strdup(220, &xctx->text[i].font, xctx->uslot[slot].tptr[i].font); + my_strdup(_ALLOC_ID_, &xctx->text[i].prop_ptr, xctx->uslot[slot].tptr[i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->text[i].txt_ptr, xctx->uslot[slot].tptr[i].txt_ptr); + my_strdup(_ALLOC_ID_, &xctx->text[i].font, xctx->uslot[slot].tptr[i].font); } /* wires */ xctx->maxw = xctx->wires = xctx->uslot[slot].wires; - xctx->wire = my_calloc(221, xctx->wires, sizeof(xWire)); + xctx->wire = my_calloc(_ALLOC_ID_, xctx->wires, sizeof(xWire)); for(i = 0;iwires;i++) { xctx->wire[i] = xctx->uslot[slot].wptr[i]; xctx->wire[i].prop_ptr = NULL; xctx->wire[i].node = NULL; - my_strdup(222, &xctx->wire[i].prop_ptr, xctx->uslot[slot].wptr[i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->wire[i].prop_ptr, xctx->uslot[slot].wptr[i].prop_ptr); } /* unnecessary since in_memory_undo saves all symbols */ /* link_symbols_to_instances(-1); */ diff --git a/src/main.c b/src/main.c index 4c91d6f9..a8419f1a 100644 --- a/src/main.c +++ b/src/main.c @@ -71,7 +71,7 @@ static void child_handler(int signum) int main(int argc, char **argv) { int i; - my_strdup(45, &xschem_executable, argv[0]); + my_strdup(_ALLOC_ID_, &xschem_executable, argv[0]); signal(SIGINT, sig_handler); signal(SIGSEGV, sig_handler); signal(SIGILL, sig_handler); @@ -94,10 +94,10 @@ int main(int argc, char **argv) cli_opt_argc = argc; - cli_opt_argv = my_malloc(291, cli_opt_argc * sizeof(char *)); + cli_opt_argv = my_malloc(_ALLOC_ID_, cli_opt_argc * sizeof(char *)); for(i = 0; i < cli_opt_argc; i++) { cli_opt_argv[i] = NULL; - my_strdup(374, &cli_opt_argv[i], argv[i]); + my_strdup(_ALLOC_ID_, &cli_opt_argv[i], argv[i]); } diff --git a/src/move.c b/src/move.c index 5ba74efa..6389ada1 100644 --- a/src/move.c +++ b/src/move.c @@ -104,8 +104,8 @@ void check_collapsing_objects() { if(xctx->wire[i].x1==xctx->wire[i].x2 && xctx->wire[i].y1 == xctx->wire[i].y2) { - my_free(812, &xctx->wire[i].prop_ptr); - my_free(813, &xctx->wire[i].node); + my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->wire[i].node); found=1; j++; continue; @@ -125,7 +125,7 @@ void check_collapsing_objects() { if(xctx->line[c][i].x1==xctx->line[c][i].x2 && xctx->line[c][i].y1 == xctx->line[c][i].y2) { - my_free(814, &xctx->line[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->line[c][i].prop_ptr); found=1; j++; continue; @@ -144,7 +144,7 @@ void check_collapsing_objects() { if(xctx->rect[c][i].x1==xctx->rect[c][i].x2 || xctx->rect[c][i].y1 == xctx->rect[c][i].y2) { - my_free(815, &xctx->rect[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->rect[c][i].prop_ptr); set_rect_extraptr(0, &xctx->rect[c][i]); found=1; j++; @@ -296,8 +296,8 @@ void draw_selection(GC g, int interruptable) break; case POLYGON: { - double *x = my_malloc(223, sizeof(double) *xctx->poly[c][n].points); - double *y = my_malloc(224, sizeof(double) *xctx->poly[c][n].points); + double *x = my_malloc(_ALLOC_ID_, sizeof(double) *xctx->poly[c][n].points); + double *y = my_malloc(_ALLOC_ID_, sizeof(double) *xctx->poly[c][n].points); if(xctx->poly[c][n].sel==SELECTED || xctx->poly[c][n].sel==SELECTED1) { for(k=0;kpoly[c][n].points; k++) { if( xctx->poly[c][n].sel==SELECTED || xctx->poly[c][n].selected_point[k]) { @@ -317,8 +317,8 @@ void draw_selection(GC g, int interruptable) } drawtemppolygon(g, NOW, x, y, xctx->poly[c][n].points); } - my_free(816, &x); - my_free(817, &y); + my_free(_ALLOC_ID_, &x); + my_free(_ALLOC_ID_, &y); } break; @@ -497,7 +497,7 @@ void find_inst_to_be_redrawn(int what) dbg(1,"find_inst_to_be_redrawn(): what=%d\n", what); if(what & 16) { - my_free(1202, &xctx->inst_redraw_table); + my_free(_ALLOC_ID_, &xctx->inst_redraw_table); xctx->inst_redraw_table_size = 0; if((s_pnetname || xctx->hilight_nets)) int_hash_free(&xctx->node_redraw_table); return; @@ -530,7 +530,7 @@ void find_inst_to_be_redrawn(int what) } /* if(!(what & 8)) */ if(!xctx->inst_redraw_table || xctx->instances > xctx->inst_redraw_table_size) { - my_realloc(1203, &xctx->inst_redraw_table, xctx->instances * sizeof(unsigned char)); + my_realloc(_ALLOC_ID_, &xctx->inst_redraw_table, xctx->instances * sizeof(unsigned char)); xctx->inst_redraw_table_size = xctx->instances; } for(i=0; i < xctx->instances; i++) { @@ -632,11 +632,11 @@ void copy_objects(int what) xctx->move_rot = xctx->move_flip = 0; xctx->deltax = xctx->deltay = 0.; xctx->ui_state&=~STARTCOPY; - my_strdup(225, &str, user_conf_dir); + my_strdup(_ALLOC_ID_, &str, user_conf_dir); my_strcat(226, &str, "/.selection.sch"); xunlink(str); update_symbol_bboxes(0, 0); - my_free(818, &str); + my_free(_ALLOC_ID_, &str); } if(what & RUBBER) /* draw objects while moving */ { @@ -796,8 +796,8 @@ void copy_objects(int what) { xPoly *p = &xctx->poly[c][n]; double bx1 = 0.0, by1 = 0.0, bx2 = 0.0, by2 = 0.0; - double *x = my_malloc(227, sizeof(double) *p->points); - double *y = my_malloc(228, sizeof(double) *p->points); + double *x = my_malloc(_ALLOC_ID_, sizeof(double) *p->points); + double *y = my_malloc(_ALLOC_ID_, sizeof(double) *p->points); int j; for(j=0; jpoints; j++) { if( p->sel==SELECTED || p->selected_point[j]) { @@ -821,8 +821,8 @@ void copy_objects(int what) xctx->sel_array[i].n=xctx->polygons[c]; store_poly(-1, x, y, p->points, c, p->sel, p->prop_ptr); p->sel=0; - my_free(819, &x); - my_free(820, &y); + my_free(_ALLOC_ID_, &x); + my_free(_ALLOC_ID_, &y); } break; case ARC: @@ -894,7 +894,7 @@ void copy_objects(int what) xctx->text[n].x0, xctx->text[n].y0, xctx->rx1,xctx->ry1); } xctx->text[xctx->texts].txt_ptr=NULL; - my_strdup(229, &xctx->text[xctx->texts].txt_ptr,xctx->text[n].txt_ptr); + my_strdup(_ALLOC_ID_, &xctx->text[xctx->texts].txt_ptr,xctx->text[n].txt_ptr); xctx->text[n].sel=0; dbg(2, "copy_objects(): current str=%s\n", xctx->text[xctx->texts].txt_ptr); @@ -906,8 +906,8 @@ void copy_objects(int what) xctx->text[xctx->texts].sel=SELECTED; xctx->text[xctx->texts].prop_ptr=NULL; xctx->text[xctx->texts].font=NULL; - my_strdup(230, &xctx->text[xctx->texts].prop_ptr, xctx->text[n].prop_ptr); - my_strdup(231, &xctx->text[xctx->texts].font, get_tok_value(xctx->text[xctx->texts].prop_ptr, "font", 0)); + my_strdup(_ALLOC_ID_, &xctx->text[xctx->texts].prop_ptr, xctx->text[n].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->text[xctx->texts].font, get_tok_value(xctx->text[xctx->texts].prop_ptr, "font", 0)); str = get_tok_value(xctx->text[xctx->texts].prop_ptr, "hcenter", 0); xctx->text[xctx->texts].hcenter = strcmp(str, "true") ? 0 : 1; @@ -981,13 +981,13 @@ void copy_objects(int what) xctx->inst[xctx->instances].lab=NULL; xctx->inst[xctx->instances].node=NULL; xctx->inst[xctx->instances].name=NULL; - my_strdup2(232, &xctx->inst[xctx->instances].name, xctx->inst[n].name); - my_strdup(233, &xctx->inst[xctx->instances].prop_ptr, xctx->inst[n].prop_ptr); + my_strdup2(_ALLOC_ID_, &xctx->inst[xctx->instances].name, xctx->inst[n].name); + my_strdup(_ALLOC_ID_, &xctx->inst[xctx->instances].prop_ptr, xctx->inst[n].prop_ptr); /* - * my_strdup2(234, &xctx->inst[xctx->instances].instname, get_tok_value(xctx->inst[n].prop_ptr, "name",0)); + * my_strdup2(_ALLOC_ID_, &xctx->inst[xctx->instances].instname, get_tok_value(xctx->inst[n].prop_ptr, "name",0)); */ xctx->inst[xctx->instances].instname = NULL; /* will be set in new_prop_string() */ - my_strdup(312, &xctx->inst[xctx->instances].lab, xctx->inst[n].lab); + my_strdup(_ALLOC_ID_, &xctx->inst[xctx->instances].lab, xctx->inst[n].lab); xctx->inst[n].sel=0; xctx->inst[xctx->instances].embed = xctx->inst[n].embed; xctx->inst[xctx->instances].flags = xctx->inst[n].flags; diff --git a/src/netlist.c b/src/netlist.c index 12cdc21f..243d3f07 100644 --- a/src/netlist.c +++ b/src/netlist.c @@ -30,7 +30,7 @@ static void instdelete(int n, int x, int y) prevptr = &xctx->inst_spatial_table[x][y]; while( (*prevptr)->n != n) prevptr = &(*prevptr)->next; saveptr = (*prevptr)->next; - my_free(821, prevptr); + my_free(_ALLOC_ID_, prevptr); *prevptr = saveptr; } @@ -38,7 +38,7 @@ static void instinsert(int n, int x, int y) { Instentry *ptr, *newptr; ptr=xctx->inst_spatial_table[x][y]; - newptr=my_malloc(236, sizeof(Instentry)); + newptr=my_malloc(_ALLOC_ID_, sizeof(Instentry)); newptr->next=ptr; newptr->n=n; xctx->inst_spatial_table[x][y]=newptr; @@ -50,7 +50,7 @@ static Instentry *delinstentry(Instentry *t) Instentry *tmp; while( t ) { tmp = t->next; - my_free(822, &t); + my_free(_ALLOC_ID_, &t); t = tmp; } return NULL; @@ -132,7 +132,7 @@ static void instpindelete(int n,int pin, int x, int y) while(ptr) { if(ptr->n == n && ptr->pin == pin) { saveptr = ptr->next; - my_free(823, &ptr); + my_free(_ALLOC_ID_, &ptr); *prevptr = saveptr; return; } @@ -147,7 +147,7 @@ static void instpininsert(int n,int pin, double x0, double y0, int x, int y) Instpinentry *ptr, *newptr; ptr=xctx->instpin_spatial_table[x][y]; - newptr=my_malloc(237, sizeof(Instpinentry)); + newptr=my_malloc(_ALLOC_ID_, sizeof(Instpinentry)); newptr->next=ptr; newptr->n=n; newptr->x0=x0; @@ -164,7 +164,7 @@ static Instpinentry *delinstpinentry(Instpinentry *t) while(t) { tmp = t->next; - my_free(824, &t); + my_free(_ALLOC_ID_, &t); t = tmp; } return NULL; @@ -187,7 +187,7 @@ static void wiredelete(int n, int x, int y) prevptr = &xctx->wire_spatial_table[x][y]; while( (*prevptr)->n != n) prevptr = &(*prevptr)->next; saveptr = (*prevptr)->next; - my_free(825, prevptr); + my_free(_ALLOC_ID_, prevptr); *prevptr = saveptr; } @@ -196,7 +196,7 @@ static void wireinsert(int n, int x, int y) Wireentry *ptr, *newptr; ptr=xctx->wire_spatial_table[x][y]; - newptr=my_malloc(238, sizeof(Wireentry)); + newptr=my_malloc(_ALLOC_ID_, sizeof(Wireentry)); newptr->next=ptr; newptr->n=n; xctx->wire_spatial_table[x][y]=newptr; @@ -209,7 +209,7 @@ static Wireentry *delwireentry(Wireentry *t) while( t ) { tmp = t->next; - my_free(826, &t); + my_free(_ALLOC_ID_, &t); t = tmp; } return NULL; @@ -487,18 +487,18 @@ int record_global_node(int what, FILE *fp, char *node) if(what == 3) return 0; /* node is not a global */ if(max_globals>=size_globals) { size_globals+=CADCHUNKALLOC; - my_realloc(243, &globals, size_globals*sizeof(char *) ); + my_realloc(_ALLOC_ID_, &globals, size_globals*sizeof(char *) ); } globals[max_globals]=NULL; - my_strdup(244, &globals[max_globals], node); + my_strdup(_ALLOC_ID_, &globals[max_globals], node); max_globals++; } else if(what == 0 || what == 2) { for(i=0;inetlist_type == CAD_SPICE_NETLIST) fprintf(fp, ".GLOBAL %s\n", globals[i]); if(what == 0 && xctx->netlist_type == CAD_TEDAX_NETLIST) fprintf(fp, "__GLOBAL__ %s\n", globals[i]); - my_free(829, &globals[i]); + my_free(_ALLOC_ID_, &globals[i]); } - my_free(830, &globals); + my_free(_ALLOC_ID_, &globals); size_globals=max_globals=0; } return 0; @@ -535,7 +535,7 @@ int get_unnamed_node(int what, int mult,int node) dbg(2, "get_unnamed_node(): what=%d mult=%d node=%d\n", what, mult, node); if(what==0) { /* initialize unnamed node data structures */ xctx->new_node=0; - my_free(828, &xctx->node_mult); + my_free(_ALLOC_ID_, &xctx->node_mult); xctx->node_mult_size=0; return 0; } @@ -549,7 +549,7 @@ int get_unnamed_node(int what, int mult,int node) if(xctx->new_node >= xctx->node_mult_size) { /* enlarge array and zero it */ int oldsize = xctx->node_mult_size; xctx->node_mult_size = xctx->new_node + CADCHUNKALLOC; - my_realloc(242, &xctx->node_mult, sizeof(xctx->node_mult[0]) * xctx->node_mult_size ); + my_realloc(_ALLOC_ID_, &xctx->node_mult, sizeof(xctx->node_mult[0]) * xctx->node_mult_size ); memset(xctx->node_mult + oldsize, 0, (xctx->node_mult_size - oldsize) * sizeof(xctx->node_mult[0])); } xctx->node_mult[xctx->new_node]=mult; @@ -585,7 +585,7 @@ static void name_generics() dbg(2, "prepare_netlist_structs(): naming generics from attached labels\n"); if(for_netlist) for (i=0;isym)->type); + my_strdup(_ALLOC_ID_, &type,(inst[i].ptr+ xctx->sym)->type); if(type && !IS_LABEL_OR_PIN(type) ) { if((generic_rects = (inst[i].ptr+ xctx->sym)->rects[GENERICLAYER]) > 0) { rects = (inst[i].ptr+ xctx->sym)->rects[PINLAYER]; @@ -609,12 +609,12 @@ static void name_generics() if((inst[n].ptr+ xctx->sym)->type && inst[n].node[p] != NULL && !strcmp((inst[n].ptr+ xctx->sym)->type, "label")) { dbg(2, "prepare_netlist_structs(): naming generic %s\n", inst[n].node[p]); - my_strdup(268, &inst[i].node[j], get_tok_value(inst[n].prop_ptr,"value",0) ); + my_strdup(_ALLOC_ID_, &inst[i].node[j], get_tok_value(inst[n].prop_ptr,"value",0) ); if(!for_netlist) { - my_strdup(270, &sig_type,""); + my_strdup(_ALLOC_ID_, &sig_type,""); bus_node_hash_lookup(inst[n].node[p],"", XINSERT, 1, sig_type,"", "",""); } else { - my_strdup(271, &sig_type,get_tok_value( + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value( (inst[i].ptr+ xctx->sym)->rect[GENERICLAYER][j-rects].prop_ptr, "sig_type",0)); /* insert generic label in hash table as a port so it will not */ /* be declared as a signal in the vhdl netlist. this is a workaround */ @@ -630,7 +630,7 @@ static void name_generics() } /* end if( rects=...>0) */ } /* end if(type not a label nor pin)... */ } /* end for(i...) */ - if(type) my_free(973, &type); + if(type) my_free(_ALLOC_ID_, &type); } static void signal_short( const char *tag, const char *n1, const char *n2) @@ -659,7 +659,7 @@ static void set_inst_node(int i, int j, const char *node) dbg(1, "set_inst_node(): inst %s pin %d <-- %s\n", inst[i].instname, j, node); expandlabel(inst[i].instname, &inst_mult); - my_strdup(275, &inst[i].node[j], node); + my_strdup(_ALLOC_ID_, &inst[i].node[j], node); if(!for_netlist) { bus_node_hash_lookup(inst[i].node[j],"", XINSERT, 0,"","","",""); } else { @@ -741,8 +741,8 @@ static void wirecheck(int k) /* recursive routine */ touch(wire[n].x1, wire[n].y1, wire[n].x2, wire[n].y2, wire[k].x2, wire[k].y2); if( touches ) { if(!wire[n].node) { - my_strdup(239, &wire[n].node, wire[k].node); - my_strdup(240, &wire[n].prop_ptr, subst_token(wire[n].prop_ptr, "lab", wire[n].node)); + my_strdup(_ALLOC_ID_, &wire[n].node, wire[k].node); + my_strdup(_ALLOC_ID_, &wire[n].prop_ptr, subst_token(wire[n].prop_ptr, "lab", wire[n].node)); name_attached_inst_to_net(n, tmpi, tmpj); wirecheck(n); /* recursive check */ } else { @@ -762,8 +762,8 @@ static void name_attached_nets(double x0, double y0, int sqx, int sqy, const cha int n = wptr->n; if(touch(wire[n].x1, wire[n].y1, wire[n].x2, wire[n].y2, x0,y0)) { if(!wire[n].node) { - my_strdup(263, &wire[n].node, node); - my_strdup(264, &wire[n].prop_ptr, subst_token(wire[n].prop_ptr, "lab", wire[n].node)); + my_strdup(_ALLOC_ID_, &wire[n].node, node); + my_strdup(_ALLOC_ID_, &wire[n].prop_ptr, subst_token(wire[n].prop_ptr, "lab", wire[n].node)); wirecheck(n); } else { if(for_netlist>0) signal_short("Net", wire[n].node, node); @@ -812,8 +812,8 @@ static int find_pass_through_symbols(int what, int ninst) int *symtable = NULL; if(what == 0 ) { /* initialize */ - pt_symbol = my_calloc(272, xctx->symbols, sizeof(int)); - symtable = my_calloc(1581, xctx->symbols, sizeof(int)); + pt_symbol = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(int)); + symtable = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(int)); for(i = 0; i < instances; i++) { k = inst[i].ptr; if( k < 0 || symtable[k] ) continue; @@ -829,13 +829,13 @@ static int find_pass_through_symbols(int what, int ninst) int_hash_free(&table); if(pt_symbol[k]) dbg(1, "duplicated pins: %s\n", xctx->sym[i].name); } - my_free(831, &symtable); + my_free(_ALLOC_ID_, &symtable); } else if(what ==1) { /* query */ k = inst[ninst].ptr; if(k >=0 && pt_symbol[k]) return 1; return 0; } else if(what ==2) { /* cleanup */ - my_free(832, &pt_symbol); + my_free(_ALLOC_ID_, &pt_symbol); } return -1; } @@ -855,7 +855,7 @@ static void instcheck(int n, int p) int k = inst[n].ptr; int rects = xctx->sym[k].rects[PINLAYER]; char *pin_name = NULL; - my_strdup(833, &pin_name, get_tok_value(xctx->sym[k].rect[PINLAYER][p].prop_ptr, "name", 0)); + my_strdup(_ALLOC_ID_, &pin_name, get_tok_value(xctx->sym[k].rect[PINLAYER][p].prop_ptr, "name", 0)); if(p >= rects) return; for(j = 0; j < rects; j++) { const char *other_pin; @@ -875,7 +875,7 @@ static void instcheck(int n, int p) } } } - my_free(834, &pin_name); + my_free(_ALLOC_ID_, &pin_name); } } @@ -911,7 +911,7 @@ static void name_nodes_of_pins_labels_and_propagate() /* name ipin opin label node fields from prop_ptr attributes */ if(inst[i].ptr<0) continue; - my_strdup(248, &type,(inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(inst[i].ptr+ xctx->sym)->type); if(print_erc && (!inst[i].instname || !inst[i].instname[0]) && !get_tok_value((inst[i].ptr+ xctx->sym)->templ, "name", 0)[0] ) { @@ -950,28 +950,28 @@ static void name_nodes_of_pins_labels_and_propagate() strcmp(get_tok_value(inst[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue; } port=0; - my_strdup2(249, &dir, ""); + my_strdup2(_ALLOC_ID_, &dir, ""); if(strcmp(type,"label")) { /* instance is a port (not a label) */ port=1; /* 20071204 only define a dir property if instance is not a label */ if(for_netlist) - my_strdup2(250, &dir, get_tok_value( (inst[i].ptr+ xctx->sym)->rect[PINLAYER][0].prop_ptr, "dir",0)); + my_strdup2(_ALLOC_ID_, &dir, get_tok_value( (inst[i].ptr+ xctx->sym)->rect[PINLAYER][0].prop_ptr, "dir",0)); } else { /* handle global nodes (global=1 set as symbol property) 28032003 */ - my_strdup(251, &global_node,get_tok_value((inst[i].ptr+ xctx->sym)->prop_ptr,"global",0)); + my_strdup(_ALLOC_ID_, &global_node,get_tok_value((inst[i].ptr+ xctx->sym)->prop_ptr,"global",0)); /*20071204 if instance is a label dont define a dir property for more precise erc checking */ } /* obtain ipin/opin/label signal type (default: std_logic) */ if(for_netlist) { - my_strdup(258, &sig_type,get_tok_value(inst[i].prop_ptr,"sig_type",0)); - my_strdup(259, &verilog_type,get_tok_value(inst[i].prop_ptr,"verilog_type",0)); - my_strdup(260, &value,get_tok_value(inst[i].prop_ptr,"value",0)); - my_strdup(261, &class,get_tok_value(inst[i].prop_ptr,"class",0)); + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(inst[i].prop_ptr,"sig_type",0)); + my_strdup(_ALLOC_ID_, &verilog_type,get_tok_value(inst[i].prop_ptr,"verilog_type",0)); + my_strdup(_ALLOC_ID_, &value,get_tok_value(inst[i].prop_ptr,"value",0)); + my_strdup(_ALLOC_ID_, &class,get_tok_value(inst[i].prop_ptr,"class",0)); } - my_strdup(262, &inst[i].node[0], inst[i].lab); + my_strdup(_ALLOC_ID_, &inst[i].node[0], inst[i].lab); if(!(inst[i].node[0])) { - my_strdup(65, &inst[i].node[0], get_tok_value((inst[i].ptr+ xctx->sym)->templ, "lab",0)); + my_strdup(_ALLOC_ID_, &inst[i].node[0], get_tok_value((inst[i].ptr+ xctx->sym)->templ, "lab",0)); dbg(1, "prepare_netlist_structs(): no lab attr on instance, pick from symbol: %s\n", inst[i].node[0]); } /* handle global nodes (global=1 set as symbol property) 28032003 */ @@ -992,14 +992,14 @@ static void name_nodes_of_pins_labels_and_propagate() name_attached_inst(i, x0, y0, sqx, sqy, inst[i].node[0]); } /* if(type && ... */ } /* for(i=0;iwire[i].node, tmp_str); - my_strdup(266, &xctx->wire[i].prop_ptr, subst_token(xctx->wire[i].prop_ptr, "lab", tmp_str)); + my_strdup(_ALLOC_ID_, &xctx->wire[i].node, tmp_str); + my_strdup(_ALLOC_ID_, &xctx->wire[i].prop_ptr, subst_token(xctx->wire[i].prop_ptr, "lab", tmp_str)); /* insert unnamed wire name in hash table */ bus_node_hash_lookup(tmp_str, "", XINSERT, 0,"","","",""); wirecheck(i); @@ -1081,7 +1081,7 @@ static void reset_node_data_and_rehash() (inst[i].ptr+ xctx->sym)->rects[GENERICLAYER]; if(rects > 0) { - inst[i].node = my_malloc(247, sizeof(char *) * rects); + inst[i].node = my_malloc(_ALLOC_ID_, sizeof(char *) * rects); for (j=0;j 0 ) { for(j=0;j< rects ;j++) - my_free(849, &xctx->inst[i].node[j]); - my_free(850, &xctx->inst[i].node ); + my_free(_ALLOC_ID_, &xctx->inst[i].node[j]); + my_free(_ALLOC_ID_, &xctx->inst[i].node ); } } @@ -1151,7 +1151,7 @@ void delete_netlist_structs(void) } for(i=0;iwires;i++) { - my_free(851, &xctx->wire[i].node); + my_free(_ALLOC_ID_, &xctx->wire[i].node); } /* erase inst and wire topological hash tables */ del_inst_pin_table(); @@ -1318,21 +1318,21 @@ int sym_vs_sch_pins() } load_ascii_string(&tmp,fd); symbol = match_symbol(name); - my_strdup(276, &type, xctx->sym[symbol].type); + my_strdup(_ALLOC_ID_, &type, xctx->sym[symbol].type); if(type && IS_PIN(type)) { - my_strdup(292, &lab, expandlabel(get_tok_value(tmp, "lab", 0), &mult)); + my_strdup(_ALLOC_ID_, &lab, expandlabel(get_tok_value(tmp, "lab", 0), &mult)); if(pin_cnt >= lab_array_size) { lab_array_size += CADCHUNKALLOC; - my_realloc(154, &lab_array, lab_array_size * sizeof(char *)); + my_realloc(_ALLOC_ID_, &lab_array, lab_array_size * sizeof(char *)); } lab_array[pin_cnt] = NULL; - my_strdup(155, &(lab_array[pin_cnt]), lab); + my_strdup(_ALLOC_ID_, &(lab_array[pin_cnt]), lab); pin_cnt++; pin_match = 0; for(j=0; j < rects; j++) { - my_strdup(293, &pin_name, + my_strdup(_ALLOC_ID_, &pin_name, expandlabel(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0), &mult)); - my_strdup(294, &pin_dir, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "dir", 0)); + my_strdup(_ALLOC_ID_, &pin_dir, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "dir", 0)); if( pin_name && !strcmp(pin_name, lab)) { if(!( ( !strcmp(type, "ipin") && !strcmp(pin_dir, "in") ) || @@ -1406,7 +1406,7 @@ int sym_vs_sch_pins() } } for(j=0; j < rects; j++) { - my_strdup(295, &pin_name, + my_strdup(_ALLOC_ID_, &pin_name, expandlabel(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0), &mult)); pin_match = 0; for(k=0; ksymbols > n_syms) remove_symbol(xctx->symbols - 1); diff --git a/src/node_hash.c b/src/node_hash.c index cb975d95..c412da84 100644 --- a/src/node_hash.c +++ b/src/node_hash.c @@ -59,16 +59,16 @@ static Node_hashentry *node_hash_lookup(const char *token, const char *dir,int w if( what==XINSERT ) /* insert data */ { s=sizeof( Node_hashentry ); - entry=(Node_hashentry *)my_malloc(281, s); + entry=(Node_hashentry *)my_malloc(_ALLOC_ID_, s); entry->next = NULL; entry->token = entry->sig_type = entry->verilog_type = entry->value = entry->class = entry->orig_tok = NULL; - my_strdup(282, &(entry->token),token); - if(sig_type &&sig_type[0]) my_strdup(283, &(entry->sig_type), sig_type); - if(verilog_type &&verilog_type[0]) my_strdup(284, &(entry->verilog_type), verilog_type); - if(class && class[0]) my_strdup(285, &(entry->class), class); - if(orig_tok && orig_tok[0]) my_strdup(286, &(entry->orig_tok), orig_tok); - if(value && value[0]) my_strdup(287, &(entry->value), value); + my_strdup(_ALLOC_ID_, &(entry->token),token); + if(sig_type &&sig_type[0]) my_strdup(_ALLOC_ID_, &(entry->sig_type), sig_type); + if(verilog_type &&verilog_type[0]) my_strdup(_ALLOC_ID_, &(entry->verilog_type), verilog_type); + if(class && class[0]) my_strdup(_ALLOC_ID_, &(entry->class), class); + if(orig_tok && orig_tok[0]) my_strdup(_ALLOC_ID_, &(entry->orig_tok), orig_tok); + if(value && value[0]) my_strdup(_ALLOC_ID_, &(entry->value), value); entry->d.port=d.port; entry->d.in=d.in; entry->d.out=d.out; @@ -87,13 +87,13 @@ static Node_hashentry *node_hash_lookup(const char *token, const char *dir,int w if(what==XDELETE) /* remove token from the hash table ... */ { saveptr=entry->next; - my_free(854, &entry->token); - my_free(855, &entry->verilog_type); - my_free(856, &entry->sig_type); - my_free(857, &entry->class); - my_free(858, &entry->orig_tok); - my_free(859, &entry->value); - my_free(860, &entry); + my_free(_ALLOC_ID_, &entry->token); + my_free(_ALLOC_ID_, &entry->verilog_type); + my_free(_ALLOC_ID_, &entry->sig_type); + my_free(_ALLOC_ID_, &entry->class); + my_free(_ALLOC_ID_, &entry->orig_tok); + my_free(_ALLOC_ID_, &entry->value); + my_free(_ALLOC_ID_, &entry); *preventry=saveptr; return NULL; } @@ -104,11 +104,11 @@ static Node_hashentry *node_hash_lookup(const char *token, const char *dir,int w entry->d.out+=d.out; entry->d.inout+=d.inout; if(sig_type && sig_type[0] !='\0') - my_strdup(288, &(entry->sig_type), sig_type); + my_strdup(_ALLOC_ID_, &(entry->sig_type), sig_type); if(verilog_type && verilog_type[0] !='\0') - my_strdup(289, &(entry->verilog_type), verilog_type); + my_strdup(_ALLOC_ID_, &(entry->verilog_type), verilog_type); if(value && value[0] !='\0') - my_strdup(290, &(entry->value), value); + my_strdup(_ALLOC_ID_, &(entry->value), value); dbg(3, "node_hash_lookup(): hashing %s : value=%s\n\n", entry->token, entry->value? entry->value:"NULL"); return entry; @@ -132,12 +132,12 @@ Node_hashentry *bus_node_hash_lookup(const char *token, const char *dir, int wha if(token==NULL || token[0] == 0) return NULL; if( token[0] == '#') { - my_strdup(279, &string, token); + my_strdup(_ALLOC_ID_, &string, token); } else { dbg(3, "bus_node_hash_lookup(): expanding node: %s\n", token); - my_strdup(280, &string, expandlabel(token,&mult)); + my_strdup(_ALLOC_ID_, &string, expandlabel(token,&mult)); dbg(3, "bus_node_hash_lookup(): done expanding node: %s\n", token); } if(string==NULL) return NULL; @@ -159,7 +159,7 @@ Node_hashentry *bus_node_hash_lookup(const char *token, const char *dir, int wha string_ptr++; } /* if something found return first pointer */ - my_free(853, &string); + my_free(_ALLOC_ID_, &string); return ptr2; } @@ -169,13 +169,13 @@ static void node_hash_free_entry(Node_hashentry *entry) while(entry) { tmp = entry->next; - my_free(861, &entry->token); - my_free(862, &entry->verilog_type); - my_free(863, &entry->sig_type); - my_free(864, &entry->class); - my_free(865, &entry->orig_tok); - my_free(866, &entry->value); - my_free(867, &entry); + my_free(_ALLOC_ID_, &entry->token); + my_free(_ALLOC_ID_, &entry->verilog_type); + my_free(_ALLOC_ID_, &entry->sig_type); + my_free(_ALLOC_ID_, &entry->class); + my_free(_ALLOC_ID_, &entry->orig_tok); + my_free(_ALLOC_ID_, &entry->value); + my_free(_ALLOC_ID_, &entry); entry = tmp; } } @@ -278,9 +278,9 @@ void print_vhdl_signals(FILE *fd) dbg(2, "print_vhdl_signals(): node: %s mult: %d value=%s \n\n", ptr->token,mult, ptr->value?ptr->value:"NULL"); if( ptr->class && ptr->class[0] ) - my_strdup(277, &class, ptr->class); + my_strdup(_ALLOC_ID_, &class, ptr->class); else - my_strdup(278, &class, "signal"); + my_strdup(_ALLOC_ID_, &class, "signal"); if(mult>1) { for(j=mult-1;j>=0;j--) { fprintf(fd, "%s %s[%d] : ", class, ptr->token[0]=='#' ? ptr->token+1 : ptr->token,j); @@ -310,7 +310,7 @@ void print_vhdl_signals(FILE *fd) } } if(found) fprintf(fd, "\n" ); - my_free(852, &class); + my_free(_ALLOC_ID_, &class); } diff --git a/src/options.c b/src/options.c index 165610a1..9b0461f2 100644 --- a/src/options.c +++ b/src/options.c @@ -71,11 +71,11 @@ static void check_opt(char *opt, char *optval, int type) } else if( (type == LONG && !strcmp("preinit", opt)) ) { dbg(1, "process_options(): passing tcl command to interpreter: %s\n", optval); - if(optval) my_strdup(1565, &cli_opt_preinit_command, optval); + if(optval) my_strdup(_ALLOC_ID_, &cli_opt_preinit_command, optval); } else if( (type == LONG && !strcmp("tcl", opt)) ) { dbg(1, "process_options(): passing tcl command to interpreter: %s\n", optval); - if(optval) my_strdup(110, &cli_opt_tcl_command, optval); + if(optval) my_strdup(_ALLOC_ID_, &cli_opt_tcl_command, optval); } else if( (type == LONG && !strcmp("script", opt)) ) { dbg(1, "process_options(): passing tcl script file to interpreter: %s\n", optval); @@ -83,7 +83,7 @@ static void check_opt(char *opt, char *optval, int type) } else if( (type == LONG && !strcmp("command", opt)) ) { dbg(1, "process_options(): passing tcl command to interpreter: %s\n", optval); - if(optval) my_strdup(661, &cli_opt_tcl_post_command, optval); + if(optval) my_strdup(_ALLOC_ID_, &cli_opt_tcl_post_command, optval); } else if( (type == LONG && !strcmp("diff", opt)) ) { dbg(1, "process_options(): diff with: %s\n", optval); diff --git a/src/parselabel.l b/src/parselabel.l index d642fc24..aedb4931 100644 --- a/src/parselabel.l +++ b/src/parselabel.l @@ -66,7 +66,7 @@ extern int yylex(); void clear_expandlabel_data(void) { - my_free(868, &dest_string.str); + my_free(_ALLOC_ID_, &dest_string.str); } static void str_char_replace(char s[], char chr, char repl_chr) @@ -95,7 +95,7 @@ void parse(const char *s) const char *expandlabel(const char *s, int *m) { YY_BUFFER_STATE buf; - my_free(869, &dest_string.str); /* 30102004 delete 'memory' of previous execution */ + my_free(_ALLOC_ID_, &dest_string.str); /* 30102004 delete 'memory' of previous execution */ if(dbg_var >= 3) fprintf(errfp, "expandlabel(): entering\n"); buf=yy_scan_string(s); @@ -106,13 +106,13 @@ const char *expandlabel(const char *s, int *m) size_t l; yyparse_error = -1; l = strlen(s)+400; - cmd = my_malloc(526, l); + cmd = my_malloc(_ALLOC_ID_, l); fprintf(errfp, "syntax error in %s\n", s); my_snprintf(cmd, l, "tk_messageBox -icon error -type ok -parent [xschem get topwindow] " "-message {Syntax error in identifier expansion: %s\nschematic:\n%s}", s, xctx->sch[xctx->currsch]); if(has_x) tcleval(cmd); - my_free(543, &cmd); + my_free(_ALLOC_ID_, &cmd); } if(dbg_var >= 3) @@ -209,14 +209,14 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z /* recognize AA[aa:bb:33] or AA[33:cc:dd] or AA[aa..bb..11] .... */ ({IDX_ID}{DDOT}{IDX_ID_N}{DDOT}{IDX_ID_N})|({IDX_ID_N}{DDOT}{IDX_ID}{DDOT}{IDX_ID_N})|({IDX_ID_N}{DDOT}{IDX_ID_N}{DDOT}{IDX_ID}) { yylval.ptr.str=NULL; - my_strdup(428, &yylval.ptr.str, yytext); + my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); if(dbg_var >= 3) fprintf(errfp, "yylex(): B_NAME3: |%s|\n", yytext); return B_NAME; } ({IDX_ID}{CLN}{IDX_ID_N}{CLN}{IDX_ID_N})|({IDX_ID_N}{CLN}{IDX_ID}{CLN}{IDX_ID_N})|({IDX_ID_N}{CLN}{IDX_ID_N}{CLN}{IDX_ID}) { yylval.ptr.str=NULL; - my_strdup(430, &yylval.ptr.str, yytext); + my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); if(dbg_var >= 3) fprintf(errfp, "yylex(): B_NAME2: |%s|\n", yytext); return B_NAME; } @@ -224,7 +224,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z /* recognize AA[width-1:0], AA[0:width-1], AA[width-1..4], AA[3..width+3], AA[aa:bb] AA[aa..bb] */ ({IDX_ID}{CLN}{IDX_ID_N})|({IDX_ID_N}{CLN}{IDX_ID})|({IDX_ID}{DDOT}{IDX_ID_N})|({IDX_ID_N}{DDOT}{IDX_ID}) { yylval.ptr.str=NULL; - my_strdup(92, &yylval.ptr.str, yytext); + my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); if(dbg_var >= 3) fprintf(errfp, "yylex(): B_NAME1: |%s|\n", yytext); return B_NAME; } @@ -234,7 +234,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z ^\*.* { yylval.ptr.str=NULL; /*19102004 */ if(dbg_var >= 3) fprintf(errfp, "yylex(): B_LINE: |%s|\n",yytext); - my_strdup(299, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */ + my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */ BEGIN(INITIAL); return B_LINE; } @@ -248,7 +248,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z /* a number: if not a multiplier nor a node index return as a node name */ {INT} { yylval.ptr.str=NULL; - my_strdup(120, &yylval.ptr.str, yytext); + my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); if(dbg_var >= 3) fprintf(errfp, "yylex(): B_NAME4: |%s|\n", yytext); BEGIN(INITIAL); return B_NAME; @@ -267,7 +267,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z /* recognize the most esotheric identifiers */ {ID_NUM}|{ID_EXT_PARENTHESIS} { yylval.ptr.str=NULL;/*19102004 */ - my_strdup(300, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */ + my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */ if(dbg_var >= 3) fprintf(errfp, "yylex(): B_NAME0: |%s|\n", yytext); BEGIN(INITIAL); return B_NAME; diff --git a/src/paste.c b/src/paste.c index 5861c975..af2b46be 100644 --- a/src/paste.c +++ b/src/paste.c @@ -46,7 +46,7 @@ static void merge_text(FILE *fd) xctx->text[i].font=NULL; xctx->text[i].sel=0; load_ascii_string(&xctx->text[i].prop_ptr,fd); - my_strdup(302, &xctx->text[i].font, get_tok_value(xctx->text[i].prop_ptr, "font", 0)); + my_strdup(_ALLOC_ID_, &xctx->text[i].font, get_tok_value(xctx->text[i].prop_ptr, "font", 0)); str = get_tok_value(xctx->text[i].prop_ptr, "hcenter", 0); @@ -85,7 +85,7 @@ static void merge_wire(FILE *fd) } load_ascii_string( &ptr, fd); storeobject(-1, x1,y1,x2,y2,WIRE,0,SELECTED,ptr); - my_free(870, &ptr); + my_free(_ALLOC_ID_, &ptr); select_wire(i, SELECTED, 1); } @@ -198,17 +198,17 @@ static void merge_polygon(FILE *fd) ptr[i].y=NULL; ptr[i].selected_point=NULL; ptr[i].prop_ptr=NULL; - ptr[i].x = my_calloc(303, points, sizeof(double)); - ptr[i].y = my_calloc(304, points, sizeof(double)); - ptr[i].selected_point= my_calloc(305, points, sizeof(unsigned short)); + ptr[i].x = my_calloc(_ALLOC_ID_, points, sizeof(double)); + ptr[i].y = my_calloc(_ALLOC_ID_, points, sizeof(double)); + ptr[i].selected_point= my_calloc(_ALLOC_ID_, points, sizeof(unsigned short)); ptr[i].points=points; ptr[i].sel=0; for(j=0;jinst[i].name, rel_sym_path(tmp)); - else my_strdup(755, &xctx->inst[i].name,tmp); + if(tmp[0] == '/') my_strdup(_ALLOC_ID_, &xctx->inst[i].name, rel_sym_path(tmp)); + else my_strdup(_ALLOC_ID_, &xctx->inst[i].name,tmp); #else - my_strdup(780, &xctx->inst[i].name, rel_sym_path(tmp)); + my_strdup(_ALLOC_ID_, &xctx->inst[i].name, rel_sym_path(tmp)); #endif - my_free(756, &tmp); + my_free(_ALLOC_ID_, &tmp); if(fscanf(fd, "%lf %lf %hd %hd",&xctx->inst[i].x0, &xctx->inst[i].y0,&xctx->inst[i].rot, &xctx->inst[i].flip) < 4) { fprintf(errfp,"WARNING: missing fields for INSTANCE object, ignoring.\n"); read_line(fd, 0); @@ -305,7 +305,7 @@ static void merge_inst(int k,FILE *fd) if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr,"highlight",0), "true")) xctx->inst[i].flags |= HILIGHT_CONN; xctx->inst[i].embed = !strcmp(get_tok_value(xctx->inst[i].prop_ptr, "embed", 2), "true"); - my_free(871, &prop_ptr); + my_free(_ALLOC_ID_, &prop_ptr); xctx->instances++; set_modify(1); } @@ -428,7 +428,7 @@ void merge_file(int selection_load, const char ext[]) xctx->mousex_snap = 0.; xctx->mousey_snap = 0.; } - my_free(875, &aux_ptr); + my_free(_ALLOC_ID_, &aux_ptr); link_symbols_to_instances(old); /* in case of paste/merge will set instances .sel to SELECTED */ fclose(fd); xctx->ui_state |= STARTMERGE; diff --git a/src/psprint.c b/src/psprint.c index a7fe6f11..f1d0a0a4 100644 --- a/src/psprint.c +++ b/src/psprint.c @@ -135,8 +135,8 @@ void ps_drawPNG(xRect* r, double x1, double y1, double x2, double y2, int rot, i quality_attr = get_tok_value(r->prop_ptr, "jpg_quality", 0); if(quality_attr[0]) quality = atoi(quality_attr); } - my_strdup(59, &filter, get_tok_value(r->prop_ptr, "filter", 0)); - image_data_len = my_strdup2(1183, &image_data64_ptr, get_tok_value(r->prop_ptr, "image_data", 0)); + my_strdup(_ALLOC_ID_, &filter, get_tok_value(r->prop_ptr, "filter", 0)); + image_data_len = my_strdup2(_ALLOC_ID_, &image_data64_ptr, get_tok_value(r->prop_ptr, "image_data", 0)); if (filter) { size_t filtersize = 0; @@ -144,13 +144,13 @@ void ps_drawPNG(xRect* r, double x1, double y1, double x2, double y2, int rot, i closure.buffer = NULL; filterdata = (char*)base64_decode(image_data64_ptr, image_data_len, &filtersize); filter_data(filterdata, filtersize, (char**)&closure.buffer, &data_size, filter); - my_free(1661, &filterdata); + my_free(_ALLOC_ID_, &filterdata); } else { closure.buffer = base64_decode(image_data64_ptr, image_data_len, &data_size); } - my_free(1664, &filter); - my_free(1184, &image_data64_ptr); + my_free(_ALLOC_ID_, &filter); + my_free(_ALLOC_ID_, &image_data64_ptr); closure.pos = 0; closure.size = data_size; /* should not be necessary */ surface = cairo_image_surface_create_from_png_stream(png_reader, &closure); @@ -159,7 +159,7 @@ void ps_drawPNG(xRect* r, double x1, double y1, double x2, double y2, int rot, i png_size_y = cairo_image_surface_get_height(surface); cairo_surface_flush(surface); - my_free(1667, &closure.buffer); + my_free(_ALLOC_ID_, &closure.buffer); png_data = cairo_image_surface_get_data(surface); invertImage = !strcmp(get_tok_value(r->prop_ptr, "InvertOnExport", 0), "true"); @@ -251,7 +251,7 @@ void ps_drawPNG(xRect* r, double x1, double y1, double x2, double y2, int rot, i fprintf(fd, "grestore\n"); cairo_surface_destroy(surface); - my_free(1663, &ascii85EncodedJpeg); + my_free(_ALLOC_ID_, &ascii85EncodedJpeg); free(jpgData); #endif } @@ -381,7 +381,7 @@ void ps_embedded_graph(xRect* r, double rx1, double ry1, double rx2, double ry2) fprintf(fd, "grestore\n"); - my_free(1666, &ascii85EncodedJpeg); + my_free(_ALLOC_ID_, &ascii85EncodedJpeg); #endif } @@ -675,7 +675,7 @@ static void ps_draw_string(int layer, const char *str, short rot, short flip, in if(rot == 3 && flip == 1 ) { x=textx1;} } llength=0; - my_strdup2(54, &sss, str); + my_strdup2(_ALLOC_ID_, &sss, str); tt=ss=sss; for(;;) { c=*ss; @@ -693,7 +693,7 @@ static void ps_draw_string(int layer, const char *str, short rot, short flip, in } ss++; } - my_free(53, &sss); + my_free(_ALLOC_ID_, &sss); } static void old_ps_draw_string(int gctext, const char *str, @@ -858,16 +858,16 @@ static void ps_draw_symbol(int n,int layer, int what, short tmp_flip, short rot, polygon = ((xctx->inst[n].ptr+ xctx->sym)->poly[layer])[j]; { /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */ int k; - double *x = my_malloc(309, sizeof(double) * polygon.points); - double *y = my_malloc(310, sizeof(double) * polygon.points); + double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon.points); + double *y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon.points); for(k=0;k 0) { *olen += n; @@ -147,14 +147,14 @@ int filter_data(const char *din, const size_t ilen, oalloc = *olen + bufsize + 1; /* add extra space for final '\0' */ oalloc = ((oalloc << 2) + oalloc) >> 2; /* size up 1.25x */ dbg(1, "filter_data() read %ld bytes, reallocate dout to %ld bytes, bufsize=%ld\n", n, oalloc, bufsize); - my_realloc(1482, dout, oalloc); + my_realloc(_ALLOC_ID_, dout, oalloc); } } if(*olen) (*dout)[*olen] = '\0'; /* so (if ascii) it can be used as a string */ } if(n < 0 || !*olen) { if(oalloc) { - my_free(1483, dout); + my_free(_ALLOC_ID_, dout); *olen = 0; } fprintf(stderr, "no data read\n"); @@ -202,7 +202,7 @@ char *base64_encode(const unsigned char *data, const size_t input_length, size_t *output_length = 4 * ((input_length + 2) / 3); alloc_length = (1 + (*output_length / 4096)) * 4096; - encoded_data = my_malloc(1665, alloc_length); + encoded_data = my_malloc(_ALLOC_ID_, alloc_length); if (encoded_data == NULL) return NULL; cnt = 0; @@ -214,7 +214,7 @@ char *base64_encode(const unsigned char *data, const size_t input_length, size_t if(j + 10 >= alloc_length) { dbg(1, "alloc-length=%ld, j=%d, output_length=%ld\n", alloc_length, j, *output_length); alloc_length += 4096; - my_realloc(1471, &encoded_data, alloc_length); + my_realloc(_ALLOC_ID_, &encoded_data, alloc_length); } if(brk && ( (cnt & 31) == 0) ) { *output_length += 1; @@ -261,7 +261,7 @@ unsigned char *base64_decode(const char *data, const size_t input_length, size_t padding = 0; if (data[input_length - 1] == '=') padding++; if (data[input_length - 2] == '=') padding++; - decoded_data = my_malloc(1470, *output_length); + decoded_data = my_malloc(_ALLOC_ID_, *output_length); if (decoded_data == NULL) return NULL; cnt = 0; for (i = 0, j = 0; i < input_length;) { @@ -304,12 +304,12 @@ unsigned char *ascii85_encode(const unsigned char *data, const size_t input_leng int padding = (4-(input_length % 4))%4; static u_int32_t pow85[] = {1, 85, 7225, 614125, 52200625}; - unsigned char *paddedData = my_calloc(1469, input_length+padding, 1); + unsigned char *paddedData = my_calloc(_ALLOC_ID_, input_length+padding, 1); unsigned char *encoded_data; int i, idx = 0; memcpy( paddedData, data, input_length); *output_length = 5*(input_length+padding)/4; - encoded_data = my_malloc(1662, *output_length +1); + encoded_data = my_malloc(_ALLOC_ID_, *output_length +1); encoded_data[*output_length]=0; for (i = 0; i < input_length+padding; i+=4) { @@ -342,7 +342,7 @@ unsigned char *ascii85_encode(const unsigned char *data, const size_t input_leng encoded_data[idx]=b85_enc[encoded_data[idx]]; idx++; } - my_free(1668, &paddedData); + my_free(_ALLOC_ID_, &paddedData); *output_length-=padding; encoded_data[*output_length]=0; return encoded_data; @@ -367,11 +367,11 @@ static void read_binary_block(FILE *fd) } /* read buffer */ - tmp = my_calloc(1405, xctx->graph_nvars, (sizeof(double *) )); + tmp = my_calloc(_ALLOC_ID_, xctx->graph_nvars, (sizeof(double *) )); /* allocate storage for binary block, add one data column for custom data plots */ - if(!xctx->graph_values) xctx->graph_values = my_calloc(118, xctx->graph_nvars + 1, sizeof(SPICE_DATA *)); + if(!xctx->graph_values) xctx->graph_values = my_calloc(_ALLOC_ID_, xctx->graph_nvars + 1, sizeof(SPICE_DATA *)); for(p = 0 ; p <= xctx->graph_nvars; p++) { - my_realloc(372, + my_realloc(_ALLOC_ID_, &xctx->graph_values[p], (offset + xctx->graph_npoints[xctx->graph_datasets]) * sizeof(SPICE_DATA)); } /* read binary block */ @@ -399,7 +399,7 @@ static void read_binary_block(FILE *fd) xctx->graph_values[v][offset + p] = (float)tmp[v]; } } - my_free(1406, &tmp); + my_free(_ALLOC_ID_, &tmp); } /* parse ascii raw header section: @@ -436,7 +436,7 @@ static int read_dataset(FILE *fd, const char *type) xctx->graph_sim_type = NULL; dbg(1, "read_dataset(): type=%s\n", type ? type : ""); while((line = my_fgets(fd))) { - my_strdup2(971, &lowerline, line); + my_strdup2(_ALLOC_ID_, &lowerline, line); strtolower(lowerline); /* this is an ASCII raw file. We don't handle this (yet) */ if(!strcmp(line, "Values:\n") || !strcmp(line, "Values:\r\n")) { @@ -514,7 +514,7 @@ static int read_dataset(FILE *fd, const char *type) return 1; } if(xctx->graph_sim_type) { - my_realloc(1414, &xctx->graph_npoints, (xctx->graph_datasets+1) * sizeof(int)); + my_realloc(_ALLOC_ID_, &xctx->graph_npoints, (xctx->graph_datasets+1) * sizeof(int)); xctx->graph_npoints[xctx->graph_datasets] = npoints; /* multi-point OP is equivalent to a DC sweep. Change xctx->graph_sim_type */ if(xctx->graph_npoints[xctx->graph_datasets] > 1 && !strcmp(xctx->graph_sim_type, "op") ) { @@ -551,7 +551,7 @@ static int read_dataset(FILE *fd, const char *type) return 1; } if(xctx->graph_sim_type) { - my_realloc(1415, &xctx->graph_npoints, (xctx->graph_datasets+1) * sizeof(int)); + my_realloc(_ALLOC_ID_, &xctx->graph_npoints, (xctx->graph_datasets+1) * sizeof(int)); xctx->graph_npoints[xctx->graph_datasets] = npoints; /* multi-point OP is equivalent to a DC sweep. Change xctx->graph_sim_type */ if(xctx->graph_npoints[xctx->graph_datasets] > 1 && !strcmp(xctx->graph_sim_type, "op") ) { @@ -561,8 +561,8 @@ static int read_dataset(FILE *fd, const char *type) } if(xctx->graph_sim_type && !done_header && variables) { /* get the list of lines with index and node name */ - if(!xctx->graph_names) xctx->graph_names = my_calloc(426, xctx->graph_nvars, sizeof(char *)); - my_realloc(1249, &varname, strlen(line) + 1) ; + if(!xctx->graph_names) xctx->graph_names = my_calloc(_ALLOC_ID_, xctx->graph_nvars, sizeof(char *)); + my_realloc(_ALLOC_ID_, &varname, strlen(line) + 1) ; n = sscanf(line, "%d %s", &i, varname); /* read index and name of saved waveform */ if(n < 2) { dbg(0, "read_dataset(): WAARNING: malformed raw file, aborting\n"); @@ -595,10 +595,10 @@ static int read_dataset(FILE *fd, const char *type) if(xctx->graph_sim_type && !strncmp(line, "Variables:", 10)) { variables = 1 ; } - my_free(969, &line); + my_free(_ALLOC_ID_, &line); } /* while((line = my_fgets(fd)) */ - my_free(1248, &lowerline); - my_free(1382, &varname); + my_free(_ALLOC_ID_, &lowerline); + my_free(_ALLOC_ID_, &varname); if(exit_status == 0 && xctx->graph_datasets && xctx->graph_npoints) { dbg(dbglev, "raw file read: datasets=%d, last dataset points=%d, nvars=%d\n", xctx->graph_datasets, xctx->graph_npoints[xctx->graph_datasets-1], xctx->graph_nvars); @@ -615,21 +615,21 @@ void free_rawfile(int dr) if(xctx->graph_names) { deleted = 1; for(i = 0 ; i < xctx->graph_nvars; i++) { - my_free(510, &xctx->graph_names[i]); + my_free(_ALLOC_ID_, &xctx->graph_names[i]); } - my_free(968, &xctx->graph_names); + my_free(_ALLOC_ID_, &xctx->graph_names); } if(xctx->graph_values) { deleted = 1; /* free also extra column for custom data plots */ for(i = 0 ; i <= xctx->graph_nvars; i++) { - my_free(512, &xctx->graph_values[i]); + my_free(_ALLOC_ID_, &xctx->graph_values[i]); } - my_free(528, &xctx->graph_values); + my_free(_ALLOC_ID_, &xctx->graph_values); } - if(xctx->graph_npoints) my_free(1413, &xctx->graph_npoints); + if(xctx->graph_npoints) my_free(_ALLOC_ID_, &xctx->graph_npoints); xctx->graph_allpoints = 0; - if(xctx->graph_raw_schname) my_free(1393, &xctx->graph_raw_schname); + if(xctx->graph_raw_schname) my_free(_ALLOC_ID_, &xctx->graph_raw_schname); xctx->graph_raw_level = -1; tclsetintvar("graph_raw_level", -1); xctx->graph_datasets = 0; @@ -652,11 +652,11 @@ char *base64_from_file(const char *f, size_t *length) len = st.st_size; fd = fopen(f, fopen_read_mode); if(fd) { - s = my_malloc(1475, len); + s = my_malloc(_ALLOC_ID_, len); fread(s, len, 1, fd); fclose(fd); b64s = base64_encode(s, len, length, 1); - my_free(1477, &s); + my_free(_ALLOC_ID_, &s); } else { dbg(0, "base64_from_file(): failed to open file %s for reading\n", f); @@ -688,7 +688,7 @@ int raw_read_from_attr(const char *type) s = base64_decode(b64_spice_data, length, &decoded_length); fwrite(s, decoded_length, 1, fd); fclose(fd); - my_free(1479, &s); + my_free(_ALLOC_ID_, &s); res = raw_read(tmp_filename, type); unlink(tmp_filename); } else { @@ -713,7 +713,7 @@ int raw_read(const char *f, const char *type) if(fd) { if((res = read_dataset(fd, type)) == 1) { int i; - my_strdup2(1394, &xctx->graph_raw_schname, xctx->sch[xctx->currsch]); + my_strdup2(_ALLOC_ID_, &xctx->graph_raw_schname, xctx->sch[xctx->currsch]); xctx->graph_raw_level = xctx->currsch; tclsetintvar("graph_raw_level", xctx->currsch); xctx->graph_allpoints = 0; @@ -784,18 +784,18 @@ static double ravg_store(int what , int i, int p, int last, double value) } else if(what == 1) { if(i >= imax) { int new_size = i + 4; - my_realloc(1514, &arr, sizeof(double *) * new_size); + my_realloc(_ALLOC_ID_, &arr, sizeof(double *) * new_size); for(j = imax; j < new_size; j++) { - arr[j] = my_calloc(1515, last + 1, sizeof(double)); + arr[j] = my_calloc(_ALLOC_ID_, last + 1, sizeof(double)); } imax = new_size; } arr[i][p] = value; } else if(what == 0 && imax) { for(j = 0; j < imax; j++) { - my_free(1512, &arr[j]); + my_free(_ALLOC_ID_, &arr[j]); } - my_free(1513, &arr); + my_free(_ALLOC_ID_, &arr); imax = 0; } return 0.0; @@ -853,13 +853,13 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr) SPICE_DATA *x = xctx->graph_values[sweep_idx]; SPICE_DATA *sweepx = xctx->graph_values[0]; - my_strdup2(574, &ntok_copy, expr); + my_strdup2(_ALLOC_ID_, &ntok_copy, expr); ntok_ptr = ntok_copy; dbg(1, "plot_raw_custom_data(): expr=%s\n", expr); while( (n = my_strtok_r(ntok_ptr, " \t\n", "", &ntok_save)) ) { if(stackptr1 >= STACKMAX -2) { dbg(0, "stack overflow in graph expression parsing. Interrupted\n"); - my_free(576, &ntok_copy); + my_free(_ALLOC_ID_, &ntok_copy); return -1; } ntok_ptr = NULL; @@ -913,7 +913,7 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr) idx = get_raw_index(n); if(idx == -1) { dbg(1, "plot_raw_custom_data(): no data found: %s\n", n); - my_free(645, &ntok_copy); + my_free(_ALLOC_ID_, &ntok_copy); return -1; /* no data found in raw file */ } stack1[stackptr1].i = SPICE_NODE; @@ -922,7 +922,7 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr) } dbg(1, " plot_raw_custom_data(): stack1= %d\n", stack1[stackptr1 - 1].i); } /* while(n = my_strtok_r(...) */ - my_free(575, &ntok_copy); + my_free(_ALLOC_ID_, &ntok_copy); for(p = first ; p <= last; p++) { stackptr2 = 0; for(i = 0; i < stackptr1; i++) { @@ -1254,7 +1254,7 @@ void read_record(int firstchar, FILE *fp, int dbg_level) } } dbg(dbg_level, "END SKIP RECORD\n"); - my_free(881, &str); + my_free(_ALLOC_ID_, &str); } /* skip line of text from file, stopping before '\n' or EOF */ @@ -1383,7 +1383,7 @@ void save_ascii_string(const char *ptr, FILE *fd, int newline) if(ptr == NULL) { if( fd == NULL) { /* used to clear static data */ - my_free(139, &strbuf); + my_free(_ALLOC_ID_, &strbuf); strbuf_size = 0; return; } @@ -1392,11 +1392,11 @@ void save_ascii_string(const char *ptr, FILE *fd, int newline) return; } len = strlen(ptr) + CADCHUNKALLOC; - if(strbuf_size < len ) my_realloc(140, &strbuf, (strbuf_size = len)); + if(strbuf_size < len ) my_realloc(_ALLOC_ID_, &strbuf, (strbuf_size = len)); strbuf[strbuf_pos++] = '{'; while( (c = *ptr++) ) { - if(strbuf_pos > strbuf_size - 6) my_realloc(525, &strbuf, (strbuf_size += CADCHUNKALLOC)); + if(strbuf_pos > strbuf_size - 6) my_realloc(_ALLOC_ID_, &strbuf, (strbuf_size += CADCHUNKALLOC)); if( c=='\\' || c=='{' || c=='}') strbuf[strbuf_pos++] = '\\'; strbuf[strbuf_pos++] = (char)c; } @@ -1486,15 +1486,15 @@ static void save_inst(FILE *fd, int select_only) inst=xctx->inst; oldversion = !strcmp(xctx->file_version, "1.0"); for(i=0;isymbols;i++) xctx->sym[i].flags &=~EMBEDDED; - embedded_saved = my_calloc(663, xctx->symbols, sizeof(int)); + embedded_saved = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(int)); for(i=0;iinstances;i++) { if (select_only && inst[i].sel != SELECTED) continue; fputs("C ", fd); if(oldversion) { - my_strdup2(57, &tmp, add_ext(inst[i].name, ".sym")); + my_strdup2(_ALLOC_ID_, &tmp, add_ext(inst[i].name, ".sym")); save_ascii_string(tmp, fd, 0); - my_free(882, &tmp); + my_free(_ALLOC_ID_, &tmp); } else { save_ascii_string(inst[i].name, fd, 0); } @@ -1508,7 +1508,7 @@ static void save_inst(FILE *fd, int select_only) xctx->sym[inst[i].ptr].flags |= EMBEDDED; } } - my_free(539, &embedded_saved); + my_free(_ALLOC_ID_, &embedded_saved); } static void save_wire(FILE *fd, int select_only) @@ -1620,12 +1620,12 @@ static void write_xschem_file(FILE *fd) size_t tmpstring_size; char *header_ptr = xctx->header_text ? xctx->header_text : ""; tmpstring_size = strlen(header_ptr) + 100; - tmpstring = my_malloc(1652, tmpstring_size); + tmpstring = my_malloc(_ALLOC_ID_, tmpstring_size); my_snprintf(tmpstring, tmpstring_size, "xschem version=%s file_version=%s\n%s", XSCHEM_VERSION, XSCHEM_FILE_VERSION, header_ptr); fprintf(fd, "v "); save_ascii_string(tmpstring, fd, 1); - my_free(1653, &tmpstring); + my_free(_ALLOC_ID_, &tmpstring); if(xctx->schvhdlprop && !xctx->schsymbolprop) { get_tok_value(xctx->schvhdlprop,"type",0); @@ -1686,7 +1686,7 @@ static void load_text(FILE *fd) xctx->text[i].sel=0; load_ascii_string(&xctx->text[i].prop_ptr,fd); if( xctx->text[i].prop_ptr) - my_strdup(318, &xctx->text[i].font, get_tok_value(xctx->text[i].prop_ptr, "font", 0)); + my_strdup(_ALLOC_ID_, &xctx->text[i].font, get_tok_value(xctx->text[i].prop_ptr, "font", 0)); str = get_tok_value(xctx->text[i].prop_ptr, "hcenter", 0); xctx->text[i].hcenter = strcmp(str, "true") ? 0 : 1; @@ -1750,12 +1750,12 @@ static void load_inst(int k, FILE *fd) xctx->inst[i].name=NULL; /* avoid as much as possible calls to rel_sym_path (slow) */ #ifdef __unix__ - if(name[0] == '/') my_strdup2(56, &xctx->inst[i].name, rel_sym_path(name)); - else my_strdup2(762, &xctx->inst[i].name, name); + if(name[0] == '/') my_strdup2(_ALLOC_ID_, &xctx->inst[i].name, rel_sym_path(name)); + else my_strdup2(_ALLOC_ID_, &xctx->inst[i].name, name); #else - my_strdup2(777, &xctx->inst[i].name, rel_sym_path(name)); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].name, rel_sym_path(name)); #endif - my_free(884, &tmp); + my_free(_ALLOC_ID_, &tmp); if(fscanf(fd, "%lf %lf %hd %hd", &xctx->inst[i].x0, &xctx->inst[i].y0, &xctx->inst[i].rot, &xctx->inst[i].flip) < 4) { fprintf(errfp,"WARNING: missing fields for INSTANCE object, ignoring.\n"); @@ -1770,8 +1770,8 @@ static void load_inst(int k, FILE *fd) xctx->inst[i].lab=NULL; /* assigned in link_symbols_to_instances */ xctx->inst[i].node=NULL; load_ascii_string(&prop_ptr,fd); - my_strdup(319, &xctx->inst[i].prop_ptr, prop_ptr); - my_strdup2(320, &xctx->inst[i].instname, get_tok_value(xctx->inst[i].prop_ptr, "name", 0)); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, prop_ptr); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].instname, get_tok_value(xctx->inst[i].prop_ptr, "name", 0)); if(!strcmp(get_tok_value(xctx->inst[i].prop_ptr,"highlight",0), "true")) xctx->inst[i].flags |= HILIGHT_CONN; @@ -1780,7 +1780,7 @@ static void load_inst(int k, FILE *fd) xctx->inst[i].embed = !strcmp(get_tok_value(xctx->inst[i].prop_ptr, "embed", 2), "true"); xctx->instances++; } - my_free(885, &prop_ptr); + my_free(_ALLOC_ID_, &prop_ptr); } static void load_polygon(FILE *fd) @@ -1807,17 +1807,17 @@ static void load_polygon(FILE *fd) ptr[i].y=NULL; ptr[i].selected_point=NULL; ptr[i].prop_ptr=NULL; - ptr[i].x = my_calloc(321, points, sizeof(double)); - ptr[i].y = my_calloc(322, points, sizeof(double)); - ptr[i].selected_point= my_calloc(323, points, sizeof(unsigned short)); + ptr[i].x = my_calloc(_ALLOC_ID_, points, sizeof(double)); + ptr[i].y = my_calloc(_ALLOC_ID_, points, sizeof(double)); + ptr[i].selected_point= my_calloc(_ALLOC_ID_, points, sizeof(unsigned short)); ptr[i].points=points; ptr[i].sel=0; for(j=0;jversion_string, "xschem")) && (ptr2 - xctx->version_string < 50)) { - my_strdup2(1655, &ptr, subst_token(xctx->version_string, "xschem", NULL)); + my_strdup2(_ALLOC_ID_, &ptr, subst_token(xctx->version_string, "xschem", NULL)); } - my_strdup2(1656, &ptr, subst_token(ptr, "version", NULL)); - my_strdup2(1657, &ptr, subst_token(ptr, "file_version", NULL)); + my_strdup2(_ALLOC_ID_, &ptr, subst_token(ptr, "version", NULL)); + my_strdup2(_ALLOC_ID_, &ptr, subst_token(ptr, "file_version", NULL)); ptr2 = ptr; while(*ptr2 == ' ' || *ptr2 =='\t') ptr2++; /* strip leading spaces */ if(*ptr2 == '\n') ptr2++; /* strip leading newline */ - my_strdup2(1658, &xctx->header_text, ptr2); - my_free(1659,&ptr); + my_strdup2(_ALLOC_ID_, &xctx->header_text, ptr2); + my_free(_ALLOC_ID_,&ptr); } dbg(1, "read_xschem_file(): file_version=%s\n", xctx->file_version); break; @@ -2042,7 +2042,7 @@ static void read_xschem_file(FILE *fd) break; case '[': found=0; - my_strdup(324, &xctx->inst[xctx->instances-1].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->inst[xctx->instances-1].prop_ptr, subst_token(xctx->inst[xctx->instances-1].prop_ptr, "embed", "true")); if(xctx->inst[xctx->instances-1].name) { my_snprintf(name_embedded, S(name_embedded), "%s/.xschem_embedded_%d_%s", @@ -2058,7 +2058,7 @@ static void read_xschem_file(FILE *fd) /* if loading file coming back from embedded symbol delete temporary file */ /* symbol from this temp file has already been loaded in go_back() */ if(!xctx->x_strcmp(name_embedded, xctx->sym[i].name)) { - my_strdup2(325, &xctx->sym[i].name, xctx->inst[xctx->instances-1].name); + my_strdup2(_ALLOC_ID_, &xctx->sym[i].name, xctx->inst[xctx->instances-1].name); xunlink(name_embedded); found=1;break; } @@ -2114,13 +2114,13 @@ void load_ascii_string(char **ptr, FILE *fd) for(;;) { - if(i+5>strlength) my_realloc(326, &str,(strlength+=CADCHUNKALLOC)); + if(i+5>strlength) my_realloc(_ALLOC_ID_, &str,(strlength+=CADCHUNKALLOC)); c=fgetc(fd); if (c=='\r') continue; if(c==EOF) { fprintf(errfp, "EOF reached, malformed {...} string input, missing close brace\n"); - my_free(1149, ptr); - my_free(889, &str); + my_free(_ALLOC_ID_, ptr); + my_free(_ALLOC_ID_, &str); return; } if(begin) { @@ -2140,9 +2140,9 @@ void load_ascii_string(char **ptr, FILE *fd) } else if(c=='{') begin=1; } dbg(2, "load_ascii_string(): string read=%s\n",str? str:""); - my_strdup(329, ptr, str); + my_strdup(_ALLOC_ID_, ptr, str); dbg(2, "load_ascii_string(): loaded %s\n",*ptr? *ptr:""); - my_free(891, &str); + my_free(_ALLOC_ID_, &str); } void make_symbol(void) @@ -2272,7 +2272,7 @@ void link_symbols_to_instances(int from) /* from >= 0 : linking symbols from pas if(cond) xctx->inst[i].flags|=2; /* ordinary symbol */ else { xctx->inst[i].flags &=~2; /* label or pin */ - my_strdup(1216, &xctx->inst[i].lab, get_tok_value(xctx->inst[i].prop_ptr,"lab",0)); + my_strdup(_ALLOC_ID_, &xctx->inst[i].lab, get_tok_value(xctx->inst[i].prop_ptr,"lab",0)); } } /* symbol_bbox() might call translate() that might call prepare_netlist_structs() that @@ -2436,7 +2436,7 @@ void delete_undo(void) xunlink(diff_name); } rmdir(xctx->undo_dirname); - my_free(895, &xctx->undo_dirname); + my_free(_ALLOC_ID_, &xctx->undo_dirname); xctx->undo_initialized = 0; } @@ -2445,7 +2445,7 @@ static void init_undo(void) { if(!xctx->undo_initialized) { /* create undo directory */ - if( !my_strdup(644, &xctx->undo_dirname, create_tmpdir("xschem_undo_") )) { + if( !my_strdup(_ALLOC_ID_, &xctx->undo_dirname, create_tmpdir("xschem_undo_") )) { dbg(0, "xinit(): problems creating tmp undo dir, Undo will be disabled\n"); dbg(0, "init_undo(): Check permissions in %s\n", tclgetvar("XSCHEM_TMP_DIR")); xctx->no_undo = 1; /* disable undo */ @@ -2661,7 +2661,7 @@ static void get_sym_type(const char *symname, char **type, /* first look in already loaded symbols in xctx->sym[] array... */ for(i=0;isymbols;i++) { if(xctx->x_strcmp(symname, xctx->sym[i].name) == 0) { - my_strdup2(316, type, xctx->sym[i].type); + my_strdup2(_ALLOC_ID_, type, xctx->sym[i].type); found = 1; break; } @@ -2682,7 +2682,7 @@ static void get_sym_type(const char *symname, char **type, if(fd==NULL) { dbg(1, "get_sym_type(): Symbol not found: %s\n",name); - my_strdup2(1162, type, ""); + my_strdup2(_ALLOC_ID_, type, ""); } else { char *globalprop=NULL; int fscan_ret; @@ -2696,12 +2696,12 @@ static void get_sym_type(const char *symname, char **type, case 'G': load_ascii_string(&globalprop,fd); if(!found) { - my_strdup2(1164, type, get_tok_value(globalprop, "type", 0)); + my_strdup2(_ALLOC_ID_, type, get_tok_value(globalprop, "type", 0)); } break; case 'K': load_ascii_string(&globalprop,fd); - my_strdup2(1165, type, get_tok_value(globalprop, "type", 0)); + my_strdup2(_ALLOC_ID_, type, get_tok_value(globalprop, "type", 0)); if(type[0]) found = 1; break; case 'B': @@ -2730,8 +2730,8 @@ static void get_sym_type(const char *symname, char **type, } read_line(fd, 0); /* discard any remaining characters till (but not including) newline */ } - my_free(1166, &globalprop); - my_free(1167, &rect.prop_ptr); + my_free(_ALLOC_ID_, &globalprop); + my_free(_ALLOC_ID_, &rect.prop_ptr); if(!embed_fd) fclose(fd); } } @@ -2762,7 +2762,7 @@ static void align_sch_pins_with_sym(const char *name, int pos) name, symname); fail = 1; } - rect = (xRect *) my_malloc(1168, sizeof(xRect) * sym_n_pins); + rect = (xRect *) my_malloc(_ALLOC_ID_, sizeof(xRect) * sym_n_pins); dbg(1, "align_sch_pins_with_sym(): symbol: %s\n", symname); for(i=0; i < xctx->sym[pos].rects[PINLAYER]; i++) { Int_hashentry *entry; @@ -2783,10 +2783,10 @@ static void align_sch_pins_with_sym(const char *name, int pos) xctx->sym[pos].rect[PINLAYER][i] = rect[i]; } } - my_free(1169, &rect); + my_free(_ALLOC_ID_, &rect); } int_hash_free(&pintable); - my_free(1170, &symtype); + my_free(_ALLOC_ID_, &symtype); } } @@ -2800,14 +2800,14 @@ static void add_pinlayer_boxes(int *lastr, xRect **bb, char *pin_label = NULL; i = lastr[PINLAYER]; - my_realloc(652, &bb[PINLAYER], (i + 1) * sizeof(xRect)); + my_realloc(_ALLOC_ID_, &bb[PINLAYER], (i + 1) * sizeof(xRect)); bb[PINLAYER][i].x1 = i_x0 - 2.5; bb[PINLAYER][i].x2 = i_x0 + 2.5; bb[PINLAYER][i].y1 = i_y0 - 2.5; bb[PINLAYER][i].y2 = i_y0 + 2.5; RECTORDER(bb[PINLAYER][i].x1, bb[PINLAYER][i].y1, bb[PINLAYER][i].x2, bb[PINLAYER][i].y2); bb[PINLAYER][i].prop_ptr = NULL; label = get_tok_value(prop_ptr, "lab", 0); save = strlen(label)+30; - pin_label = my_malloc(315, save); + pin_label = my_malloc(_ALLOC_ID_, save); pin_label[0] = '\0'; if (!strcmp(symtype, "ipin")) { my_snprintf(pin_label, save, "name=%s dir=in ", label); @@ -2816,15 +2816,15 @@ static void add_pinlayer_boxes(int *lastr, xRect **bb, } else if (!strcmp(symtype, "iopin")) { my_snprintf(pin_label, save, "name=%s dir=inout ", label); } - my_strdup(463, &bb[PINLAYER][i].prop_ptr, pin_label); + my_strdup(_ALLOC_ID_, &bb[PINLAYER][i].prop_ptr, pin_label); bb[PINLAYER][i].flags = 0; bb[PINLAYER][i].extraptr = 0; bb[PINLAYER][i].dash = 0; bb[PINLAYER][i].sel = 0; /* add to symbol pins remaining attributes from schematic pins, except name= and lab= */ - my_strdup(157, &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_free(900, &pin_label); + my_free(_ALLOC_ID_, &pin_label); lastr[PINLAYER]++; } @@ -2987,14 +2987,14 @@ int load_sym_def(const char *name, FILE *embed_fd) short inst_rot, inst_flip; char *symname = NULL; char tag[1]; - int *lastl = my_malloc(333, cadlayers * sizeof(lastl)); - int *lastr = my_malloc(334, cadlayers * sizeof(int)); - int *lastp = my_malloc(335, cadlayers * sizeof(int)); - int *lasta = my_malloc(336, cadlayers * sizeof(int)); - xLine **ll = my_malloc(337, cadlayers * sizeof(xLine *)); - xRect **bb = my_malloc(338, cadlayers * sizeof(xRect *)); - xArc **aa = my_malloc(339, cadlayers * sizeof(xArc *)); - xPoly **pp = my_malloc(340, cadlayers * sizeof(xPoly *)); + int *lastl = my_malloc(_ALLOC_ID_, cadlayers * sizeof(lastl)); + int *lastr = my_malloc(_ALLOC_ID_, cadlayers * sizeof(int)); + int *lastp = my_malloc(_ALLOC_ID_, cadlayers * sizeof(int)); + int *lasta = my_malloc(_ALLOC_ID_, cadlayers * sizeof(int)); + xLine **ll = my_malloc(_ALLOC_ID_, cadlayers * sizeof(xLine *)); + xRect **bb = my_malloc(_ALLOC_ID_, cadlayers * sizeof(xRect *)); + xArc **aa = my_malloc(_ALLOC_ID_, cadlayers * sizeof(xArc *)); + xPoly **pp = my_malloc(_ALLOC_ID_, cadlayers * sizeof(xPoly *)); int lastt; xText *tt; int endfile; @@ -3011,7 +3011,7 @@ int load_sym_def(const char *name, FILE *embed_fd) recursion_counter++; dbg(1, "l_s_d(): loading name=%s\n", name); lcc=NULL; - my_realloc(647, &lcc, (level + 1) * sizeof(Lcc)); + my_realloc(_ALLOC_ID_, &lcc, (level + 1) * sizeof(Lcc)); max_level = level + 1; if(!strcmp(xctx->file_version,"1.0")) { my_strncpy(sympath, abs_sym_path(name, ".sym"), S(sympath)); @@ -3056,7 +3056,7 @@ int load_sym_def(const char *name, FILE *embed_fd) symbol[symbols].type = NULL; symbol[symbols].templ = NULL; symbol[symbols].name=NULL; - my_strdup2(352, &symbol[symbols].name,name); + my_strdup2(_ALLOC_ID_, &symbol[symbols].name,name); /* read symbol from file */ while(1) { @@ -3065,8 +3065,8 @@ int load_sym_def(const char *name, FILE *embed_fd) if (level) { dbg(1, "l_s_d(): fclose1, level=%d, fd=%p\n", level, lcc[level].fd); fclose(lcc[level].fd); - my_free(898, &lcc[level].prop_ptr); - my_free(899, &lcc[level].symname); + my_free(_ALLOC_ID_, &lcc[level].prop_ptr); + my_free(_ALLOC_ID_, &lcc[level].symname); --level; continue; } else break; @@ -3100,9 +3100,9 @@ int load_sym_def(const char *name, FILE *embed_fd) if (level==0) { load_ascii_string(&symbol[symbols].prop_ptr, lcc[level].fd); if(!symbol[symbols].prop_ptr) break; - my_strdup2(424, &symbol[symbols].templ, + my_strdup2(_ALLOC_ID_, &symbol[symbols].templ, get_tok_value(symbol[symbols].prop_ptr, "template", 0)); - my_strdup2(515, &symbol[symbols].type, + my_strdup2(_ALLOC_ID_, &symbol[symbols].type, get_tok_value(symbol[symbols].prop_ptr, "type",0)); if(!strcmp(get_tok_value(symbol[symbols].prop_ptr,"highlight",0), "true")) symbol[symbols].flags |= HILIGHT_CONN; @@ -3117,9 +3117,9 @@ int load_sym_def(const char *name, FILE *embed_fd) if (level==0 && !symbol[symbols].prop_ptr) { load_ascii_string(&symbol[symbols].prop_ptr, lcc[level].fd); if(!symbol[symbols].prop_ptr) break; - my_strdup2(341, &symbol[symbols].templ, + my_strdup2(_ALLOC_ID_, &symbol[symbols].templ, get_tok_value(symbol[symbols].prop_ptr, "template", 0)); - my_strdup2(342, &symbol[symbols].type, + my_strdup2(_ALLOC_ID_, &symbol[symbols].type, get_tok_value(symbol[symbols].prop_ptr, "type",0)); if(!strcmp(get_tok_value(symbol[symbols].prop_ptr,"highlight",0), "true")) symbol[symbols].flags |= HILIGHT_CONN; @@ -3137,7 +3137,7 @@ int load_sym_def(const char *name, FILE *embed_fd) continue; } i=lastl[c]; - my_realloc(343, &ll[c],(i+1)*sizeof(xLine)); + my_realloc(_ALLOC_ID_, &ll[c],(i+1)*sizeof(xLine)); if(fscanf(lcc[level].fd, "%lf %lf %lf %lf ",&ll[c][i].x1, &ll[c][i].y1, &ll[c][i].x2, &ll[c][i].y2) < 4 ) { fprintf(errfp,"l_s_d(): WARNING: missing fields for LINE object, ignoring\n"); @@ -3180,10 +3180,10 @@ int load_sym_def(const char *name, FILE *embed_fd) continue; } i=lastp[c]; - my_realloc(344, &pp[c],(i+1)*sizeof(xPoly)); - pp[c][i].x = my_calloc(345, poly_points, sizeof(double)); - pp[c][i].y = my_calloc(346, poly_points, sizeof(double)); - pp[c][i].selected_point = my_calloc(347, poly_points, sizeof(unsigned short)); + my_realloc(_ALLOC_ID_, &pp[c],(i+1)*sizeof(xPoly)); + pp[c][i].x = my_calloc(_ALLOC_ID_, poly_points, sizeof(double)); + pp[c][i].y = my_calloc(_ALLOC_ID_, poly_points, sizeof(double)); + pp[c][i].selected_point = my_calloc(_ALLOC_ID_, poly_points, sizeof(unsigned short)); pp[c][i].points = poly_points; for(k=0;k0 && c == PINLAYER) c = 7; /* Don't care about pins inside SYM: set on different layer */ i=lastr[c]; - my_realloc(349, &bb[c],(i+1)*sizeof(xRect)); + my_realloc(_ALLOC_ID_, &bb[c],(i+1)*sizeof(xRect)); if(fscanf(lcc[level].fd, "%lf %lf %lf %lf ",&bb[c][i].x1, &bb[c][i].y1, &bb[c][i].x2, &bb[c][i].y2) < 4 ) { fprintf(errfp,"l_s_d(): WARNING: missing fields for Box object, ignoring\n"); @@ -3286,7 +3286,7 @@ int load_sym_def(const char *name, FILE *embed_fd) load_ascii_string( &bb[c][i].prop_ptr, lcc[level].fd); /* don't load graphs of LCC schematic instances */ if(strstr(get_tok_value(bb[c][i].prop_ptr, "flags", 0), "graph")) { - my_free(1594, &bb[c][i].prop_ptr); + my_free(_ALLOC_ID_, &bb[c][i].prop_ptr); continue; } dbg(2, "l_s_d(): loaded rect: ptr=%lx\n", (unsigned long)bb[c]); @@ -3306,7 +3306,7 @@ int load_sym_def(const char *name, FILE *embed_fd) break; case 'T': i=lastt; - my_realloc(350, &tt,(i+1)*sizeof(xText)); + my_realloc(_ALLOC_ID_, &tt,(i+1)*sizeof(xText)); tt[i].txt_ptr=NULL; tt[i].font=NULL; load_ascii_string(&tt[i].txt_ptr, lcc[level].fd); @@ -3321,7 +3321,7 @@ int load_sym_def(const char *name, FILE *embed_fd) const char* tmp = translate2(lcc, level, tt[i].txt_ptr); dbg(1, "l_s_d(): txt2: tt[i].txt_ptr=%s, i=%d\n", tt[i].txt_ptr, i); rot = lcc[level].rot; flip = lcc[level].flip; - my_strdup2(651, &tt[i].txt_ptr, tmp); + my_strdup2(_ALLOC_ID_, &tt[i].txt_ptr, tmp); dbg(1, "l_s_d(): txt3: tt[i].txt_ptr=%s, i=%d\n", tt[i].txt_ptr, i); /* allow annotation inside LCC instances. */ if(!strcmp(tt[i].txt_ptr, "@spice_get_voltage")) { @@ -3340,9 +3340,9 @@ int load_sym_def(const char *name, FILE *embed_fd) if(path) new_size += strlen(path); lab = get_tok_value(prop_ptr, "lab", 0); new_size += strlen(lab) + 21; /* @spice_get_voltage() */ - my_realloc(1587, &tt[i].txt_ptr, new_size); + my_realloc(_ALLOC_ID_, &tt[i].txt_ptr, new_size); my_snprintf(tt[i].txt_ptr, new_size, "@spice_get_voltage(%s%s)", path ? path : "", lab); - my_free(1589, &path); + my_free(_ALLOC_ID_, &path); dbg(1, " --> tt[i].txt_ptr=%s\n", tt[i].txt_ptr); } if(!strcmp(tt[i].txt_ptr, "@spice_get_current")) { @@ -3361,9 +3361,9 @@ int load_sym_def(const char *name, FILE *embed_fd) if(path) new_size += strlen(path); dev = get_tok_value(prop_ptr, "name", 0); new_size += strlen(dev) + 21; /* @spice_get_current() */ - my_realloc(1592, &tt[i].txt_ptr, new_size); + my_realloc(_ALLOC_ID_, &tt[i].txt_ptr, new_size); my_snprintf(tt[i].txt_ptr, new_size, "@spice_get_current(%s%s)", path ? path : "", dev); - my_free(1593, &path); + my_free(_ALLOC_ID_, &path); dbg(1, " --> tt[i].txt_ptr=%s\n", tt[i].txt_ptr); } ROTATION(rot, flip, 0.0, 0.0, tt[i].x0, tt[i].y0, rx1, ry1); @@ -3380,7 +3380,7 @@ int load_sym_def(const char *name, FILE *embed_fd) my_strcat(1163, &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"); - my_strdup(351, &tt[i].font, get_tok_value(tt[i].prop_ptr, "font", 0)); + my_strdup(_ALLOC_ID_, &tt[i].font, get_tok_value(tt[i].prop_ptr, "font", 0)); str = get_tok_value(tt[i].prop_ptr, "hcenter", 0); tt[i].hcenter = strcmp(str, "true") ? 0 : 1; str = get_tok_value(tt[i].prop_ptr, "vcenter", 0); @@ -3400,7 +3400,7 @@ int load_sym_def(const char *name, FILE *embed_fd) break; case 'N': /* store wires as lines on layer WIRELAYER. */ i = lastl[WIRELAYER]; - my_realloc(314, &ll[WIRELAYER],(i+1)*sizeof(xLine)); + my_realloc(_ALLOC_ID_, &ll[WIRELAYER],(i+1)*sizeof(xLine)); if(fscanf(lcc[level].fd, "%lf %lf %lf %lf ",&ll[WIRELAYER][i].x1, &ll[WIRELAYER][i].y1, &ll[WIRELAYER][i].x2, &ll[WIRELAYER][i].y2) < 4 ) { fprintf(errfp,"l_s_d(): WARNING: missing fields for LINE object, ignoring\n"); @@ -3503,7 +3503,7 @@ int load_sym_def(const char *name, FILE *embed_fd) } if(fd_tmp) { if (level+1 >= max_level) { - my_realloc(653, &lcc, (max_level + 1) * sizeof(Lcc)); + my_realloc(_ALLOC_ID_, &lcc, (max_level + 1) * sizeof(Lcc)); max_level++; } ++level; @@ -3530,8 +3530,8 @@ int load_sym_def(const char *name, FILE *embed_fd) lcc[level].x0 += lcc[(level-1)].x0; lcc[level].y0 += lcc[(level-1)].y0; } - my_strdup(654, &lcc[level].prop_ptr, prop_ptr); - my_strdup(657, &lcc[level].symname, symname); + my_strdup(_ALLOC_ID_, &lcc[level].prop_ptr, prop_ptr); + my_strdup(_ALLOC_ID_, &lcc[level].symname, symname); dbg(1, "level incremented: level=%d, symname=%s, prop_ptr=%s sympath=%s\n", level, symname, prop_ptr, sympath); } @@ -3545,8 +3545,8 @@ int load_sym_def(const char *name, FILE *embed_fd) break; case ']': if(level) { - my_free(1173, &lcc[level].prop_ptr); - my_free(1174, &lcc[level].symname); + my_free(_ALLOC_ID_, &lcc[level].prop_ptr); + my_free(_ALLOC_ID_, &lcc[level].symname); --level; } else { endfile=1; @@ -3591,19 +3591,19 @@ int load_sym_def(const char *name, FILE *embed_fd) /* given a .sch file used as instance in LCC schematics, order its pin * as in corresponding .sym file if it exists */ align_sch_pins_with_sym(name, symbols); - my_free(910, &prop_ptr); - my_free(901, &lastl); - my_free(902, &lastr); - my_free(903, &lastp); - my_free(904, &lasta); - my_free(905, &ll); - my_free(906, &bb); - my_free(907, &aa); - my_free(908, &pp); - my_free(909, &lcc); - my_free(911, &aux_ptr); - my_free(912, &symname); - my_free(913, &symtype); + my_free(_ALLOC_ID_, &prop_ptr); + my_free(_ALLOC_ID_, &lastl); + my_free(_ALLOC_ID_, &lastr); + my_free(_ALLOC_ID_, &lastp); + my_free(_ALLOC_ID_, &lasta); + my_free(_ALLOC_ID_, &ll); + my_free(_ALLOC_ID_, &bb); + my_free(_ALLOC_ID_, &aa); + my_free(_ALLOC_ID_, &pp); + my_free(_ALLOC_ID_, &lcc); + my_free(_ALLOC_ID_, &aux_ptr); + my_free(_ALLOC_ID_, &symname); + my_free(_ALLOC_ID_, &symtype); recursion_counter--; sort_symbol_pins(xctx->sym[xctx->symbols].rect[PINLAYER], xctx->sym[xctx->symbols].rects[PINLAYER], @@ -3668,20 +3668,20 @@ void create_sch_from_sym(void) char *sch = NULL; size_t ln; - my_strdup(1595, &pinname[0], tcleval("rel_sym_path [find_file ipin.sym]")); - my_strdup(1596, &pinname[1], tcleval("rel_sym_path [find_file opin.sym]")); - my_strdup(1597, &pinname[2], tcleval("rel_sym_path [find_file iopin.sym]")); - my_strdup(1606, &generic_pin, tcleval("rel_sym_path [find_file generic_pin.sym]")); + my_strdup(_ALLOC_ID_, &pinname[0], tcleval("rel_sym_path [find_file ipin.sym]")); + my_strdup(_ALLOC_ID_, &pinname[1], tcleval("rel_sym_path [find_file opin.sym]")); + my_strdup(_ALLOC_ID_, &pinname[2], tcleval("rel_sym_path [find_file iopin.sym]")); + my_strdup(_ALLOC_ID_, &generic_pin, tcleval("rel_sym_path [find_file generic_pin.sym]")); if(pinname[0] && pinname[1] && pinname[2] && generic_pin) { rebuild_selected_array(); if(xctx->lastsel > 1) return; if(xctx->lastsel==1 && xctx->sel_array[0].type==ELEMENT) { - my_strdup2(1250, &sch, + my_strdup2(_ALLOC_ID_, &sch, get_tok_value((xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 )); my_strncpy(schname, abs_sym_path(sch, ""), S(schname)); - my_free(1251, &sch); + my_free(_ALLOC_ID_, &sch); if(!schname[0]) { my_strncpy(schname, add_ext(abs_sym_path(xctx->inst[xctx->sel_array[0].n].name, ""), ".sch"), S(schname)); @@ -3713,13 +3713,13 @@ void create_sch_from_sym(void) rct = ptr->rect[GENERICLAYER]; ypos=0; for(i=0;ilastsel...) */ - my_free(916, &dir); - my_free(917, &prop); - my_free(919, &sub2_prop); - my_free(920, &str); + my_free(_ALLOC_ID_, &dir); + my_free(_ALLOC_ID_, &prop); + my_free(_ALLOC_ID_, &sub2_prop); + my_free(_ALLOC_ID_, &str); } else { fprintf(errfp, "create_sch_from_sym(): location of schematic pins not found\n"); tcleval("alert_ {create_sch_from_sym(): location of schematic pins not found} {}"); } - my_free(1602, &pinname[0]); - my_free(1603, &pinname[1]); - my_free(1604, &pinname[2]); - my_free(1605, &generic_pin); + my_free(_ALLOC_ID_, &pinname[0]); + my_free(_ALLOC_ID_, &pinname[1]); + my_free(_ALLOC_ID_, &pinname[2]); + my_free(_ALLOC_ID_, &generic_pin); } void descend_symbol(void) @@ -3798,18 +3798,18 @@ void descend_symbol(void) } else return; /* build up current hierarchy path */ - my_strdup(363, &str, xctx->inst[n].instname); - my_strdup(364, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); + 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_strcat(365, &xctx->sch_path[xctx->currsch+1], str); my_strcat(366, &xctx->sch_path[xctx->currsch+1], "."); xctx->sch_path_hash[xctx->currsch+1] = 0; - my_strdup(1518, &xctx->hier_attr[xctx->currsch].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].prop_ptr, xctx->inst[n].prop_ptr); - my_strdup(1612, &xctx->hier_attr[xctx->currsch].templ, + my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].templ, get_tok_value((xctx->inst[n].ptr+ xctx->sym)->prop_ptr, "template", 0)); xctx->sch_inst_number[xctx->currsch+1] = 1; - my_free(921, &str); + my_free(_ALLOC_ID_, &str); xctx->previous_instance[xctx->currsch]=n; xctx->zoom_array[xctx->currsch].x=xctx->xorigin; xctx->zoom_array[xctx->currsch].y=xctx->yorigin; diff --git a/src/scheduler.c b/src/scheduler.c index 3839751d..73a7bac2 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -670,7 +670,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg char *str = NULL; display_hilights(&str); Tcl_SetResult(interp, str, TCL_VOLATILE); - my_free(1161, &str); + my_free(_ALLOC_ID_, &str); } else if(!strcmp(argv[1], "draw_graph")) { @@ -763,10 +763,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg l = expandlabel(argv[2], &tmp); llen = strlen(l); dbg(1, "l=%s\n", l ? l : ""); - result = my_malloc(378, llen + 30); + result = my_malloc(_ALLOC_ID_, llen + 30); my_snprintf(result, llen + 30, "%s %d", l, tmp); Tcl_SetResult(interp, result, TCL_VOLATILE); - my_free(927, &result); + my_free(_ALLOC_ID_, &result); } } else { cmd_found = 0;} @@ -1148,7 +1148,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg Tcl_SetResult(interp, (xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][n].prop_ptr, TCL_VOLATILE); } else { tmp = 100 + strlen(argv[4]) + strlen(argv[5]); - subtok = my_malloc(83,tmp); + subtok = my_malloc(_ALLOC_ID_,tmp); my_snprintf(subtok, tmp, "%s(%s)", argv[5], argv[4]); value = get_tok_value(xctx->inst[inst].prop_ptr,subtok,0); if(!value[0]) { @@ -1167,7 +1167,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } Tcl_SetResult(interp, (char *)value, TCL_VOLATILE); } - my_free(924, &subtok); + my_free(_ALLOC_ID_, &subtok); } } /* xschem getprop symbol lm358.sym [type] */ @@ -1213,9 +1213,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(argc < 4) {Tcl_SetResult(interp, "Missing arguments", TCL_STATIC);return TCL_ERROR;} if(argc == 5) t = atoi(argv[4]); else t = 0; - my_strdup(648, &s, get_tok_value(argv[2], argv[3], t)); + my_strdup(_ALLOC_ID_, &s, get_tok_value(argv[2], argv[3], t)); Tcl_SetResult(interp, s, TCL_VOLATILE); - my_free(649, &s); + my_free(_ALLOC_ID_, &s); } else if(!strcmp(argv[1], "get_tok_size") ) @@ -1494,7 +1494,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg rct=symbol->rect[PINLAYER]; /* slotted devices: name= U1:2, pinnumber=2:5 */ slot = -1; - tmpstr = my_malloc(529, sizeof(xctx->inst[i].instname)); + tmpstr = my_malloc(_ALLOC_ID_, sizeof(xctx->inst[i].instname)); if((ss=strchr(xctx->inst[i].instname, ':')) ) { sscanf(ss+1, "%s", tmpstr); if(isonlydigit(tmpstr)) { @@ -1517,7 +1517,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg piny0 += y0; my_snprintf(num, S(num), "{%s} %g %g", get_tok_value(rct[p].prop_ptr, "name", 0), pinx0, piny0); Tcl_SetResult(interp, num, TCL_VOLATILE); - my_free(530, &tmpstr); + my_free(_ALLOC_ID_, &tmpstr); } else if(!strcmp(argv[1], "instance_pins")) @@ -1538,7 +1538,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(p< no_of_pins-1) my_strcat(377, &pins, " "); } Tcl_SetResult(interp, pins, TCL_VOLATILE); - my_free(1195, &pins); + my_free(_ALLOC_ID_, &pins); } else if(!strcmp(argv[1], "instance_pos")) @@ -1594,7 +1594,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } } Tcl_SetResult(interp, pins ? pins : "", TCL_VOLATILE); - my_free(926, &pins); + my_free(_ALLOC_ID_, &pins); } else { cmd_found = 0;} break; @@ -1633,7 +1633,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg Tcl_ResetResult(interp); hier_psprint(&res, 2); Tcl_SetResult(interp, res, TCL_VOLATILE); - my_free(1645, &res); + my_free(_ALLOC_ID_, &res); } else if(!strcmp(argv[1], "list_hilights")) @@ -1699,7 +1699,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg dbg(1, "scheduler: undo_reset=%d\n", undo_reset); load_schematic(load_symbols, f, undo_reset); tclvareval("update_recent_file {", f, "}", NULL); - my_strdup(375, &xctx->sch_path[xctx->currsch], "."); + my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch], "."); xctx->sch_path_hash[xctx->currsch] = 0; xctx->sch_inst_number[xctx->currsch] = 1; if(nofullzoom) draw(); @@ -2329,15 +2329,15 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg delete_inst_node(inst); /* 20180208 fix crashing bug: delete node info if changing symbol */ /* if number of pins is different we must delete these data *before* */ /* changing ysmbol, otherwise i might end up deleting non allocated data. */ - my_strdup2(369, &xctx->inst[inst].name, rel_sym_path(symbol)); + my_strdup2(_ALLOC_ID_, &xctx->inst[inst].name, rel_sym_path(symbol)); xctx->inst[inst].ptr=sym_number; bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2); - my_strdup(370, &name, xctx->inst[inst].instname); + my_strdup(_ALLOC_ID_, &name, xctx->inst[inst].instname); if(name && name[0] ) { /* 20110325 only modify prefix if prefix not NUL */ if(prefix) name[0]=(char)prefix; /* change prefix if changing symbol type; */ - my_strdup(371, &ptr,subst_token(xctx->inst[inst].prop_ptr, "name", name) ); + my_strdup(_ALLOC_ID_, &ptr,subst_token(xctx->inst[inst].prop_ptr, "name", name) ); hash_all_names(); new_prop_string(inst, ptr,0, tclgetboolvar("disable_unique_names")); /* set new prop_ptr */ type=xctx->sym[xctx->inst[inst].ptr].type; @@ -2345,12 +2345,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(cond) xctx->inst[inst].flags|=2; else { xctx->inst[inst].flags &=~2; - my_strdup(872, &xctx->inst[inst].lab, get_tok_value(xctx->inst[inst].prop_ptr, "lab", 0)); + my_strdup(_ALLOC_ID_, &xctx->inst[inst].lab, get_tok_value(xctx->inst[inst].prop_ptr, "lab", 0)); } xctx->inst[inst].embed = !strcmp(get_tok_value(xctx->inst[inst].prop_ptr, "embed", 2), "true"); - my_free(922, &ptr); + my_free(_ALLOC_ID_, &ptr); } - my_free(923, &name); + my_free(_ALLOC_ID_, &name); /* new symbol bbox after prop changes (may change due to text length) */ symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2); bbox(ADD, xctx->inst[inst].x1, xctx->inst[inst].y1, xctx->inst[inst].x2, xctx->inst[inst].y2); @@ -2512,7 +2512,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(exists) { viewer = atoi(tclgetvar("sim(spicewave,default)")); my_snprintf(tcl_str, S(tcl_str), "sim(spicewave,%d,name)", viewer); - my_strdup(1267, &viewer_name, tclgetvar(tcl_str)); + my_strdup(_ALLOC_ID_, &viewer_name, tclgetvar(tcl_str)); dbg(1, "send_to_viewer: viewer_name=%s\n", viewer_name); if(strstr(viewer_name, "Gaw")) viewer=GAW; else if(strstr(viewer_name, "Bespice")) viewer=BESPICE; @@ -2520,7 +2520,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg hilight_net(viewer); redraw_hilights(0); } - my_free(1268, &viewer_name); + my_free(_ALLOC_ID_, &viewer_name); } Tcl_ResetResult(interp); } @@ -2546,12 +2546,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg xctx->draw_window=atoi(argv[3]); } else if(!strcmp(argv[2], "format")) { - my_strdup(1542, &xctx->format, argv[3]); + my_strdup(_ALLOC_ID_, &xctx->format, argv[3]); } else if(!strcmp(argv[2], "header_text")) { if(!xctx->header_text || strcmp(xctx->header_text, argv[3])) { set_modify(1); xctx->push_undo(); - my_strdup2(1660, &xctx->header_text, argv[3]); + my_strdup2(_ALLOC_ID_, &xctx->header_text, argv[3]); } } else if(!strcmp(argv[2], "hide_symbols")) { @@ -2628,10 +2628,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg { char *s = NULL; if(argc < 5) {Tcl_SetResult(interp, "Missing arguments", TCL_STATIC);return TCL_ERROR;} - my_strdup(459, &s, argv[2]); + my_strdup(_ALLOC_ID_, &s, argv[2]); set_different_token(&s, argv[3], argv[4], 0, 0); Tcl_SetResult(interp, s, TCL_VOLATILE); - my_free(1156, &s); + my_free(_ALLOC_ID_, &s); } else if(!strcmp(argv[1], "set_modify")) @@ -2693,7 +2693,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(cond) xctx->inst[inst].flags|=2; else { xctx->inst[inst].flags &=~2; - my_strdup(1215, &xctx->inst[inst].lab, get_tok_value(xctx->inst[inst].prop_ptr, "lab", 0)); + my_strdup(_ALLOC_ID_, &xctx->inst[inst].lab, get_tok_value(xctx->inst[inst].prop_ptr, "lab", 0)); } xctx->inst[inst].embed = !strcmp(get_tok_value(xctx->inst[inst].prop_ptr, "embed", 2), "true"); if(!fast) { @@ -2748,14 +2748,14 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(strcmp(argv[6], get_tok_value(r->prop_ptr, argv[5], 0))) { change_done = 1; if(fast == 3 || fast == 0) xctx->push_undo(); - my_strdup2(1486, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], argv[6])); + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], argv[6])); } } else { get_tok_value(r->prop_ptr, argv[5], 0); if(xctx->tok_size) { change_done = 1; if(fast == 3 || fast == 0) xctx->push_undo(); - my_strdup2(1478, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], NULL)); /* delete attr */ + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], NULL)); /* delete attr */ } } if(change_done) set_modify(1); @@ -2793,9 +2793,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg { char *s=NULL; if(argc < 5) {Tcl_SetResult(interp, "Missing arguments", TCL_STATIC);return TCL_ERROR;} - my_strdup(894, &s, subst_token(argv[2], argv[3], strcmp(argv[4], "NULL") ? argv[4] : NULL)); + my_strdup(_ALLOC_ID_, &s, subst_token(argv[2], argv[3], strcmp(argv[4], "NULL") ? argv[4] : NULL)); Tcl_SetResult(interp, s, TCL_VOLATILE); - my_free(1150, &s); + my_free(_ALLOC_ID_, &s); } else if(!strcmp(argv[1], "symbol_in_new_window")) @@ -3193,6 +3193,6 @@ int tclvareval(const char *script, ...) dbg(0, "tclvareval(): error executing %s: %s\n", str, tclresult()); Tcl_ResetResult(interp); } - my_free(1381, &str); + my_free(_ALLOC_ID_, &str); return return_code; } diff --git a/src/select.c b/src/select.c index 021516d8..1f29bb42 100644 --- a/src/select.c +++ b/src/select.c @@ -233,7 +233,7 @@ static void del_rect_line_arc_poly(void) if(c == GRIDLAYER) xctx->graph_lastsel = -1; /* invalidate last selected graph */ j++; bbox(ADD, xctx->rect[c][i].x1, xctx->rect[c][i].y1, xctx->rect[c][i].x2, xctx->rect[c][i].y2); - my_free(928, &xctx->rect[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->rect[c][i].prop_ptr); set_rect_extraptr(0, &xctx->rect[c][i]); set_modify(1); continue; @@ -260,7 +260,7 @@ static void del_rect_line_arc_poly(void) bbox(ADD, xctx->line[c][i].x1, xctx->line[c][i].y1 , xctx->line[c][i].x2 , xctx->line[c][i].y2 ); } set_modify(1); - my_free(929, &xctx->line[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->line[c][i].prop_ptr); continue; } if(j) @@ -284,7 +284,7 @@ static void del_rect_line_arc_poly(void) arc_bbox(xctx->arc[c][i].x, xctx->arc[c][i].y, xctx->arc[c][i].r, xctx->arc[c][i].a, xctx->arc[c][i].b, &tmp.x1, &tmp.y1, &tmp.x2, &tmp.y2); bbox(ADD, tmp.x1, tmp.y1, tmp.x2, tmp.y2); - my_free(930, &xctx->arc[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->arc[c][i].prop_ptr); set_modify(1); continue; } @@ -312,10 +312,10 @@ static void del_rect_line_arc_poly(void) } j++; bbox(ADD, x1, y1, x2, y2); - my_free(931, &xctx->poly[c][i].prop_ptr); - my_free(932, &xctx->poly[c][i].x); - my_free(933, &xctx->poly[c][i].y); - my_free(934, &xctx->poly[c][i].selected_point); + my_free(_ALLOC_ID_, &xctx->poly[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->poly[c][i].x); + my_free(_ALLOC_ID_, &xctx->poly[c][i].y); + my_free(_ALLOC_ID_, &xctx->poly[c][i].selected_point); /*fprintf(errfp, "bbox: %.16g %.16g %.16g %.16g\n", x1, y1, x2, y2); */ set_modify(1); continue; @@ -368,9 +368,9 @@ void delete(int to_push_undo) } #endif bbox(ADD, xx1, yy1, xx2, yy2 ); - my_free(935, &xctx->text[i].prop_ptr); - my_free(936, &xctx->text[i].font); - my_free(937, &xctx->text[i].txt_ptr); + my_free(_ALLOC_ID_, &xctx->text[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->text[i].font); + my_free(_ALLOC_ID_, &xctx->text[i].txt_ptr); set_modify(1); j++; continue; @@ -392,12 +392,12 @@ void delete(int to_push_undo) set_modify(1); if(xctx->inst[i].prop_ptr != NULL) { - my_free(938, &xctx->inst[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->inst[i].prop_ptr); } delete_inst_node(i); - my_free(939, &xctx->inst[i].name); - my_free(940, &xctx->inst[i].instname); - my_free(878, &xctx->inst[i].lab); + my_free(_ALLOC_ID_, &xctx->inst[i].name); + my_free(_ALLOC_ID_, &xctx->inst[i].instname); + my_free(_ALLOC_ID_, &xctx->inst[i].lab); j++; continue; } @@ -432,8 +432,8 @@ void delete(int to_push_undo) bbox(ADD, xctx->wire[i].x1-ov, y1 , xctx->wire[i].x2+ov , y2 ); } - my_free(941, &xctx->wire[i].prop_ptr); - my_free(942, &xctx->wire[i].node); + my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->wire[i].node); set_modify(1); continue; diff --git a/src/spice_netlist.c b/src/spice_netlist.c index ad7aa7ce..4ffc5c94 100644 --- a/src/spice_netlist.c +++ b/src/spice_netlist.c @@ -66,7 +66,7 @@ void hier_psprint(char **res, int what) /* netlister driver */ /* reload data without popping undo stack, this populates embedded symbols if any */ xctx->pop_undo(2, 0); /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ - my_strdup(1224, &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"); xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->currsch++; @@ -76,13 +76,13 @@ void hier_psprint(char **res, int what) /* netlister driver */ int flag; /* for printing we process also symbols that have *_ignore attribute */ if(!xctx->sym[i].type || !xctx->sym[i].name || !xctx->sym[i].name[0]) continue; /* can not descend into */ - my_strdup2(1230, &abs_path, abs_sym_path(xctx->sym[i].name, "")); + my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, "")); if(what & 1) flag = check_lib(2, abs_path); /* noprint_libs */ else flag = check_lib(4, abs_path); /* nolist_libs */ if(strcmp(xctx->sym[i].type,"subcircuit")==0 && flag) { /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ - my_strdup(1228, &subckt_name, get_cell(xctx->sym[i].name, 0)); + my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) { str_hash_lookup(&subckt_table, subckt_name, "", XINSERT); @@ -101,9 +101,9 @@ void hier_psprint(char **res, int what) /* netlister driver */ } } } - my_free(1231, &abs_path); + my_free(_ALLOC_ID_, &abs_path); str_hash_free(&subckt_table); - my_free(1229, &subckt_name); + my_free(_ALLOC_ID_, &subckt_name); my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch])); xctx->currsch--; unselect_all(1); @@ -122,18 +122,18 @@ static char *model_name(const char *m) char *modelname = NULL; int n; size_t l = strlen(m) + 1; - my_strdup(255, &m_lower, m); + my_strdup(_ALLOC_ID_, &m_lower, m); strtolower(m_lower); - my_realloc(256, &modelname, l); - my_realloc(257, &model_name_result, l); + my_realloc(_ALLOC_ID_, &modelname, l); + my_realloc(_ALLOC_ID_, &model_name_result, l); n = sscanf(m_lower, " %s %s", model_name_result, modelname); if(n<2) my_strncpy(model_name_result, m_lower, l); else { /* 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_free(948, &modelname); - my_free(949, &m_lower); + my_free(_ALLOC_ID_, &modelname); + my_free(_ALLOC_ID_, &m_lower); return model_name_result; } @@ -156,7 +156,7 @@ static void spice_netlist(FILE *fd, int spice_stop ) if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "spice_ignore",0 ), "true") ) { continue; } - my_strdup(388, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && IS_PIN(type) ) { if(top_sub && !flag) { fprintf(fd, "*.PININFO "); @@ -181,7 +181,7 @@ static void spice_netlist(FILE *fd, int spice_stop ) if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "spice_ignore",0 ), "true") ) { continue; } - my_strdup(390, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && !IS_LABEL_OR_PIN(type) ) { /* already done in global_spice_netlist */ @@ -202,11 +202,11 @@ static void spice_netlist(FILE *fd, int spice_stop ) m = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "device_model", 0); if(m[0]) str_hash_lookup(&model_table, model_name(m), m, XINSERT); } - my_free(951, &model_name_result); + my_free(_ALLOC_ID_, &model_name_result); } } } - my_free(952, &type); + my_free(_ALLOC_ID_, &type); } if(!spice_stop && !xctx->netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */ } @@ -272,11 +272,11 @@ void global_spice_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "spice_ignore",0 ), "true") ) { continue; } - my_strdup(1264, &type,(xctx->inst[i].ptr+ xctx->sym)->type); - my_strdup(1265, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0)); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0)); if( type && !strcmp(type,"netlist_commands") ) { if(!place) { - my_strdup(1266, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); + my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); } if(place && !strcmp(place, "header" )) { if(first == 0) fprintf(fd,"**** begin user header code\n"); @@ -305,7 +305,7 @@ void global_spice_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "spice_ignore",0 ), "true") ) { continue; } - my_strdup(380, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); dbg(1, "global_spice_netlist(): |%s|\n", type); /* if( type && !strcmp(type,"netlist_options") ) { @@ -331,11 +331,11 @@ void global_spice_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "spice_ignore",0 ), "true") ) { continue; } - my_strdup(381, &type,(xctx->inst[i].ptr+ xctx->sym)->type); - my_strdup(382, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0)); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0)); if( type && !strcmp(type,"netlist_commands") ) { if(!place) { - my_strdup(383, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); + my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); } if(!place || (strcmp(place, "end") && strcmp(place, "header")) ) { if(first == 0) fprintf(fd,"**** begin user architecture code\n"); @@ -376,7 +376,7 @@ void global_spice_netlist(int global) /* netlister driver */ /* warning if two symbols perfectly overlapped */ warning_overlapped_symbols(0); /* preserve current level instance flags before descending hierarchy for netlisting, restore later */ - stored_flags = my_calloc(146, xctx->instances, sizeof(unsigned int)); + stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int)); for(i=0;iinstances;i++) stored_flags[i] = xctx->inst[i].color; if(global) @@ -388,7 +388,7 @@ void global_spice_netlist(int global) /* netlister driver */ dbg(1, "global_spice_netlist(): invoking pop_undo(2, 0)\n"); xctx->pop_undo(2, 0); /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ - my_strdup(469, &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"); xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->currsch++; @@ -399,11 +399,11 @@ void global_spice_netlist(int global) /* netlister driver */ { if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue; if(!xctx->sym[i].type) continue; - my_strdup(1232, &abs_path, abs_sym_path(xctx->sym[i].name, "")); + my_strdup(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, "")); if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path)) { /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ - my_strdup(391, &subckt_name, get_cell(xctx->sym[i].name, 0)); + my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) { str_hash_lookup(&subckt_table, subckt_name, "", XINSERT); @@ -416,10 +416,10 @@ void global_spice_netlist(int global) /* netlister driver */ spice_block_netlist(fd, i); } } - my_free(1233, &abs_path); + my_free(_ALLOC_ID_, &abs_path); } str_hash_free(&subckt_table); - my_free(944, &subckt_name); + my_free(_ALLOC_ID_, &subckt_name); /*clear_drawing(); */ my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch])); xctx->currsch--; @@ -437,7 +437,7 @@ void global_spice_netlist(int global) /* netlister driver */ for(i=0;iinstances; i++) xctx->inst[i].color = stored_flags[i]; propagate_hilights(1, 0, XINSERT_NOREPLACE); draw_hilight_net(1); - my_free(945, &stored_flags); + my_free(_ALLOC_ID_, &stored_flags); /* print globals nodes found in netlist 28032003 */ if(!split_f) record_global_node(0,fd,NULL); @@ -452,15 +452,15 @@ void global_spice_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "spice_ignore",0 ), "true") ) { continue; } - my_strdup(384, &type,(xctx->inst[i].ptr+ xctx->sym)->type); - my_strdup(385, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0)); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0)); if( type && !strcmp(type,"netlist_commands") ) { if(place && !strcmp(place, "end" )) { if(first == 0) fprintf(fd,"**** begin user architecture code\n"); first++; print_spice_element(fd, i) ; } else { - my_strdup(386, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); + my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); if(place && !strcmp(place, "end" )) { if(first == 0) fprintf(fd,"**** begin user architecture code\n"); first++; @@ -503,8 +503,8 @@ void global_spice_netlist(int global) /* netlister driver */ } if(!debug_var) xunlink(netl_filename); } - my_free(946, &type); - my_free(947, &place); + my_free(_ALLOC_ID_, &type); + my_free(_ALLOC_ID_, &place); xctx->netlist_count = 0; } @@ -547,7 +547,7 @@ void spice_block_netlist(FILE *fd, int i) fprintf(fd, ".subckt %s ",skip_dir(xctx->sym[i].name)); print_spice_subckt_nodes(fd, i); - my_strdup(387, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) ); + my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) ); /* this is now done in print_spice_subckt_nodes */ /* * fprintf(fd, "%s ", extra ? extra : "" ); @@ -555,7 +555,7 @@ void spice_block_netlist(FILE *fd, int i) /* 20081206 new get_sym_template does not return token=value pairs where token listed in extra */ fprintf(fd, "%s", get_sym_template(xctx->sym[i].templ, extra)); - my_free(950, &extra); + my_free(_ALLOC_ID_, &extra); fprintf(fd, "\n"); spice_stop ? load_schematic(0,filename, 0) : load_schematic(1,filename, 0); @@ -617,12 +617,12 @@ Str_hashentry *str_hash_lookup(Str_hashtable *hashtable, const char *token, cons if(what==XINSERT || what == XINSERT_NOREPLACE) /* insert data */ { s=sizeof( Str_hashentry ); - entry=(Str_hashentry *)my_malloc(313, s); + entry=(Str_hashentry *)my_malloc(_ALLOC_ID_, s); entry->next=NULL; entry->token=NULL; entry->value=NULL; - my_strdup(297, &entry->token, token); - my_strdup(307, &entry->value, value); + my_strdup(_ALLOC_ID_, &entry->token, token); + my_strdup(_ALLOC_ID_, &entry->value, value); entry->hash=hashcode; *preventry=entry; } @@ -633,13 +633,13 @@ Str_hashentry *str_hash_lookup(Str_hashtable *hashtable, const char *token, cons if(what==XDELETE) /* remove token from the hash table ... */ { saveptr=entry->next; - my_free(953, &entry->token); - my_free(954, &entry->value); - my_free(955, &entry); + my_free(_ALLOC_ID_, &entry->token); + my_free(_ALLOC_ID_, &entry->value); + my_free(_ALLOC_ID_, &entry); *preventry=saveptr; } else if(value && what == XINSERT ) { - my_strdup(308, &entry->value, value); + my_strdup(_ALLOC_ID_, &entry->value, value); } return entry; /* found matching entry, return the address */ } @@ -654,7 +654,7 @@ void str_hash_init(Str_hashtable *hashtable, int size) dbg(0, "str_hash_init(): Warning hash table not empty, possible data leak\n"); } hashtable->size = size; - hashtable->table = my_calloc(1574, size, sizeof(Str_hashentry *)); + hashtable->table = my_calloc(_ALLOC_ID_, size, sizeof(Str_hashentry *)); } static void str_hash_free_entry(Str_hashentry *entry) @@ -662,9 +662,9 @@ static void str_hash_free_entry(Str_hashentry *entry) Str_hashentry *tmp; while( entry ) { tmp = entry -> next; - my_free(956, &(entry->token)); - my_free(957, &(entry->value)); - my_free(958, &entry); + my_free(_ALLOC_ID_, &(entry->token)); + my_free(_ALLOC_ID_, &(entry->value)); + my_free(_ALLOC_ID_, &entry); entry = tmp; } } @@ -680,7 +680,7 @@ void str_hash_free(Str_hashtable *hashtable) str_hash_free_entry( table[i] ); table[i] = NULL; } - if(hashtable->table) my_free(1384, &(hashtable->table)); + if(hashtable->table) my_free(_ALLOC_ID_, &(hashtable->table)); hashtable->size = 0; } } @@ -718,10 +718,10 @@ Int_hashentry *int_hash_lookup(Int_hashtable *hashtable, const char *token, cons if(what==XINSERT || what == XINSERT_NOREPLACE) /* insert data */ { s=sizeof( Int_hashentry ); - entry=(Int_hashentry *)my_malloc(659, s); + entry=(Int_hashentry *)my_malloc(_ALLOC_ID_, s); entry->next=NULL; entry->token=NULL; - my_strdup(658, &entry->token, token); + my_strdup(_ALLOC_ID_, &entry->token, token); entry->value = value; entry->hash=hashcode; *preventry=entry; @@ -733,8 +733,8 @@ Int_hashentry *int_hash_lookup(Int_hashtable *hashtable, const char *token, cons if(what==XDELETE) /* remove token from the hash table ... */ { saveptr=entry->next; - my_free(896, &entry->token); - my_free(897, &entry); + my_free(_ALLOC_ID_, &entry->token); + my_free(_ALLOC_ID_, &entry); *preventry=saveptr; } else if(what == XINSERT ) { @@ -753,7 +753,7 @@ void int_hash_init(Int_hashtable *hashtable, int size) dbg(0, "int_hash_init(): Warning hash table not empty, possible data leak\n"); } hashtable->size = size; - hashtable->table = my_calloc(1576, size, sizeof(Int_hashentry *)); + hashtable->table = my_calloc(_ALLOC_ID_, size, sizeof(Int_hashentry *)); } static void int_hash_free_entry(Int_hashentry *entry) @@ -761,8 +761,8 @@ static void int_hash_free_entry(Int_hashentry *entry) Int_hashentry *tmp; while( entry ) { tmp = entry -> next; - my_free(1171, &(entry->token)); - my_free(1172, &entry); + my_free(_ALLOC_ID_, &(entry->token)); + my_free(_ALLOC_ID_, &entry); entry = tmp; } } @@ -778,7 +778,7 @@ void int_hash_free(Int_hashtable *hashtable) int_hash_free_entry( table[i] ); table[i] = NULL; } - my_free(1575, &(hashtable->table)); + my_free(_ALLOC_ID_, &(hashtable->table)); hashtable->size = 0; } } @@ -818,10 +818,10 @@ Ptr_hashentry *ptr_hash_lookup(Ptr_hashtable *hashtable, const char *token, void if(what==XINSERT || what == XINSERT_NOREPLACE) /* insert data */ { s=sizeof( Ptr_hashentry ); - entry=(Ptr_hashentry *)my_malloc(253, s); + entry=(Ptr_hashentry *)my_malloc(_ALLOC_ID_, s); entry->next=NULL; entry->token=NULL; - my_strdup(252, &entry->token, token); + my_strdup(_ALLOC_ID_, &entry->token, token); entry->value = value; entry->hash=hashcode; *preventry=entry; @@ -833,8 +833,8 @@ Ptr_hashentry *ptr_hash_lookup(Ptr_hashtable *hashtable, const char *token, void if(what==XDELETE) /* remove token from the hash table ... */ { saveptr=entry->next; - my_free(273, &entry->token); - my_free(274, &entry); + my_free(_ALLOC_ID_, &entry->token); + my_free(_ALLOC_ID_, &entry); *preventry=saveptr; } else if(what == XINSERT ) { @@ -853,7 +853,7 @@ void ptr_hash_init(Ptr_hashtable *hashtable, int size) dbg(0, "ptr_hash_init(): Warning hash table not empty, possible data leak\n"); } hashtable->size = size; - hashtable->table = my_calloc(1583, size, sizeof(Ptr_hashentry *)); + hashtable->table = my_calloc(_ALLOC_ID_, size, sizeof(Ptr_hashentry *)); } static void ptr_hash_free_entry(Ptr_hashentry *entry) @@ -861,8 +861,8 @@ static void ptr_hash_free_entry(Ptr_hashentry *entry) Ptr_hashentry *tmp; while( entry ) { tmp = entry -> next; - my_free(1584, &(entry->token)); - my_free(1585, &entry); + my_free(_ALLOC_ID_, &(entry->token)); + my_free(_ALLOC_ID_, &entry); entry = tmp; } } @@ -878,7 +878,7 @@ void ptr_hash_free(Ptr_hashtable *hashtable) ptr_hash_free_entry( table[i] ); table[i] = NULL; } - my_free(1586, &(hashtable->table)); + my_free(_ALLOC_ID_, &(hashtable->table)); hashtable->size = 0; } } diff --git a/src/store.c b/src/store.c index 542391ce..5c4b12c8 100644 --- a/src/store.c +++ b/src/store.c @@ -28,7 +28,7 @@ void check_wire_storage(void) if(xctx->wires >= xctx->maxw) { xctx->maxw=(1+xctx->wires / CADMAXWIRES)*CADMAXWIRES; - my_realloc(392, &xctx->wire, sizeof(xWire)*xctx->maxw); + my_realloc(_ALLOC_ID_, &xctx->wire, sizeof(xWire)*xctx->maxw); } } @@ -37,7 +37,7 @@ void check_selected_storage(void) if(xctx->lastsel >= xctx->maxsel) { xctx->maxsel=(1+xctx->lastsel / MAXGROUP) * MAXGROUP; - my_realloc(393, &xctx->sel_array, sizeof(Selected)*xctx->maxsel); + my_realloc(_ALLOC_ID_, &xctx->sel_array, sizeof(Selected)*xctx->maxsel); } } @@ -46,7 +46,7 @@ void check_text_storage(void) if(xctx->texts >= xctx->maxt) { xctx->maxt=(1 + xctx->texts / CADMAXTEXT) * CADMAXTEXT; - my_realloc(394, &xctx->text, sizeof(xText)*xctx->maxt); + my_realloc(_ALLOC_ID_, &xctx->text, sizeof(xText)*xctx->maxt); } } @@ -58,42 +58,42 @@ void check_symbol_storage(void) dbg(1, "check_symbol_storage(): more than maxs, %s\n", xctx->sch[xctx->currsch] ); xctx->maxs=(1 + xctx->symbols / ELEMDEF) * ELEMDEF; - my_realloc(395, &xctx->sym, sizeof(xSymbol)*xctx->maxs); + my_realloc(_ALLOC_ID_, &xctx->sym, sizeof(xSymbol)*xctx->maxs); for(i=xctx->symbols;imaxs;i++) { - xctx->sym[i].poly=my_calloc(68, cadlayers, sizeof(xPoly *)); + xctx->sym[i].poly=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *)); if(xctx->sym[i].poly==NULL){ fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit"); } - xctx->sym[i].arc=my_calloc(396, cadlayers, sizeof(xArc *)); + xctx->sym[i].arc=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *)); if(xctx->sym[i].arc==NULL){ fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit"); } - xctx->sym[i].line=my_calloc(397, cadlayers, sizeof(xLine *)); + xctx->sym[i].line=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *)); if(xctx->sym[i].line==NULL){ fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit"); } - xctx->sym[i].rect=my_calloc(398, cadlayers, sizeof(xRect *)); + xctx->sym[i].rect=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xRect *)); if(xctx->sym[i].rect==NULL){ fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit"); } - xctx->sym[i].lines=my_calloc(399, cadlayers, sizeof(int)); + xctx->sym[i].lines=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); if(xctx->sym[i].lines==NULL){ fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit"); } - xctx->sym[i].rects=my_calloc(400, cadlayers, sizeof(int)); + xctx->sym[i].rects=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); if(xctx->sym[i].rects==NULL){ fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit"); } - xctx->sym[i].polygons=my_calloc(401, cadlayers, sizeof(int)); + xctx->sym[i].polygons=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); if(xctx->sym[i].polygons==NULL){ fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit"); } - xctx->sym[i].arcs=my_calloc(66, cadlayers, sizeof(int)); + xctx->sym[i].arcs=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); if(xctx->sym[i].arcs==NULL){ fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit"); } @@ -109,7 +109,7 @@ void check_inst_storage(void) if(xctx->instances >= xctx->maxi) { xctx->maxi=(1 + xctx->instances / ELEMINST) * ELEMINST; - my_realloc(402, &xctx->inst, sizeof(xInstance)*xctx->maxi); + my_realloc(_ALLOC_ID_, &xctx->inst, sizeof(xInstance)*xctx->maxi); #ifdef ZERO_REALLOC memset(xctx->inst + xctx->instances, 0, sizeof(xInstance) * (xctx->maxi - xctx->instances)); #endif @@ -121,7 +121,7 @@ void check_arc_storage(int c) if(xctx->arcs[c] >= xctx->maxa[c]) { xctx->maxa[c]=(1 + xctx->arcs[c] / CADMAXOBJECTS) * CADMAXOBJECTS; - my_realloc(403, &xctx->arc[c], sizeof(xArc)*xctx->maxa[c]); + my_realloc(_ALLOC_ID_, &xctx->arc[c], sizeof(xArc)*xctx->maxa[c]); #ifdef ZERO_REALLOC memset(xctx->arc[c] + xctx->arcs[c], 0, sizeof(xArc) * (xctx->maxa[c] - xctx->arcs[c])); #endif @@ -133,7 +133,7 @@ void check_box_storage(int c) if(xctx->rects[c] >= xctx->maxr[c]) { xctx->maxr[c]=(1 + xctx->rects[c] / CADMAXOBJECTS) * CADMAXOBJECTS; - my_realloc(404, &xctx->rect[c], sizeof(xRect)*xctx->maxr[c]); + my_realloc(_ALLOC_ID_, &xctx->rect[c], sizeof(xRect)*xctx->maxr[c]); #ifdef ZERO_REALLOC memset(xctx->rect[c] + xctx->rects[c], 0, sizeof(xRect) * (xctx->maxr[c] - xctx->rects[c])); #endif @@ -145,7 +145,7 @@ void check_line_storage(int c) if(xctx->lines[c] >= xctx->maxl[c]) { xctx->maxl[c]=(1 + xctx->lines[c] / CADMAXOBJECTS) * CADMAXOBJECTS; - my_realloc(405, &xctx->line[c], sizeof(xLine)*xctx->maxl[c]); + my_realloc(_ALLOC_ID_, &xctx->line[c], sizeof(xLine)*xctx->maxl[c]); #ifdef ZERO_REALLOC memset(xctx->line[c] + xctx->lines[c], 0, sizeof(xLine) * (xctx->maxl[c] - xctx->lines[c])); #endif @@ -157,7 +157,7 @@ void check_polygon_storage(int c) if(xctx->polygons[c] >= xctx->maxp[c]) { xctx->maxp[c]=(1 + xctx->polygons[c] / CADMAXOBJECTS) * CADMAXOBJECTS; - my_realloc(406, &xctx->poly[c], sizeof(xPoly)*xctx->maxp[c]); + my_realloc(_ALLOC_ID_, &xctx->poly[c], sizeof(xPoly)*xctx->maxp[c]); #ifdef ZERO_REALLOC memset(xctx->poly[c] + xctx->polygons[c], 0, sizeof(xPoly) * (xctx->maxp[c] - xctx->polygons[c])); #endif @@ -185,7 +185,7 @@ void store_arc(int pos, double x, double y, double r, double a, double b, xctx->arc[rectc][n].a = a; xctx->arc[rectc][n].b = b; xctx->arc[rectc][n].prop_ptr = NULL; - my_strdup(407, &xctx->arc[rectc][n].prop_ptr, prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->arc[rectc][n].prop_ptr, prop_ptr); xctx->arc[rectc][n].sel = sel; if( !strcmp(get_tok_value(xctx->arc[rectc][n].prop_ptr,"fill",0),"true") ) xctx->arc[rectc][n].fill =1; @@ -223,10 +223,10 @@ void store_poly(int pos, double *x, double *y, int points, unsigned int rectc, xctx->poly[rectc][n].y=NULL; xctx->poly[rectc][n].selected_point=NULL; xctx->poly[rectc][n].prop_ptr=NULL; - xctx->poly[rectc][n].x= my_calloc(408, points, sizeof(double)); - xctx->poly[rectc][n].y= my_calloc(409, points, sizeof(double)); - xctx->poly[rectc][n].selected_point= my_calloc(410, points, sizeof(unsigned short)); - my_strdup(411, &xctx->poly[rectc][n].prop_ptr, prop_ptr); + xctx->poly[rectc][n].x= my_calloc(_ALLOC_ID_, points, sizeof(double)); + xctx->poly[rectc][n].y= my_calloc(_ALLOC_ID_, points, sizeof(double)); + xctx->poly[rectc][n].selected_point= my_calloc(_ALLOC_ID_, points, sizeof(unsigned short)); + my_strdup(_ALLOC_ID_, &xctx->poly[rectc][n].prop_ptr, prop_ptr); for(j=0;jpoly[rectc][n].x[j] = x[j]; xctx->poly[rectc][n].y[j] = y[j]; @@ -276,7 +276,7 @@ void storeobject(int pos, double x1,double y1,double x2,double y2, xctx->line[rectc][n].y1=y1; xctx->line[rectc][n].y2=y2; xctx->line[rectc][n].prop_ptr=NULL; - my_strdup(412, &xctx->line[rectc][n].prop_ptr, prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->line[rectc][n].prop_ptr, prop_ptr); xctx->line[rectc][n].sel=sel; if( prop_ptr && !strcmp(get_tok_value(prop_ptr, "bus", 0), "true") ) xctx->line[rectc][n].bus = 1; @@ -309,7 +309,7 @@ void storeobject(int pos, double x1,double y1,double x2,double y2, xctx->rect[rectc][n].y2=y2; xctx->rect[rectc][n].prop_ptr=NULL; xctx->rect[rectc][n].extraptr=NULL; - my_strdup(413, &xctx->rect[rectc][n].prop_ptr, prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->rect[rectc][n].prop_ptr, prop_ptr); xctx->rect[rectc][n].sel=sel; if(prop_ptr && (dash = get_tok_value(prop_ptr,"dash",0))[0]) { int d = atoi(dash); @@ -349,7 +349,7 @@ void storeobject(int pos, double x1,double y1,double x2,double y2, xctx->wire[n].node=NULL; xctx->wire[n].end1=0; xctx->wire[n].end2=0; - my_strdup(414, &xctx->wire[n].prop_ptr, prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->wire[n].prop_ptr, prop_ptr); if(prop_ptr && !strcmp(get_tok_value(prop_ptr,"bus",0), "true")) xctx->wire[n].bus=1; else xctx->wire[n].bus=0; xctx->wire[n].sel=sel; diff --git a/src/svgdraw.c b/src/svgdraw.c index e1ded9f1..dfd2ef0b 100644 --- a/src/svgdraw.c +++ b/src/svgdraw.c @@ -291,7 +291,7 @@ static void svg_draw_string(int layer, const char *str, short rot, short flip, i if(rot == 3 && flip == 1 ) { x=textx1;} } llength=0; - my_strdup2(465, &sss, str); + my_strdup2(_ALLOC_ID_, &sss, str); tt=ss=sss; for(;;) { c=*ss; @@ -309,7 +309,7 @@ static void svg_draw_string(int layer, const char *str, short rot, short flip, i } ss++; } - my_free(1154, &sss); + my_free(_ALLOC_ID_, &sss); } @@ -489,16 +489,16 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot, polygon = (symptr->poly[layer])[j]; { /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */ int k; - double *x = my_malloc(417, sizeof(double) * polygon.points); - double *y = my_malloc(418, sizeof(double) * polygon.points); + double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon.points); + double *y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon.points); for(k=0;karcs[layer];j++) { @@ -647,7 +647,7 @@ void svg_draw(void) else return; } svg_restore_lw(); - svg_colors=my_calloc(419, cadlayers, sizeof(Svg_color)); + svg_colors=my_calloc(_ALLOC_ID_, cadlayers, sizeof(Svg_color)); if(svg_colors==NULL){ fprintf(errfp, "svg_draw(): calloc error\n"); return; @@ -674,7 +674,7 @@ void svg_draw(void) } my_strncpy(xctx->plotfile,"", S(xctx->plotfile)); - unused_layer = my_calloc(873, cadlayers, sizeof(int)); + unused_layer = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); #if 0 * /* Determine used layers. Disabled since we want hilight colors */ * for(c=0;c\n"); fclose(fd); tclsetboolvar("draw_grid", old_grid); - my_free(964, &svg_colors); - my_free(1217, &unused_layer); + my_free(_ALLOC_ID_, &svg_colors); + my_free(_ALLOC_ID_, &unused_layer); Tcl_SetResult(interp,"",TCL_STATIC); } diff --git a/src/tedax_netlist.c b/src/tedax_netlist.c index 6c8caec6..e2a6367e 100644 --- a/src/tedax_netlist.c +++ b/src/tedax_netlist.c @@ -40,7 +40,7 @@ static void tedax_netlist(FILE *fd, int tedax_stop ) if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "tedax_ignore",0 ), "true") ) { continue; } - my_strdup(421, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && IS_PIN(type) ) { print_tedax_element(fd, i) ; /* this is the element line */ } @@ -52,7 +52,7 @@ static void tedax_netlist(FILE *fd, int tedax_stop ) if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "tedax_ignore",0 ), "true") ) { continue; } - my_strdup(423, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && !IS_LABEL_OR_PIN(type) ) { /* already done in global_tedax_netlist */ @@ -68,7 +68,7 @@ static void tedax_netlist(FILE *fd, int tedax_stop ) } } } - my_free(967, &type); + my_free(_ALLOC_ID_, &type); } if(!tedax_stop && !xctx->netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */ } @@ -92,7 +92,7 @@ static void tedax_block_netlist(FILE *fd, int i) fprintf(fd, "begin netlist v1 %s\n",skip_dir(xctx->sym[i].name)); print_tedax_subckt(fd, i); - my_strdup(420, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) ); + my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) ); /* this is now done in print_spice_subckt */ /* * fprintf(fd, "%s ", extra ? extra : "" ); @@ -100,7 +100,7 @@ static void tedax_block_netlist(FILE *fd, int i) /* 20081206 new get_sym_template does not return token=value pairs where token listed in extra */ fprintf(fd, "%s", get_sym_template(xctx->sym[i].templ, extra)); - my_free(966, &extra); + my_free(_ALLOC_ID_, &extra); fprintf(fd, "\n"); load_schematic(1,filename, 0); tedax_netlist(fd, tedax_stop); @@ -175,7 +175,7 @@ void global_tedax_netlist(int global) /* netlister driver */ /* warning if two symbols perfectly overlapped */ warning_overlapped_symbols(0); /* preserve current level instance flags before descending hierarchy for netlisting, restore later */ - stored_flags = my_calloc(149, xctx->instances, sizeof(unsigned int)); + stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int)); for(i=0;iinstances;i++) stored_flags[i] = xctx->inst[i].color; if(global) /* was if(global) ... 20180901 no hierarchical tEDAx netlist for now */ @@ -186,7 +186,7 @@ void global_tedax_netlist(int global) /* netlister driver */ /* reload data without popping undo stack, this populates embedded symbols if any */ xctx->pop_undo(2, 0); /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ - my_strdup(482, &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"); xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->currsch++; @@ -196,13 +196,13 @@ void global_tedax_netlist(int global) /* netlister driver */ { if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue; if(!xctx->sym[i].type) continue; - my_strdup2(1236, &abs_path, abs_sym_path(xctx->sym[i].name, "")); + my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, "")); if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path)) { tedax_block_netlist(fd, i); } } - my_free(1237, &abs_path); + my_free(_ALLOC_ID_, &abs_path); /*clear_drawing(); */ my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch])); xctx->currsch--; @@ -219,7 +219,7 @@ void global_tedax_netlist(int global) /* netlister driver */ for(i=0;iinstances; i++) xctx->inst[i].color = stored_flags[i]; propagate_hilights(1, 0, XINSERT_NOREPLACE); draw_hilight_net(1); - my_free(965, &stored_flags); + my_free(_ALLOC_ID_, &stored_flags); /* print globals nodes found in netlist 28032003 */ record_global_node(0,fd,NULL); diff --git a/src/token.c b/src/token.c index 7e2d674a..80e1052c 100644 --- a/src/token.c +++ b/src/token.c @@ -50,15 +50,15 @@ void hash_all_names(void) int_hash_init(&xctx->inst_table, HASHSIZE); for(i=0; iinstances; i++) { if(xctx->inst[i].instname && xctx->inst[i].instname[0]) { - my_strdup(1526, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if(!type) continue; - my_strdup(1254, &upinst, xctx->inst[i].instname); + my_strdup(_ALLOC_ID_, &upinst, xctx->inst[i].instname); strtoupper(upinst); int_hash_lookup(&xctx->inst_table, upinst, i, XINSERT); } } - my_free(1255, &upinst); - my_free(1527, &type); + my_free(_ALLOC_ID_, &upinst); + my_free(_ALLOC_ID_, &type); } const char *tcl_hook2(char **res) @@ -68,13 +68,13 @@ const char *tcl_hook2(char **res) char *unescaped_res; if(res == NULL || *res == NULL) { - my_free(1285, &result); + my_free(_ALLOC_ID_, &result); return empty; } if(strstr(*res, "tcleval(") == *res) { unescaped_res = str_replace(*res, "\\}", "}"); tclvareval("tclpropeval2 {", unescaped_res, "}" , NULL); - my_strdup2(1286, &result, tclresult()); + my_strdup2(_ALLOC_ID_, &result, tclresult()); /* dbg(0, "tcl_hook2: return: %s\n", result);*/ return result; } else { @@ -114,9 +114,9 @@ void check_unique_names(int rename) first = 1; for(i=0;iinstances;i++) { if(xctx->inst[i].instname && xctx->inst[i].instname[0]) { - my_strdup(1261, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if(!type) continue; - my_strdup(1246, &upinst, xctx->inst[i].instname); + my_strdup(_ALLOC_ID_, &upinst, xctx->inst[i].instname); strtoupper(upinst); if( (entry = int_hash_lookup(&xctx->inst_table, upinst, i, XINSERT_NOREPLACE) ) && entry->value != i) { dbg(1, "check_unique_names(): found duplicate: i=%d name=%s\n", i, xctx->inst[i].instname); @@ -135,19 +135,19 @@ void check_unique_names(int rename) } } if( (xctx->inst[i].color != -10000) && rename) { - my_strdup(511, &tmp, xctx->inst[i].prop_ptr); + my_strdup(_ALLOC_ID_, &tmp, xctx->inst[i].prop_ptr); new_prop_string(i, tmp, newpropcnt++, 0); - my_strdup(1259, &upinst, xctx->inst[i].instname); + my_strdup(_ALLOC_ID_, &upinst, xctx->inst[i].instname); strtoupper(upinst); int_hash_lookup(&xctx->inst_table, upinst, i, XINSERT); symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2); bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2); - my_free(972, &tmp); + my_free(_ALLOC_ID_, &tmp); } } } /* for(i...) */ - my_free(1247, &upinst); - my_free(1263, &type); + my_free(_ALLOC_ID_, &upinst); + my_free(_ALLOC_ID_, &type); if(rename == 1 && xctx->hilight_nets) { bbox(SET,0.0,0.0,0.0,0.0); draw(); @@ -202,8 +202,8 @@ int set_different_token(char **s,const char *new, const char *old, int object, i if(new==NULL) return 0; sizeval = sizetok = CADCHUNKALLOC; - my_realloc(427, &token, sizetok); - my_realloc(429, &value, sizeval); + my_realloc(_ALLOC_ID_, &token, sizetok); + my_realloc(_ALLOC_ID_, &value, sizeval); /* parse new string and add / change attributes that are missing / different from old */ while(1) { @@ -231,7 +231,7 @@ int set_different_token(char **s,const char *new, const char *old, int object, i value_pos=0; if(strcmp(value, get_tok_value(old,token,1))) { mod=1; - my_strdup(433, s, subst_token(*s, token, value) ); + my_strdup(_ALLOC_ID_, s, subst_token(*s, token, value) ); } state=TOK_BEGIN; } @@ -266,7 +266,7 @@ int set_different_token(char **s,const char *new, const char *old, int object, i get_tok_value(new,token,1); if(xctx->tok_size == 0 ) { mod=1; - my_strdup(443, s, subst_token(*s, token, NULL) ); + my_strdup(_ALLOC_ID_, s, subst_token(*s, token, NULL) ); } } else if(state==TOK_END) { value[value_pos]='\0'; @@ -276,8 +276,8 @@ int set_different_token(char **s,const char *new, const char *old, int object, i escape = (c=='\\' && !escape); if(c=='\0') break; } - my_free(974, &token); - my_free(975, &value); + my_free(_ALLOC_ID_, &token); + my_free(_ALLOC_ID_, &value); return mod; } @@ -296,12 +296,12 @@ const char *list_tokens(const char *s, int with_quotes) int escape=0; if(s==NULL) { - my_free(435, &token); + my_free(_ALLOC_ID_, &token); sizetok = 0; return ""; } sizetok = CADCHUNKALLOC; - my_realloc(451, &token, sizetok); + my_realloc(_ALLOC_ID_, &token, sizetok); token[0] = '\0'; while(1) { c=*s++; @@ -367,8 +367,8 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes) xctx->tok_size = 0; if(s==NULL) { if(tok == NULL) { - my_free(976, &result); - my_free(977, &token); + my_free(_ALLOC_ID_, &result); + my_free(_ALLOC_ID_, &token); size = sizetok = 0; dbg(2, "get_tok_value(): clear static data\n"); } @@ -377,8 +377,8 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes) /* dbg(0, "get_tok_value(): looking for <%s> in <%.30s>\n",tok,s); */ if( size == 0 ) { sizetok = size = CADCHUNKALLOC; - my_realloc(454, &result, size); - my_realloc(457, &token, sizetok); + my_realloc(_ALLOC_ID_, &result, size); + my_realloc(_ALLOC_ID_, &token, sizetok); } while(1) { c=*s++; @@ -391,11 +391,11 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes) /* don't use STR_ALLOC() for efficiency reasons */ if(value_pos>=size) { size+=CADCHUNKALLOC; - my_realloc(436, &result,size); + my_realloc(_ALLOC_ID_, &result,size); } if(token_pos>=sizetok) { sizetok+=CADCHUNKALLOC; - my_realloc(437, &token,sizetok); + my_realloc(_ALLOC_ID_, &token,sizetok); } if(c=='"') { if(!escape) quote=!quote; @@ -459,15 +459,15 @@ const char *get_sym_template(char *s,char *extra) dbg(1, "get_sym_template(): s=%s, extra=%s\n", s, extra); if(s==NULL) { - my_free(978, &result); + my_free(_ALLOC_ID_, &result); return ""; } l = strlen(s); STR_ALLOC(&result, l+1, &sizeres); result[0] = '\0'; sizetok = sizeval = CADCHUNKALLOC; - my_realloc(438, &value,sizeval); - my_realloc(439, &token,sizetok); + my_realloc(_ALLOC_ID_, &value,sizeval); + my_realloc(_ALLOC_ID_, &token,sizetok); while(1) { c=*s++; space=SPACE(c) ; @@ -516,8 +516,8 @@ const char *get_sym_template(char *s,char *extra) break; } } - my_free(979, &value); - my_free(980, &token); + my_free(_ALLOC_ID_, &value); + my_free(_ALLOC_ID_, &token); return result; } @@ -538,20 +538,20 @@ static char *get_pin_attr_from_inst(int inst, int pin, const char *attr) size_t tok_val_len; tok_val_len = strlen(str); attr_size = strlen(attr); - my_strdup(498, &pinname, str); - pname =my_malloc(49, tok_val_len + attr_size + 30); + my_strdup(_ALLOC_ID_, &pinname, str); + pname =my_malloc(_ALLOC_ID_, tok_val_len + attr_size + 30); my_snprintf(pname, tok_val_len + attr_size + 30, "%s(%s)", attr, pinname); - my_free(981, &pinname); + my_free(_ALLOC_ID_, &pinname); str = get_tok_value(xctx->inst[inst].prop_ptr, pname, 0); - my_free(982, &pname); - if(xctx->tok_size) my_strdup2(51, &pin_attr_value, str); + my_free(_ALLOC_ID_, &pname); + if(xctx->tok_size) my_strdup2(_ALLOC_ID_, &pin_attr_value, str); else { - pnumber = my_malloc(52, attr_size + 100); + pnumber = my_malloc(_ALLOC_ID_, attr_size + 100); my_snprintf(pnumber, attr_size + 100, "%s(%d)", attr, pin); str = get_tok_value(xctx->inst[inst].prop_ptr, pnumber, 0); dbg(1, "get_pin_attr_from_inst(): pnumber=%s\n", pnumber); - my_free(983, &pnumber); - if(xctx->tok_size) my_strdup2(40, &pin_attr_value, str); + my_free(_ALLOC_ID_, &pnumber); + if(xctx->tok_size) my_strdup2(_ALLOC_ID_, &pin_attr_value, str); } } return pin_attr_value; /* caller is responsible for freeing up storage for pin_attr_value */ @@ -583,19 +583,19 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names) } if(old_prop==NULL) { - my_free(984, &xctx->inst[i].prop_ptr); - my_strdup2(306, &xctx->inst[i].instname, ""); + my_free(_ALLOC_ID_, &xctx->inst[i].prop_ptr); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].instname, ""); return; } - old_name_len = my_strdup(444, &old_name,get_tok_value(old_prop,"name",0) ); /* added old_name_len */ - my_strdup(1256, &up_old_name, old_name); + old_name_len = my_strdup(_ALLOC_ID_, &old_name,get_tok_value(old_prop,"name",0) ); /* added old_name_len */ + my_strdup(_ALLOC_ID_, &up_old_name, old_name); strtoupper(up_old_name); if(old_name==NULL) { - my_strdup(446, &xctx->inst[i].prop_ptr, old_prop); /* changed to copy old props if no name */ - my_strdup2(13, &xctx->inst[i].instname, ""); - my_free(1579, &up_old_name); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, old_prop); /* changed to copy old props if no name */ + my_strdup2(_ALLOC_ID_, &xctx->inst[i].instname, ""); + my_free(_ALLOC_ID_, &up_old_name); return; } xctx->prefix=old_name[0]; @@ -604,17 +604,17 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names) if(dis_uniq_names || (entry = int_hash_lookup(&xctx->inst_table, up_old_name, i, XLOOKUP))==NULL || entry->value == i) { - my_strdup(447, &xctx->inst[i].prop_ptr, old_prop); - my_strdup2(90, &xctx->inst[i].instname, old_name); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, old_prop); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].instname, old_name); int_hash_lookup(&xctx->inst_table, up_old_name, i, XINSERT); - my_free(985, &old_name); - my_free(1578, &up_old_name); + my_free(_ALLOC_ID_, &old_name); + my_free(_ALLOC_ID_, &up_old_name); return; } - old_name_base = my_malloc(64, old_name_len+1); + old_name_base = my_malloc(_ALLOC_ID_, old_name_len+1); n = sscanf(old_name, "%[^[0-9]",old_name_base); tmp=find_bracket(old_name); - my_realloc(448, &new_name, old_name_len + 40); /* strlen(old_name)+40); */ + my_realloc(_ALLOC_ID_, &new_name, old_name_len + 40); /* strlen(old_name)+40); */ qq=fast ? last[(int)xctx->prefix] : 1; for(q=qq;;q++) { @@ -623,7 +623,7 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names) } else { /* goes here if weird name set for example to name=[3:0] or name=12 */ my_snprintf(new_name, old_name_len + 40, "%c%d%s", xctx->prefix,q, tmp); } - my_strdup(1258, &up_new_name, new_name); + my_strdup(_ALLOC_ID_, &up_new_name, new_name); strtoupper(up_new_name); if((entry = int_hash_lookup(&xctx->inst_table, up_new_name, i, XLOOKUP)) == NULL || entry->value == i) { @@ -631,17 +631,17 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names) break; } } - my_free(986, &old_name_base); + my_free(_ALLOC_ID_, &old_name_base); tmp2 = subst_token(old_prop, "name", new_name); if(strcmp(tmp2, old_prop) ) { - my_strdup(449, &xctx->inst[i].prop_ptr, tmp2); - my_strdup2(235, &xctx->inst[i].instname, new_name); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, tmp2); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].instname, new_name); int_hash_lookup(&xctx->inst_table, up_new_name, i, XINSERT); /* reinsert in hash */ } - my_free(987, &old_name); - my_free(1257, &up_old_name); - my_free(988, &new_name); - my_free(1260, &up_new_name); + my_free(_ALLOC_ID_, &old_name); + my_free(_ALLOC_ID_, &up_old_name); + my_free(_ALLOC_ID_, &new_name); + my_free(_ALLOC_ID_, &up_new_name); } @@ -693,22 +693,22 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 int no_of_pins=0; char *fmt_attr = NULL; - my_strdup(513, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); - my_strdup(514, &name, xctx->inst[inst].instname); + my_strdup(_ALLOC_ID_, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); + my_strdup(_ALLOC_ID_, &name, xctx->inst[inst].instname); fmt_attr = xctx->format ? xctx->format : "vhdl_format"; - if(!name) my_strdup(50, &name, get_tok_value(template, "name", 0)); + if(!name) my_strdup(_ALLOC_ID_, &name, get_tok_value(template, "name", 0)); /* allow format string override in instance */ - my_strdup(1000, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2)); if(!format && strcmp(fmt_attr, "vhdl_format")) - my_strdup(1630, &format, get_tok_value(xctx->inst[inst].prop_ptr, "vhdl_format", 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, "vhdl_format", 2)); if(!format) - my_strdup(516, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, fmt_attr, 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, fmt_attr, 2)); if(!format && strcmp(fmt_attr, "vhdl_format")) - my_strdup(1631, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "vhdl_format", 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "vhdl_format", 2)); if((name==NULL) || (format==NULL) ) { - my_free(1047, &template); - my_free(1048, &name); - my_free(1151, &format); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &format); return; /*do no netlist unwanted insts(no format) */ } no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; @@ -851,12 +851,12 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 size_t s; char *tclcmd=NULL; s = token_pos + strlen(name) + strlen(xctx->inst[inst].name) + 100; - tclcmd = my_malloc(518, s); + tclcmd = my_malloc(_ALLOC_ID_, s); Tcl_ResetResult(interp); my_snprintf(tclcmd, s, "tclpropeval {%s} {%s} {%s}", token, name, xctx->inst[inst].name); tcleval(tclcmd); fprintf(fd, "%s", tclresult()); - my_free(1049, &tclcmd); + my_free(_ALLOC_ID_, &tclcmd); } if(c!='%' && c!='@' && c!='\0' ) fputc(c,fd); @@ -872,10 +872,10 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 break ; } } - my_free(1050, &template); - my_free(1051, &format); - my_free(1052, &name); - my_free(1053, &token); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &format); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &token); } const char *subst_token(const char *s, const char *tok, const char *new_val) @@ -898,26 +898,26 @@ const char *subst_token(const char *s, const char *tok, const char *new_val) size_t new_val_len; if(s==NULL && tok == NULL){ - my_free(989, &result); + my_free(_ALLOC_ID_, &result); return ""; } if((tok == NULL || tok[0]=='\0') && s ){ - my_strdup2(458, &result, s); + my_strdup2(_ALLOC_ID_, &result, s); return result; } /* quote new_val if it contains newlines and not "name" token */ if(new_val) { new_val_len = strlen(new_val); if(strcmp(tok, "name") && !is_quoted(new_val) && strpbrk(new_val, ";\n \t")) { - new_val_copy = my_malloc(1210, new_val_len+3); + new_val_copy = my_malloc(_ALLOC_ID_, new_val_len+3); my_snprintf(new_val_copy, new_val_len+3, "\"%s\"", new_val); } - else my_strdup(1212, &new_val_copy, new_val); + else my_strdup(_ALLOC_ID_, &new_val_copy, new_val); } else new_val_copy = NULL; dbg(1, "subst_token(): %s, %s, %s\n", s ? s : "", tok ? tok : "", new_val ? new_val : ""); sizetok = size = CADCHUNKALLOC; - my_realloc(1152, &result, size); - my_realloc(1153, &token, sizetok); + my_realloc(_ALLOC_ID_, &result, size); + my_realloc(_ALLOC_ID_, &token, sizetok); result[0] = '\0'; while( s ) { c=*s++; @@ -1042,8 +1042,8 @@ const char *subst_token(const char *s, const char *tok, const char *new_val) } } dbg(2, "subst_token(): returning: %s\n",result); - my_free(990, &token); - my_free(1209, &new_val_copy); + my_free(_ALLOC_ID_, &token); + my_free(_ALLOC_ID_, &new_val_copy); return result; } @@ -1139,13 +1139,13 @@ void print_vhdl_element(FILE *fd, int inst) print_vhdl_primitive(fd, inst); return; } - my_strdup(462, &name,xctx->inst[inst].instname); - if(!name) my_strdup(58, &name, get_tok_value(template, "name", 0)); + my_strdup(_ALLOC_ID_, &name,xctx->inst[inst].instname); + if(!name) my_strdup(_ALLOC_ID_, &name, get_tok_value(template, "name", 0)); if(name==NULL) { - my_free(991, &name); + my_free(_ALLOC_ID_, &name); return; } - my_strdup(461, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); + my_strdup(_ALLOC_ID_, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; no_of_generics= (xctx->inst[inst].ptr + xctx->sym)->rects[GENERICLAYER]; @@ -1164,7 +1164,7 @@ void print_vhdl_element(FILE *fd, int inst) tmp=0; /* 20080213 use generic_type property to decide if some properties are strings, see later */ - my_strdup(464, &generic_type, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"generic_type", 0)); + my_strdup(_ALLOC_ID_, &generic_type, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"generic_type", 0)); while(1) { @@ -1229,10 +1229,10 @@ void print_vhdl_element(FILE *fd, int inst) /* print generic map */ for(i=0;iinst[inst].ptr + xctx->sym)->rect[GENERICLAYER][i].prop_ptr,"type",0)); - my_strdup(468, &generic_value, xctx->inst[inst].node[no_of_pins+i] ); - /*my_strdup(469, &generic_value, get_tok_value( */ + my_strdup(_ALLOC_ID_, &generic_value, xctx->inst[inst].node[no_of_pins+i] ); + /*my_strdup(_ALLOC_ID_, &generic_value, get_tok_value( */ /* (xctx->inst[inst].ptr + xctx->sym)->rect[GENERICLAYER][i].prop_ptr,"value") ); */ str_ptr = get_tok_value( (xctx->inst[inst].ptr + xctx->sym)->rect[GENERICLAYER][i].prop_ptr,"name",0); @@ -1271,12 +1271,12 @@ void print_vhdl_element(FILE *fd, int inst) int_hash_free(&table); fprintf(fd, "\n);\n\n"); dbg(2, "print_vhdl_element(): ------- end ------ \n"); - my_free(992, &name); - my_free(993, &generic_value); - my_free(994, &generic_type); - my_free(995, &template); - my_free(996, &value); - my_free(997, &token); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &generic_value); + my_free(_ALLOC_ID_, &generic_type); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &value); + my_free(_ALLOC_ID_, &token); } void print_generic(FILE *fd, char *ent_or_comp, int symbol) @@ -1293,12 +1293,12 @@ void print_generic(FILE *fd, char *ent_or_comp, int symbol) int escape=0; int token_number=0; - my_strdup(472, &template, xctx->sym[symbol].templ); + my_strdup(_ALLOC_ID_, &template, xctx->sym[symbol].templ); if( !template || !(template[0]) ) { - my_free(998, &template); + my_free(_ALLOC_ID_, &template); return; } - my_strdup(471, &generic_type, get_tok_value(xctx->sym[symbol].prop_ptr,"generic_type",0)); + my_strdup(_ALLOC_ID_, &generic_type, get_tok_value(xctx->sym[symbol].prop_ptr,"generic_type",0)); dbg(2, "print_generic(): symbol=%d template=%s \n", symbol, template); fprintf(fd, "%s %s ",ent_or_comp, skip_dir(xctx->sym[symbol].name)); @@ -1342,7 +1342,7 @@ void print_generic(FILE *fd, char *ent_or_comp, int symbol) token_number++; value[value_pos]='\0'; value_pos=0; - my_strdup(475, &type, get_tok_value(generic_type,token,0)); + my_strdup(_ALLOC_ID_, &type, get_tok_value(generic_type,token,0)); if(value[0] != '\0') /* token has a value */ { @@ -1369,9 +1369,9 @@ void print_generic(FILE *fd, char *ent_or_comp, int symbol) for(i=0;isym[symbol].rects[GENERICLAYER];i++) { - my_strdup(476, &generic_type, + my_strdup(_ALLOC_ID_, &generic_type, get_tok_value(xctx->sym[symbol].rect[GENERICLAYER][i].prop_ptr,"generic_type",0)); - my_strdup(477, &generic_value, + my_strdup(_ALLOC_ID_, &generic_value, get_tok_value(xctx->sym[symbol].rect[GENERICLAYER][i].prop_ptr,"value", 0) ); str_tmp = get_tok_value(xctx->sym[symbol].rect[GENERICLAYER][i].prop_ptr,"name",0); if(!tmp) fprintf(fd, "generic (\n"); @@ -1383,12 +1383,12 @@ void print_generic(FILE *fd, char *ent_or_comp, int symbol) tmp=1; } if(tmp) fprintf(fd, "\n);\n"); - my_free(999, &template); - my_free(1001, &value); - my_free(1002, &token); - my_free(1003, &type); - my_free(1004, &generic_type); - my_free(1005, &generic_value); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &value); + my_free(_ALLOC_ID_, &token); + my_free(_ALLOC_ID_, &type); + my_free(_ALLOC_ID_, &generic_type); + my_free(_ALLOC_ID_, &generic_value); } @@ -1403,13 +1403,13 @@ void print_verilog_param(FILE *fd, int symbol) int token_number=0; char *extra = NULL; - my_strdup(479, &template, xctx->sym[symbol].templ); /* 20150409 20171103 */ + my_strdup(_ALLOC_ID_, &template, xctx->sym[symbol].templ); /* 20150409 20171103 */ if( !template || !(template[0]) ) { - my_free(1006, &template); + my_free(_ALLOC_ID_, &template); return; } - my_strdup(480, &generic_type, get_tok_value(xctx->sym[symbol].prop_ptr,"generic_type",0)); - my_strdup(1558, &extra, get_tok_value(xctx->sym[symbol].prop_ptr,"extra",0) ); + my_strdup(_ALLOC_ID_, &generic_type, get_tok_value(xctx->sym[symbol].prop_ptr,"generic_type",0)); + my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[symbol].prop_ptr,"extra",0) ); dbg(2, "print_verilog_param(): symbol=%d template=%s \n", symbol, template); s=template; @@ -1471,11 +1471,11 @@ void print_verilog_param(FILE *fd, int symbol) break ; } } - my_free(1008, &template); - my_free(1009, &generic_type); - my_free(1010, &value); - my_free(1011, &token); - my_free(1007, &extra); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &generic_type); + my_free(_ALLOC_ID_, &value); + my_free(_ALLOC_ID_, &token); + my_free(_ALLOC_ID_, &extra); } @@ -1514,18 +1514,18 @@ void print_spice_subckt_nodes(FILE *fd, int symbol) const char *tclres, *fmt_attr = NULL; fmt_attr = xctx->format ? xctx->format : "format"; - my_strdup(103, &format1, get_tok_value(xctx->sym[symbol].prop_ptr, fmt_attr, 2)); + my_strdup(_ALLOC_ID_, &format1, get_tok_value(xctx->sym[symbol].prop_ptr, fmt_attr, 2)); if(!format1 && strcmp(fmt_attr, "format") ) - my_strdup(1632, &format1, get_tok_value(xctx->sym[symbol].prop_ptr, "format", 2)); + my_strdup(_ALLOC_ID_, &format1, get_tok_value(xctx->sym[symbol].prop_ptr, "format", 2)); dbg(1, "print_spice_subckt(): format1=%s\n", format1); if(format1 && strstr(format1, "tcleval(") == format1) { tclres = tcl_hook2(&format1); - if(!strcmp(tclres, "?\n")) my_strdup(1529, &format, format1 + 8); - else my_strdup(455, &format, tclres); + if(!strcmp(tclres, "?\n")) my_strdup(_ALLOC_ID_, &format, format1 + 8); + else my_strdup(_ALLOC_ID_, &format, tclres); } else { - my_strdup(1530, &format, format1); + my_strdup(_ALLOC_ID_, &format, format1); } - if(format1) my_free(1544, &format1); + if(format1) my_free(_ALLOC_ID_, &format1); dbg(1, "print_spice_subckt(): format=%s\n", format); if( format==NULL ) { return; /* no format */ @@ -1628,9 +1628,9 @@ void print_spice_subckt_nodes(FILE *fd, int symbol) break ; } } - my_free(1072, &format1); - my_free(1013, &format); - my_free(1014, &token); + my_free(_ALLOC_ID_, &format1); + my_free(_ALLOC_ID_, &format); + my_free(_ALLOC_ID_, &token); } int print_spice_element(FILE *fd, int inst) @@ -1654,27 +1654,27 @@ int print_spice_element(FILE *fd, int inst) const char *fmt_attr = NULL; size = CADCHUNKALLOC; - my_realloc(1211, &result, size); + my_realloc(_ALLOC_ID_, &result, size); result[0] = '\0'; - my_strdup(483, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); - my_strdup(484, &name,xctx->inst[inst].instname); - if (!name) my_strdup(43, &name, get_tok_value(template, "name", 0)); + my_strdup(_ALLOC_ID_, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); + my_strdup(_ALLOC_ID_, &name,xctx->inst[inst].instname); + if (!name) my_strdup(_ALLOC_ID_, &name, get_tok_value(template, "name", 0)); /* allow format string override in instance */ fmt_attr = xctx->format ? xctx->format : "format"; - my_strdup(470, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2)); if(!format && strcmp(fmt_attr, "format") ) - my_strdup(1633, &format, get_tok_value(xctx->inst[inst].prop_ptr, "format", 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, "format", 2)); if(!format) - my_strdup(486, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, fmt_attr, 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, fmt_attr, 2)); if(!format && strcmp(fmt_attr, "format")) - my_strdup(1634, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "format", 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "format", 2)); if ((name==NULL) || (format==NULL)) { - my_free(1015, &template); - my_free(1016, &format); - my_free(1017, &name); - my_free(1193, &result); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &format); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &result); return 0; /* do no netlist unwanted insts(no format) */ } no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; @@ -1725,7 +1725,7 @@ int print_spice_element(FILE *fd, int inst) tok_val_len = strlen(value); if(!strcmp(token, "@spiceprefix")) { - my_realloc(301, &spiceprefixtag, tok_val_len+22); + my_realloc(_ALLOC_ID_, &spiceprefixtag, tok_val_len+22); my_snprintf(spiceprefixtag, tok_val_len+22, "**** spice_prefix %s\n", value); value = spiceprefixtag; } @@ -1736,8 +1736,8 @@ int print_spice_element(FILE *fd, int inst) /* if (!strncmp(value,"tcleval(", 8)) { dbg(1, "print_spice_element(): value=%s\n", value); - my_strdup2(466, &translatedvalue, value); - my_strdup2(456, &translatedvalue, translate(inst, translatedvalue)); + my_strdup2(_ALLOC_ID_, &translatedvalue, value); + my_strdup2(_ALLOC_ID_, &translatedvalue, translate(inst, translatedvalue)); value = translatedvalue; } */ @@ -1886,7 +1886,7 @@ int print_spice_element(FILE *fd, int inst) char *tclcmd=NULL; const char *res; s = token_pos + strlen(name) + strlen(xctx->inst[inst].name) + 100; - tclcmd = my_malloc(488, s); + tclcmd = my_malloc(_ALLOC_ID_, s); Tcl_ResetResult(interp); my_snprintf(tclcmd, s, "tclpropeval {%s} {%s} {%s}", token, name, xctx->inst[inst].name); dbg(1, "print_spice_element(): tclpropeval {%s} {%s} {%s}", token, name, xctx->inst[inst].name); @@ -1897,7 +1897,7 @@ int print_spice_element(FILE *fd, int inst) STR_ALLOC(&result, tmp + result_pos, &size); result_pos += my_snprintf(result + result_pos, tmp, "%s", res); /* fprintf(fd, "%s", tclresult()); */ - my_free(1018, &tclcmd); + my_free(_ALLOC_ID_, &tclcmd); } /* /20171029 */ @@ -1927,7 +1927,7 @@ int print_spice_element(FILE *fd, int inst) /* do one level of substitutions to resolve @params and equations*/ if(result && strstr(result, "tcleval(")== result) { dbg(1, "print_spice_element(): before translate() result=%s\n", result); - my_strdup(22, &result, translate(inst, result)); + my_strdup(_ALLOC_ID_, &result, translate(inst, result)); dbg(1, "print_spice_element(): after translate() result=%s\n", result); } @@ -1945,19 +1945,19 @@ int print_spice_element(FILE *fd, int inst) * c++; * if(!*c) break; * } - * my_strdup2(88, &result, translate(inst, result+5)); + * my_strdup2(_ALLOC_ID_, &result, translate(inst, result+5)); * } #endif if(result) fprintf(fd, "%s", result); - my_free(1019, &template); - my_free(1020, &format); - my_free(1021, &name); - my_free(1022, &token); - my_free(1194, &result); - my_free(298, &spiceprefixtag); - /* my_free(455, &translatedvalue); */ + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &format); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &token); + my_free(_ALLOC_ID_, &result); + my_free(_ALLOC_ID_, &spiceprefixtag); + /* my_free(_ALLOC_ID_, &translatedvalue); */ return 1; } @@ -1983,24 +1983,24 @@ void print_tedax_element(FILE *fd, int inst) int no_of_pins=0; int subcircuit = 0; - my_strdup(489, &extra, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"extra",0)); - my_strdup(41, &extra_pinnumber, get_tok_value(xctx->inst[inst].prop_ptr,"extra_pinnumber",0)); - if(!extra_pinnumber) my_strdup(490, &extra_pinnumber, + my_strdup(_ALLOC_ID_, &extra, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"extra",0)); + my_strdup(_ALLOC_ID_, &extra_pinnumber, get_tok_value(xctx->inst[inst].prop_ptr,"extra_pinnumber",0)); + if(!extra_pinnumber) my_strdup(_ALLOC_ID_, &extra_pinnumber, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"extra_pinnumber",0)); - my_strdup(491, &template, + my_strdup(_ALLOC_ID_, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); - my_strdup(492, &numslots, get_tok_value(xctx->inst[inst].prop_ptr,"numslots",0)); - if(!numslots) my_strdup(493, &numslots, get_tok_value(template,"numslots",0)); - if(!numslots) my_strdup(494, &numslots, "1"); + my_strdup(_ALLOC_ID_, &numslots, get_tok_value(xctx->inst[inst].prop_ptr,"numslots",0)); + if(!numslots) my_strdup(_ALLOC_ID_, &numslots, get_tok_value(template,"numslots",0)); + if(!numslots) my_strdup(_ALLOC_ID_, &numslots, "1"); - my_strdup(495, &name,xctx->inst[inst].instname); + my_strdup(_ALLOC_ID_, &name,xctx->inst[inst].instname); /* my_strdup(xxx, &name,get_tok_value(xctx->inst[inst].prop_ptr,"name",0)); */ - if(!name) my_strdup(2, &name, get_tok_value(template, "name", 0)); + if(!name) my_strdup(_ALLOC_ID_, &name, get_tok_value(template, "name", 0)); /* allow format string override in instance */ - my_strdup(1185, &format, get_tok_value(xctx->inst[inst].prop_ptr,"tedax_format",2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr,"tedax_format",2)); if(!format || !format[0]) - my_strdup(497, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"tedax_format",2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"tedax_format",2)); no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; if( !format && !strcmp((xctx->inst[inst].ptr + xctx->sym)->type, "subcircuit") ) { @@ -2017,15 +2017,15 @@ void print_tedax_element(FILE *fd, int inst) fprintf(fd, "__subcircuit__ %s %s\n", skip_dir(xctx->inst[inst].name), xctx->inst[inst].instname); int_hash_init(&table, 37); for(i=0;iinst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr,"name",0)); - my_strdup2(1197, &pin, expandlabel(pinname, &pin_mult)); + my_strdup2(_ALLOC_ID_, &pin, expandlabel(pinname, &pin_mult)); if(!int_hash_lookup(&table, pinname, 1, XINSERT_NOREPLACE)) { dbg(1, "#net=%s pinname=%s pin=%s net_mult=%d pin_mult=%d\n", net, pinname, pin, net_mult, pin_mult); for(n = 0; n < net_mult; n++) { - my_strdup(1204, &netbit, find_nth(net, ",", n+1)); - my_strdup(1205, &pinbit, find_nth(pin, ",", n+1)); + my_strdup(_ALLOC_ID_, &netbit, find_nth(net, ",", n+1)); + my_strdup(_ALLOC_ID_, &pinbit, find_nth(pin, ",", n+1)); fprintf(fd, "__map__ %s -> %s\n", pinbit ? pinbit : "__UNCONNECTED_PIN__", netbit ? netbit : "__UNCONNECTED_PIN__"); @@ -2033,21 +2033,21 @@ void print_tedax_element(FILE *fd, int inst) } } int_hash_free(&table); - my_free(1199, &net); - my_free(1200, &pin); - my_free(1201, &pinname); - my_free(1206, &pinbit); - my_free(1207, &netbit); + my_free(_ALLOC_ID_, &net); + my_free(_ALLOC_ID_, &pin); + my_free(_ALLOC_ID_, &pinname); + my_free(_ALLOC_ID_, &pinbit); + my_free(_ALLOC_ID_, &netbit); fprintf(fd, "\n"); } if(name==NULL || !format || !format[0]) { - my_free(1023, &extra); - my_free(1024, &extra_pinnumber); - my_free(1025, &template); - my_free(1026, &numslots); - my_free(1027, &format); - my_free(1028, &name); + my_free(_ALLOC_ID_, &extra); + my_free(_ALLOC_ID_, &extra_pinnumber); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &numslots); + my_free(_ALLOC_ID_, &format); + my_free(_ALLOC_ID_, &name); return; } @@ -2057,10 +2057,10 @@ void print_tedax_element(FILE *fd, int inst) char *pinnumber; pinnumber = get_pin_attr_from_inst(inst, i, "pinnumber"); if(!pinnumber) { - my_strdup2(500, &pinnumber, + my_strdup2(_ALLOC_ID_, &pinnumber, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr,"pinnumber",0)); } - if(!xctx->tok_size) my_strdup(501, &pinnumber, "--UNDEF--"); + if(!xctx->tok_size) my_strdup(_ALLOC_ID_, &pinnumber, "--UNDEF--"); tmp = net_name(inst,i, &multip, 0, 1); if(tmp && !strstr(tmp, "__UNCONNECTED_PIN__")) { fprintf(fd, "conn %s %s %s %s %d\n", @@ -2070,7 +2070,7 @@ void print_tedax_element(FILE *fd, int inst) pinnumber, i+1); } - my_free(1029, &pinnumber); + my_free(_ALLOC_ID_, &pinnumber); } if(extra){ @@ -2210,8 +2210,8 @@ void print_tedax_element(FILE *fd, int inst) if( strchr(token, ':') ) { int n; - char *subtok = my_malloc(503, sizetok * sizeof(char)); - char *subtok2 = my_malloc(42, sizetok * sizeof(char)+20); + char *subtok = my_malloc(_ALLOC_ID_, sizetok * sizeof(char)); + char *subtok2 = my_malloc(_ALLOC_ID_, sizetok * sizeof(char)+20); subtok[0]='\0'; n=-1; sscanf(token+2, "%d:%s", &n, subtok); @@ -2232,8 +2232,8 @@ void print_tedax_element(FILE *fd, int inst) fprintf(fd, "%s", value); } } - my_free(1030, &subtok); - my_free(1031, &subtok2); + my_free(_ALLOC_ID_, &subtok); + my_free(_ALLOC_ID_, &subtok2); } else { /* reference by pin number instead of pin name, allows faster lookup of the attached net name */ /* @#n --> return net name attached to pin of index 'n' */ @@ -2249,12 +2249,12 @@ void print_tedax_element(FILE *fd, int inst) size_t s; char *tclcmd=NULL; s = token_pos + strlen(name) + strlen(xctx->inst[inst].name) + 100; - tclcmd = my_malloc(504, s); + tclcmd = my_malloc(_ALLOC_ID_, s); Tcl_ResetResult(interp); my_snprintf(tclcmd, s, "tclpropeval {%s} {%s} {%s}", token, name, xctx->inst[inst].name); tcleval(tclcmd); fprintf(fd, "%s", tclresult()); - my_free(1032, &tclcmd); + my_free(_ALLOC_ID_, &tclcmd); /* fprintf(errfp, "%s\n", tclcmd); */ } /* /20171029 */ @@ -2272,13 +2272,13 @@ void print_tedax_element(FILE *fd, int inst) } } /* if(format) */ if(!subcircuit) fprintf(fd,"end_inst\n"); - my_free(1033, &extra); - my_free(1034, &extra_pinnumber); - my_free(1035, &template); - my_free(1036, &numslots); - my_free(1037, &format); - my_free(1038, &name); - my_free(1039, &token); + my_free(_ALLOC_ID_, &extra); + my_free(_ALLOC_ID_, &extra_pinnumber); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &numslots); + my_free(_ALLOC_ID_, &format); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &token); } /* print verilog element if verilog_format is specified */ @@ -2297,25 +2297,25 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level int symbol = xctx->inst[inst].ptr; const char *fmt_attr = NULL; - my_strdup(519, &template, + my_strdup(_ALLOC_ID_, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); - my_strdup(520, &name,xctx->inst[inst].instname); - if(!name) my_strdup(4, &name, get_tok_value(template, "name", 0)); + my_strdup(_ALLOC_ID_, &name,xctx->inst[inst].instname); + if(!name) my_strdup(_ALLOC_ID_, &name, get_tok_value(template, "name", 0)); fmt_attr = xctx->format ? xctx->format : "verilog_format"; /* allow format string override in instance */ - my_strdup(1186, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2)); if(!format && strcmp(fmt_attr, "verilog_format") ) - my_strdup(1635, &format, get_tok_value(xctx->inst[inst].prop_ptr, "verilog_format", 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, "verilog_format", 2)); if(!format || !format[0]) - my_strdup(522, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, fmt_attr, 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, fmt_attr, 2)); if(!format && strcmp(fmt_attr, "verilog_format")) - my_strdup(1636, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "verilog_format", 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "verilog_format", 2)); if((name==NULL) || (format==NULL) ) { - my_free(1054, &template); - my_free(1055, &name); - my_free(1056, &format); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &format); return; /*do no netlist unwanted insts(no format) */ } no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; @@ -2452,12 +2452,12 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level size_t s; char *tclcmd=NULL; s = token_pos + strlen(name) + strlen(xctx->inst[inst].name) + 100; - tclcmd = my_malloc(524, s); + tclcmd = my_malloc(_ALLOC_ID_, s); Tcl_ResetResult(interp); my_snprintf(tclcmd, s, "tclpropeval {%s} {%s} {%s}", token, name, xctx->inst[inst].name); tcleval(tclcmd); fprintf(fd, "%s", tclresult()); - my_free(1057, &tclcmd); + my_free(_ALLOC_ID_, &tclcmd); } if(c!='%' && c!='@' && c!='\0') fputc(c,fd); if(c == '@' || c == '%') s--; @@ -2471,10 +2471,10 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level break ; } } - my_free(1058, &template); - my_free(1059, &format); - my_free(1060, &name); - my_free(1061, &token); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &format); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &token); } /* verilog module instantiation: @@ -2519,35 +2519,35 @@ void print_verilog_element(FILE *fd, int inst) return; } - my_strdup(507, &name,xctx->inst[inst].instname); - if(!name) my_strdup(3, &name, get_tok_value(template, "name", 0)); + my_strdup(_ALLOC_ID_, &name,xctx->inst[inst].instname); + if(!name) my_strdup(_ALLOC_ID_, &name, get_tok_value(template, "name", 0)); if(name==NULL) { - my_free(1041, &name); + my_free(_ALLOC_ID_, &name); return; } /* verilog_extra is the list of additional nodes passed as attributes */ - my_strdup(1562, &v_extra, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "verilog_extra", 0)); + my_strdup(_ALLOC_ID_, &v_extra, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "verilog_extra", 0)); /* extra is the list of attributes NOT to consider as instance parameters */ - my_strdup(1559, &extra, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "extra", 0)); - my_strdup(1619, &verilogprefix, + my_strdup(_ALLOC_ID_, &extra, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "extra", 0)); + my_strdup(_ALLOC_ID_, &verilogprefix, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "verilogprefix", 0)); if(verilogprefix) { - my_strdup(1620, &symname, verilogprefix); + my_strdup(_ALLOC_ID_, &symname, verilogprefix); my_strcat(1621, &symname, skip_dir(xctx->inst[inst].name)); } else { - my_strdup(1622, &symname, skip_dir(xctx->inst[inst].name)); + my_strdup(_ALLOC_ID_, &symname, skip_dir(xctx->inst[inst].name)); } - my_free(1624, &verilogprefix); - my_strdup(506, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); + my_free(_ALLOC_ID_, &verilogprefix); + my_strdup(_ALLOC_ID_, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; /* 20080915 use generic_type property to decide if some properties are strings, see later */ - my_strdup(505, &generic_type, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"generic_type",0)); + my_strdup(_ALLOC_ID_, &generic_type, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"generic_type",0)); s=xctx->inst[inst].prop_ptr; /* print instance subckt */ dbg(2, "print_verilog_element(): printing inst name & subcircuit name\n"); fprintf(fd, "%s\n", symname); - my_free(1623, &symname); + my_free(_ALLOC_ID_, &symname); /* -------- print generics passed as properties */ tmp=0; while(1) @@ -2659,13 +2659,13 @@ void print_verilog_element(FILE *fd, int inst) fprintf(fd, "\n);\n\n"); dbg(2, "print_verilog_element(): ------- end ------ \n"); - my_free(1042, &name); - my_free(1043, &generic_type); - my_free(1044, &template); - my_free(1045, &value); - my_free(1046, &token); - my_free(1560, &extra); - my_free(1567, &v_extra); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &generic_type); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &value); + my_free(_ALLOC_ID_, &token); + my_free(_ALLOC_ID_, &extra); + my_free(_ALLOC_ID_, &v_extra); } @@ -2689,14 +2689,14 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int } if(xctx->inst[i].node && xctx->inst[i].node[j] == NULL) { - my_strdup(1508, &pinname, get_tok_value( sym->rect[PINLAYER][j].prop_ptr,"name",0)); + my_strdup(_ALLOC_ID_, &pinname, get_tok_value( sym->rect[PINLAYER][j].prop_ptr,"name",0)); /* before reporting unconnected pin try to locate duplicated pin and use it if found */ for(k = 0; k < no_of_pins; k++) { const char *duplicated_pinname; if(k == j) continue; duplicated_pinname = get_tok_value( sym->rect[PINLAYER][k].prop_ptr,"name",0); if(!strcmp(duplicated_pinname , pinname)) { - my_strdup(1509, &pinname, duplicated_pinname); + my_strdup(_ALLOC_ID_, &pinname, duplicated_pinname); j = k; break; } @@ -2705,7 +2705,7 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int if(xctx->inst[i].node && xctx->inst[i].node[j] == NULL) { expandlabel(pinname, multip); - if(pinname) my_free(1511, &pinname); + if(pinname) my_free(_ALLOC_ID_, &pinname); if(erc) { my_snprintf(errstr, S(errstr), "Warning: unconnected pin, Inst idx: %d, Pin idx: %d Inst:%s\n", i, j, xctx->inst[i].instname ) ; @@ -2723,7 +2723,7 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int return expandlabel(unconn, &tmp); } else { /* xctx->inst[i].node[j] not NULL */ - if(pinname) my_free(1510, &pinname); + if(pinname) my_free(_ALLOC_ID_, &pinname); if((xctx->inst[i].node[j])[0] == '#') /* unnamed net */ { /* get unnamed node multiplicity ( minimum multip found in circuit) */ @@ -2778,14 +2778,14 @@ char *find_nth(const char *str, const char *sep, int n) int count = -1; if(!str) { - my_free(1062, &result); + my_free(_ALLOC_ID_, &result); result_size = 0; return NULL; } len = strlen(str) + 1; if(len > result_size) { result_size = len + CADCHUNKALLOC; - my_realloc(138, &result, result_size); + my_realloc(_ALLOC_ID_, &result, result_size); } memcpy(result, str, len); i = 0; @@ -2845,7 +2845,7 @@ const char *translate(int inst, const char* s) s_pnetname = tclgetboolvar("show_pin_net_names"); sp_prefix = tclgetboolvar("spiceprefix"); if(!s) { - my_free(1063, &result); + my_free(_ALLOC_ID_, &result); return empty; } @@ -2853,7 +2853,7 @@ const char *translate(int inst, const char* s) level = xctx->currsch; lcc = xctx->hier_attr; size=CADCHUNKALLOC; - my_realloc(527, &result,size); + my_realloc(_ALLOC_ID_, &result,size); result[0]='\0'; dbg(1, "translate(): substituting props in <%s>, instance <%s>\n", @@ -2924,8 +2924,8 @@ const char *translate(int inst, const char* s) } } else if(token[0]=='@' && token[1]=='#') { int n; - char *pin_attr = my_malloc(532, sizetok * sizeof(char)); - char *pin_num_or_name = my_malloc(55, sizetok * sizeof(char)); + char *pin_attr = my_malloc(_ALLOC_ID_, sizetok * sizeof(char)); + char *pin_num_or_name = my_malloc(_ALLOC_ID_, sizetok * sizeof(char)); pin_num_or_name[0]='\0'; pin_attr[0]='\0'; @@ -2949,7 +2949,7 @@ const char *translate(int inst, const char* s) pin_attr_value = get_pin_attr_from_inst(inst, n, pin_attr); /* get pin_attr from instance pin attribute string */ if(!pin_attr_value) { - my_strdup(499, &pin_attr_value, + my_strdup(_ALLOC_ID_, &pin_attr_value, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][n].prop_ptr, pin_attr, 0)); } } @@ -2961,21 +2961,21 @@ const char *translate(int inst, const char* s) if(s_pnetname && (!strcmp(get_tok_value(instprop, "net_name", 0), "true") || !strcmp(get_tok_value(symprop, "net_name", 0), "true"))) { prepare_netlist_structs(0); - my_strdup2(1175, &pin_attr_value, + my_strdup2(_ALLOC_ID_, &pin_attr_value, xctx->inst[inst].node && xctx->inst[inst].node[n] ? xctx->inst[inst].node[n] : "?"); /* do not show net_name: set to empty string */ } else { - my_strdup2(1178, &pin_attr_value, ""); + my_strdup2(_ALLOC_ID_, &pin_attr_value, ""); } } - if(!pin_attr_value ) my_strdup(379, &pin_attr_value, "--UNDEF--"); + if(!pin_attr_value ) my_strdup(_ALLOC_ID_, &pin_attr_value, "--UNDEF--"); value = pin_attr_value; /* recognize slotted devices: instname = "U3:3", value = "a:b:c:d" --> value = "c" */ if(value && value[0] != 0 && !strcmp(pin_attr, "pinnumber") ) { char *ss; int slot; char *tmpstr = NULL; - tmpstr = my_malloc(1176, sizeof(xctx->inst[inst].instname)); + tmpstr = my_malloc(_ALLOC_ID_, sizeof(xctx->inst[inst].instname)); if( (ss=strchr(xctx->inst[inst].instname, ':')) ) { sscanf(ss+1, "%s", tmpstr); if(isonlydigit(tmpstr)) { @@ -2983,16 +2983,16 @@ const char *translate(int inst, const char* s) if(strstr(value,":")) value = find_nth(value, ":", slot); } } - my_free(1177, &tmpstr); + my_free(_ALLOC_ID_, &tmpstr); } tmp=strlen(value); STR_ALLOC(&result, tmp + result_pos, &size); memcpy(result+result_pos, value, tmp+1); result_pos+=tmp; - my_free(1064, &pin_attr_value); + my_free(_ALLOC_ID_, &pin_attr_value); } - my_free(1065, &pin_attr); - my_free(1066, &pin_num_or_name); + my_free(_ALLOC_ID_, &pin_attr); + my_free(_ALLOC_ID_, &pin_num_or_name); } else if(strcmp(token,"@sch_last_modified")==0) { get_sch_from_sym(file_name, xctx->inst[inst].ptr + xctx->sym); @@ -3075,7 +3075,7 @@ const char *translate(int inst, const char* s) len = strlen(path) + strlen(net) + 1; dbg(1, "translate() @spice_get_voltage: inst=%s\n", xctx->inst[inst].instname); dbg(1, " net=%s, pin_prop_ptr=%s\n", net, pin_prop_ptr); - fqnet = my_malloc(1573, len); + fqnet = my_malloc(_ALLOC_ID_, len); my_snprintf(fqnet, len, "%s%s", path, net); strtolower(fqnet); dbg(1, "translate() @spice_get_voltage: fqnet=%s start_level=%d\n", fqnet, start_level); @@ -3097,7 +3097,7 @@ const char *translate(int inst, const char* s) result_pos += len; } dbg(1, "inst %d, net=%s, fqnet=%s idx=%d valstr=%s\n", inst, net, fqnet, idx, valstr); - my_free(1577, &fqnet); + my_free(_ALLOC_ID_, &fqnet); } } } @@ -3122,13 +3122,13 @@ const char *translate(int inst, const char* s) if(*path == '.') skip++; path++; } - net = my_malloc(1571, tmp); + net = my_malloc(_ALLOC_ID_, tmp); n = sscanf(token + 19, "%[^)]", net); if(n == 1) { strtolower(net); len = strlen(path) + strlen(xctx->inst[inst].instname) + strlen(net) + 2; dbg(1, "net=%s\n", net); - fqnet = my_malloc(1548, len); + fqnet = my_malloc(_ALLOC_ID_, len); my_snprintf(fqnet, len, "%s%s.%s", path, xctx->inst[inst].instname, net); strtolower(fqnet); dbg(1, "translate(): net=%s, fqnet=%s start_level=%d\n", net, fqnet, start_level); @@ -3150,9 +3150,9 @@ const char *translate(int inst, const char* s) result_pos += len; } dbg(1, "inst %d, net=%s, fqnet=%s idx=%d valstr=%s\n", inst, net, fqnet, idx, valstr); - my_free(1549, &fqnet); + my_free(_ALLOC_ID_, &fqnet); } - my_free(1570, &net); + my_free(_ALLOC_ID_, &net); } } } @@ -3175,14 +3175,14 @@ const char *translate(int inst, const char* s) if(*path == '.') skip++; path++; } - dev = my_malloc(1598, tmp); + dev = my_malloc(_ALLOC_ID_, tmp); n = sscanf(token + 19, "%[^)]", dev); if(n == 1) { strtolower(dev); len = strlen(path) + strlen(xctx->inst[inst].instname) + strlen(dev) + 21; /* some extra chars for i(..) wrapper */ dbg(1, "dev=%s\n", dev); - fqdev = my_malloc(1599, len); + fqdev = my_malloc(_ALLOC_ID_, len); if(!sim_is_xyce) { int prefix, vsource; char *prefix_ptr = strrchr(dev, '.'); /* last '.' in dev */ @@ -3217,9 +3217,9 @@ const char *translate(int inst, const char* s) result_pos += len; } dbg(1, "inst %d, dev=%s, fqdev=%s idx=%d valstr=%s\n", inst, dev, fqdev, idx, valstr); - my_free(1600, &fqdev); + my_free(_ALLOC_ID_, &fqdev); } /* if(n == 1) */ - my_free(1601, &dev); + my_free(_ALLOC_ID_, &dev); } /* if(path) */ } /* if((start_level = sch_waves_loaded()) >= 0 && xctx->graph_annotate_p>=0) */ } @@ -3248,13 +3248,13 @@ const char *translate(int inst, const char* s) net1 = net_name(inst, 0, &multip, 0, 0); len = strlen(path) + strlen(net1) + 1; dbg(1, "net1=%s\n", net1); - fqnet1 = my_malloc(1552, len); + fqnet1 = my_malloc(_ALLOC_ID_, len); my_snprintf(fqnet1, len, "%s%s", path, net1); strtolower(fqnet1); net2 = net_name(inst, 1, &multip, 0, 0); len = strlen(path) + strlen(net2) + 1; dbg(1, "net2=%s\n", net2); - fqnet2 = my_malloc(1554, len); + fqnet2 = my_malloc(_ALLOC_ID_, len); my_snprintf(fqnet2, len, "%s%s", path, net2); strtolower(fqnet2); dbg(1, "translate(): fqnet1=%s start_level=%d\n", fqnet1, start_level); @@ -3283,8 +3283,8 @@ const char *translate(int inst, const char* s) } dbg(1, "inst %d, fqnet1=%s fqnet2=%s idx1=%d idx2=%d, val1=%g val2=%g valstr=%s\n", inst, fqnet1, fqnet2, idx1, idx2, val1, val2, valstr); - my_free(1553, &fqnet1); - my_free(1555, &fqnet2); + my_free(_ALLOC_ID_, &fqnet1); + my_free(_ALLOC_ID_, &fqnet2); } } } @@ -3307,11 +3307,11 @@ const char *translate(int inst, const char* s) if(*path == '.') skip++; path++; } - my_strdup2(1550, &dev, xctx->inst[inst].instname); + my_strdup2(_ALLOC_ID_, &dev, xctx->inst[inst].instname); strtolower(dev); len = strlen(path) + strlen(dev) + 21; /* some extra chars for i(..) wrapper */ dbg(1, "dev=%s\n", dev); - fqdev = my_malloc(1556, len); + fqdev = my_malloc(_ALLOC_ID_, len); if(!sim_is_xyce) { int prefix=dev[0]; int vsource = (prefix == 'v') || (prefix == 'e'); @@ -3347,8 +3347,8 @@ const char *translate(int inst, const char* s) result_pos += len; } dbg(1, "inst %d, dev=%s, fqdev=%s idx=%d valstr=%s\n", inst, dev, fqdev, idx, valstr); - my_free(1557, &fqdev); - my_free(1551, &dev); + my_free(_ALLOC_ID_, &fqdev); + my_free(_ALLOC_ID_, &dev); } } } @@ -3408,18 +3408,18 @@ const char *translate(int inst, const char* s) } } else { int i = level; - my_strdup2(1521, &value1, value); + my_strdup2(_ALLOC_ID_, &value1, value); /* recursive substitution of value using parent level prop_str attributes */ while(i > 0) { const char *tok = get_tok_value(lcc[i-1].prop_ptr, value1, 0); if(xctx->tok_size && tok[0]) { dbg(1, "tok=%s\n", tok); - my_strdup2(1523, &value1, tok); + my_strdup2(_ALLOC_ID_, &value1, tok); } else { tok = get_tok_value(lcc[i-1].templ, value1, 0); if(xctx->tok_size && tok[0]) { dbg(1, "from parent template: tok=%s\n", tok); - my_strdup2(1614, &value1, tok); + my_strdup2(_ALLOC_ID_, &value1, tok); } } dbg(1, "2 translate(): lcc[%d].prop_ptr=%s, value1=%s\n", i-1, lcc[i-1].prop_ptr, value1); @@ -3429,7 +3429,7 @@ const char *translate(int inst, const char* s) STR_ALLOC(&result, tmp + result_pos, &size); memcpy(result+result_pos, value1, tmp+1); result_pos+=tmp; - my_free(1524, &value1); + my_free(_ALLOC_ID_, &value1); } } token_pos = 0; @@ -3445,7 +3445,7 @@ const char *translate(int inst, const char* s) } } dbg(2, "translate(): returning %s\n", result); - my_free(1067, &token); + my_free(_ALLOC_ID_, &token); /* if result is like: 'tcleval(some_string)' pass it thru tcl evaluation so expressions * can be calculated */ @@ -3463,11 +3463,11 @@ const char *translate2(Lcc *lcc, int level, char* s) char *token = NULL, *value = NULL; if(!s) { - my_free(1068, &result); + my_free(_ALLOC_ID_, &result); return empty; } size = CADCHUNKALLOC; - my_realloc(1528, &result, size); + my_realloc(_ALLOC_ID_, &result, size); result[0] = '\0'; dbg(1, "translate2(): s=%s, level=%d\n", s, level); while (1) { @@ -3494,13 +3494,13 @@ const char *translate2(Lcc *lcc, int level, char* s) dbg(1, "translate2(): lcc[%d].prop_ptr=%s token=%s\n", level, lcc[level].prop_ptr, token); /* if spiceprefix==0 and token == @spiceprefix then set empty value */ if(!tclgetboolvar("spiceprefix") && !strcmp(token, "@spiceprefix")) { - if(value) my_free(1069, &value); + if(value) my_free(_ALLOC_ID_, &value); xctx->tok_size = 0; } else if(token[0] == '@' && (token[1] == '@' || token[1] == '#')) { /* get rid of pin attribute info */ - if(value) my_free(1572, &value); + if(value) my_free(_ALLOC_ID_, &value); xctx->tok_size = 0; } else { - my_strdup2(332, &value, get_tok_value(lcc[level].prop_ptr, token + 1, 0)); + my_strdup2(_ALLOC_ID_, &value, get_tok_value(lcc[level].prop_ptr, token + 1, 0)); dbg(1, "translate2(): lcc[%d].prop_ptr=%s value=%s\n", level, lcc[level].prop_ptr, value); } if(xctx->tok_size && value[0]) { @@ -3510,7 +3510,7 @@ const char *translate2(Lcc *lcc, int level, char* s) const char *upperval = get_tok_value(lcc[i-1].prop_ptr, value, 0); dbg(1, "translate2(): lcc[%d].prop_ptr=%s upperval=%s\n", i-1, lcc[i-1].prop_ptr, upperval); if(xctx->tok_size && upperval[0]) { - my_strdup2(1615, &value, upperval); + my_strdup2(_ALLOC_ID_, &value, upperval); } else { break; } @@ -3534,7 +3534,7 @@ const char *translate2(Lcc *lcc, int level, char* s) } else if(strcmp(token,"@path")==0) { char *path = NULL; - my_strdup2(1617, &path, "@path@name\\."); + my_strdup2(_ALLOC_ID_, &path, "@path@name\\."); if(level > 1) { /* add parent LCC instance names (X1, Xinv etc) */ int i; for(i = 1; i inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && ( !IS_LABEL_OR_PIN(type) && strcmp(type,"netlist_commands")&& @@ -66,7 +66,7 @@ static void verilog_netlist(FILE *fd , int verilog_stop) else print_verilog_element(fd, i) ; /* this is the element line */ } } - my_free(1084, &type); + my_free(_ALLOC_ID_, &type); } dbg(1, "verilog_netlist(): end\n"); if(!verilog_stop && !xctx->netlist_count) redraw_hilights(0); /*draw_hilight_net(1); */ @@ -129,14 +129,14 @@ void global_verilog_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) { continue; } - my_strdup(105, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"timescale")==0 || strcmp(type,"verilog_preprocessor")==0) ) { str_tmp = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr , fmt_attr, 2); if(!str_tmp[0] && strcmp(fmt_attr, "verilog_format")) str_tmp = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_format", 2); - my_strdup(106, &tmp_string, str_tmp); + my_strdup(_ALLOC_ID_, &tmp_string, str_tmp); fprintf(fd, "%s\n", str_tmp ? translate(i, tmp_string) : "(NULL)"); } } @@ -163,7 +163,7 @@ void global_verilog_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) { continue; } - my_strdup(546, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"opin"))==0) { if(tmp) fprintf(fd, " ,\n"); @@ -181,7 +181,7 @@ void global_verilog_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) { continue; } - my_strdup(547, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"iopin"))==0) { if(tmp) fprintf(fd, " ,\n"); @@ -199,7 +199,7 @@ void global_verilog_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) { continue; } - my_strdup(548, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"ipin"))==0) { if(tmp) fprintf(fd, " ,\n"); @@ -231,12 +231,12 @@ void global_verilog_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) { continue; } - my_strdup(549, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"opin"))==0) { - my_strdup(550, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); - my_strdup(551, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0)); - if(!sig_type || sig_type[0]=='\0') my_strdup(552, &sig_type,"wire"); /* 20070720 changed reg to wire */ + my_strdup(_ALLOC_ID_, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0)); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"wire"); /* 20070720 changed reg to wire */ str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; fprintf(fd, " output %s ;\n", str_tmp ? str_tmp : "(NULL)"); fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "(NULL)"); @@ -254,12 +254,12 @@ void global_verilog_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) { continue; } - my_strdup(553, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"iopin"))==0) { - my_strdup(554, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); - my_strdup(555, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0)); - if(!sig_type || sig_type[0]=='\0') my_strdup(556, &sig_type,"wire"); + my_strdup(_ALLOC_ID_, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0)); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"wire"); str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; fprintf(fd, " inout %s ;\n", str_tmp ? str_tmp : "(NULL)"); fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "(NULL)"); @@ -277,12 +277,12 @@ void global_verilog_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) { continue; } - my_strdup(557, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"ipin"))==0) { - my_strdup(558, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); - my_strdup(559, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0)); - if(!sig_type || sig_type[0]=='\0') my_strdup(560, &sig_type,"wire"); + my_strdup(_ALLOC_ID_, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0)); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"wire"); str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; fprintf(fd, " input %s ;\n", str_tmp ? str_tmp : ""); fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : ""); @@ -303,7 +303,7 @@ void global_verilog_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) { continue; } - my_strdup(561, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if(type && !strcmp(type,"netlist_commands")) { fprintf(fd, "%s\n", get_tok_value(xctx->inst[i].prop_ptr,"value", 0)); } @@ -332,7 +332,7 @@ void global_verilog_netlist(int global) /* netlister driver */ /* warning if two symbols perfectly overlapped */ warning_overlapped_symbols(0); /* preserve current level instance flags before descending hierarchy for netlisting, restore later */ - stored_flags = my_calloc(150, xctx->instances, sizeof(unsigned int)); + stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int)); for(i=0;iinstances;i++) stored_flags[i] = xctx->inst[i].color; if(global) @@ -343,7 +343,7 @@ void global_verilog_netlist(int global) /* netlister driver */ /* reload data without popping undo stack, this populates embedded symbols if any */ xctx->pop_undo(2, 0); /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ - my_strdup(487, &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"); xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->currsch++; @@ -354,10 +354,10 @@ void global_verilog_netlist(int global) /* netlister driver */ { if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue; if(!xctx->sym[i].type) continue; - my_strdup2(1234, &abs_path, abs_sym_path(xctx->sym[i].name, "")); + my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, "")); if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path)) { /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ - my_strdup(328, &subckt_name, get_cell(xctx->sym[i].name, 0)); + my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) { str_hash_lookup(&subckt_table, subckt_name, "", XINSERT); @@ -371,9 +371,9 @@ void global_verilog_netlist(int global) /* netlister driver */ } } } - my_free(1235, &abs_path); + my_free(_ALLOC_ID_, &abs_path); str_hash_free(&subckt_table); - my_free(1073, &subckt_name); + my_free(_ALLOC_ID_, &subckt_name); my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch])); xctx->currsch--; unselect_all(1); @@ -388,7 +388,7 @@ void global_verilog_netlist(int global) /* netlister driver */ for(i=0;iinstances; i++) xctx->inst[i].color = stored_flags[i]; propagate_hilights(1, 0, XINSERT_NOREPLACE); draw_hilight_net(1); - my_free(1074, &stored_flags); + my_free(_ALLOC_ID_, &stored_flags); dbg(1, "global_verilog_netlist(): starting awk on netlist!\n"); if(!split_f) { @@ -403,10 +403,10 @@ void global_verilog_netlist(int global) /* netlister driver */ } if(debug_var == 0 ) xunlink(netl_filename); } - my_free(1075, &sig_type); - my_free(1076, &port_value); - my_free(1077, &tmp_string); - my_free(1078, &type); + my_free(_ALLOC_ID_, &sig_type); + my_free(_ALLOC_ID_, &port_value); + my_free(_ALLOC_ID_, &tmp_string); + my_free(_ALLOC_ID_, &type); xctx->netlist_count = 0; } @@ -454,8 +454,8 @@ void verilog_block_netlist(FILE *fd, int i) } else { Int_hashtable table = {NULL, 0}; int_hash_init(&table, 37); - my_strdup(1040, &extra, get_tok_value(xctx->sym[i].prop_ptr, "verilog_extra", 0)); - my_strdup(1563, &extra2, get_tok_value(xctx->sym[i].prop_ptr, "verilog_extra", 0)); + my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[i].prop_ptr, "verilog_extra", 0)); + my_strdup(_ALLOC_ID_, &extra2, get_tok_value(xctx->sym[i].prop_ptr, "verilog_extra", 0)); fprintf(fd, "// sch_path: %s\n", filename); verilog_stop? load_schematic(0,filename, 0) : load_schematic(1,filename, 0); /* print verilog timescale and preprocessor directives 10102004 */ @@ -467,32 +467,32 @@ void verilog_block_netlist(FILE *fd, int i) if(!strcmp(get_tok_value( (xctx->inst[j].ptr+ xctx->sym)->prop_ptr, "verilog_ignore",0 ), "true") ) { continue; } - my_strdup(544, &type,(xctx->inst[j].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[j].ptr+ xctx->sym)->type); if( type && ( strcmp(type,"timescale")==0 || strcmp(type,"verilog_preprocessor")==0) ) { str_tmp = get_tok_value( (xctx->inst[j].ptr+ xctx->sym)->prop_ptr, fmt_attr, 2); if(!str_tmp[0] && strcmp(fmt_attr, "verilog_format")) str_tmp = get_tok_value( (xctx->inst[j].ptr+ xctx->sym)->prop_ptr, "verilog_format", 2); - my_strdup(545, &tmp_string, str_tmp); + my_strdup(_ALLOC_ID_, &tmp_string, str_tmp); fprintf(fd, "%s\n", str_tmp ? translate(j, tmp_string) : "(NULL)"); } } - my_strdup(1618, &verilogprefix, + my_strdup(_ALLOC_ID_, &verilogprefix, get_tok_value(xctx->sym[i].prop_ptr, "verilogprefix", 0)); if(verilogprefix) { - my_strdup(1625, &symname, verilogprefix); + my_strdup(_ALLOC_ID_, &symname, verilogprefix); my_strcat(1626, &symname, skip_dir(xctx->sym[i].name)); } else { - my_strdup(1627, &symname, skip_dir(xctx->sym[i].name)); + my_strdup(_ALLOC_ID_, &symname, skip_dir(xctx->sym[i].name)); } - my_free(1628, &verilogprefix); + my_free(_ALLOC_ID_, &verilogprefix); fprintf(fd, "module %s (\n", symname); - my_free(1629, &symname); + my_free(_ALLOC_ID_, &symname); /*print_generic(fd, "entity", i); */ dbg(1, "verilog_block_netlist(): entity ports\n"); @@ -531,15 +531,15 @@ void verilog_block_netlist(FILE *fd, int i) for(j=0;jsym[i].rects[PINLAYER];j++) { if(strcmp(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"verilog_ignore",0), "true")) { - my_strdup(564, &sig_type,get_tok_value( + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value( xctx->sym[i].rect[PINLAYER][j].prop_ptr,"verilog_type",0)); - my_strdup(565, &port_value, + my_strdup(_ALLOC_ID_, &port_value, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"value", 0) ); - my_strdup(566, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) ); + my_strdup(_ALLOC_ID_, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) ); if(strcmp(dir_tmp,"in")){ - if(!sig_type || sig_type[0]=='\0') my_strdup(567, &sig_type,"wire"); /* 20070720 changed reg to wire */ + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"wire"); /* 20070720 changed reg to wire */ } else { - if(!sig_type || sig_type[0]=='\0') my_strdup(568, &sig_type,"wire"); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"wire"); } str_tmp = get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"name",0); if(!int_hash_lookup(&table, str_tmp, 1, XINSERT_NOREPLACE)) { @@ -574,7 +574,7 @@ void verilog_block_netlist(FILE *fd, int i) if(xctx->netlist_count && !strcmp(get_tok_value(xctx->inst[l].prop_ptr, "only_toplevel", 0), "true")) continue; - my_strdup(569, &type,(xctx->inst[l].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[l].ptr+ xctx->sym)->type); if(type && !strcmp(type,"netlist_commands")) { fprintf(fd, "%s\n", get_tok_value(xctx->inst[l].prop_ptr,"value", 0)); } @@ -585,13 +585,13 @@ void verilog_block_netlist(FILE *fd, int i) } fprintf(fd,"---- end user architecture code\n"); fprintf(fd, "endmodule\n"); - my_free(1079, &dir_tmp); - my_free(1080, &sig_type); - my_free(1081, &port_value); - my_free(1082, &type); - my_free(1083, &tmp_string); - my_free(1561, &extra); - my_free(1564, &extra2); + my_free(_ALLOC_ID_, &dir_tmp); + my_free(_ALLOC_ID_, &sig_type); + my_free(_ALLOC_ID_, &port_value); + my_free(_ALLOC_ID_, &type); + my_free(_ALLOC_ID_, &tmp_string); + my_free(_ALLOC_ID_, &extra); + my_free(_ALLOC_ID_, &extra2); } /* if(!sym_def[0]) */ if(split_f) { int save; diff --git a/src/vhdl_netlist.c b/src/vhdl_netlist.c index b66e1c3d..6fe0cb78 100644 --- a/src/vhdl_netlist.c +++ b/src/vhdl_netlist.c @@ -63,7 +63,7 @@ static void vhdl_netlist(FILE *fd , int vhdl_stop) if(!strcmp(get_tok_value( (xctx->inst[l].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) { continue; } - my_strdup(602, &type,(xctx->inst[l].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[l].ptr+ xctx->sym)->type); if( type && (strcmp(type,"attributes"))==0) { if(xctx->inst[l].prop_ptr) fprintf(fd, "\n%s\n", xctx->inst[l].prop_ptr); @@ -83,7 +83,7 @@ static void vhdl_netlist(FILE *fd , int vhdl_stop) continue; } dbg(2, "vhdl_netlist(): into the netlisting loop\n"); - my_strdup(603, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && ( !IS_LABEL_OR_PIN(type) && strcmp(type,"generic")&& @@ -106,7 +106,7 @@ static void vhdl_netlist(FILE *fd , int vhdl_stop) } } } - if(type) my_free(1097, &type); + if(type) my_free(_ALLOC_ID_, &type); dbg(1, "vhdl_netlist(): end\n"); if(!vhdl_stop && !xctx->netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */ } @@ -167,7 +167,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ } - my_strdup(571, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"package"))==0) { if(xctx->inst[i].prop_ptr) { /* */ @@ -186,7 +186,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) { continue; } - my_strdup(572, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"use"))==0) { if(xctx->inst[i].prop_ptr) fprintf(fd, "%s\n", xctx->inst[i].prop_ptr); @@ -255,9 +255,9 @@ void global_vhdl_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) { continue; } - my_strdup(577, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); - if(!sig_type || sig_type[0]=='\0') my_strdup(578, &sig_type,"std_logic"); - my_strdup(579, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"opin"))==0) { str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; @@ -276,9 +276,9 @@ void global_vhdl_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) { continue; } - my_strdup(580, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); - if(!sig_type || sig_type[0]=='\0') my_strdup(581, &sig_type,"std_logic"); - my_strdup(582, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"iopin"))==0) { str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; @@ -297,9 +297,9 @@ void global_vhdl_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) { continue; } - my_strdup(583, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); - if(!sig_type || sig_type[0]=='\0') my_strdup(584, &sig_type,"std_logic"); - my_strdup(585, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"ipin"))==0) { str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; @@ -319,7 +319,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) { continue; } - my_strdup(586, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"port_attributes"))==0) { if(xctx->inst[i].prop_ptr) fprintf(fd, "%s\n", xctx->inst[i].prop_ptr); @@ -339,7 +339,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ if( strcmp(get_tok_value(xctx->sym[j].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; if(!xctx->sym[j].type || (strcmp(xctx->sym[j].type,"primitive")!=0 && strcmp(xctx->sym[j].type,"subcircuit")!=0)) continue; - my_strdup(1240, &abs_path, abs_sym_path(xctx->sym[j].name, "")); + my_strdup(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[j].name, "")); if(( strcmp(xctx->sym[j].type,"subcircuit")==0 || strcmp(xctx->sym[j].type,"primitive")==0 @@ -347,7 +347,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ ) { /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ - my_strdup(317, &subckt_name, get_cell(xctx->sym[j].name, 0)); + my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[j].name, 0)); if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) { Int_hashtable table = {NULL, 0}; str_hash_lookup(&subckt_table, subckt_name, "", XINSERT); @@ -360,12 +360,12 @@ void global_vhdl_netlist(int global) /* netlister driver */ for(i=0;isym[j].rects[PINLAYER];i++) { if(strcmp(get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"vhdl_ignore",0), "true")) { - my_strdup(587, &sig_type,get_tok_value( + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value( xctx->sym[j].rect[PINLAYER][i].prop_ptr,"sig_type",0)); - my_strdup(588, &port_value, + my_strdup(_ALLOC_ID_, &port_value, get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"value", 0) ); - if(!sig_type || sig_type[0]=='\0') my_strdup(589, &sig_type,"std_logic"); - my_strdup(590, &dir_tmp, get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"dir",0) ); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); + my_strdup(_ALLOC_ID_, &dir_tmp, get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"dir",0) ); str_tmp = get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"name",0); if(!int_hash_lookup(&table, str_tmp, 1, XINSERT_NOREPLACE)) { if(!tmp) fprintf(fd, "port (\n"); @@ -375,7 +375,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ fprintf(fd," := %s", port_value); tmp=1; } - my_free(1085, &dir_tmp); + my_free(_ALLOC_ID_, &dir_tmp); } } int_hash_free(&table); @@ -383,10 +383,10 @@ void global_vhdl_netlist(int global) /* netlister driver */ fprintf(fd, "end component ;\n\n"); } } - my_free(1241, &abs_path); + my_free(_ALLOC_ID_, &abs_path); } str_hash_free(&subckt_table); - my_free(1086, &subckt_name); + my_free(_ALLOC_ID_, &subckt_name); dbg(1, "global_vhdl_netlist(): netlisting top level\n"); vhdl_netlist(fd, 0); @@ -398,7 +398,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ if(!strcmp(get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) { continue; } - my_strdup(591, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if(type && !strcmp(type,"netlist_commands")) { fprintf(fd, "%s\n", get_tok_value(xctx->inst[i].prop_ptr,"value", 0)); } @@ -426,7 +426,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ /* warning if two symbols perfectly overlapped */ warning_overlapped_symbols(0); /* preserve current level instance flags before descending hierarchy for netlisting, restore later */ - stored_flags = my_calloc(151, xctx->instances, sizeof(unsigned int)); + stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int)); for(i=0;iinstances;i++) stored_flags[i] = xctx->inst[i].color; if(global) @@ -438,7 +438,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ /* reload data without popping undo stack, this populates embedded symbols if any */ xctx->pop_undo(2, 0); /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ - my_strdup(502, &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"); xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->currsch++; @@ -449,11 +449,11 @@ void global_vhdl_netlist(int global) /* netlister driver */ { if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; if(!xctx->sym[i].type) continue; - my_strdup(1242, &abs_path, abs_sym_path(xctx->sym[i].name, "")); + my_strdup(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, "")); if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path)) { /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ - my_strdup(327, &subckt_name, get_cell(xctx->sym[i].name, 0)); + my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) { str_hash_lookup(&subckt_table, subckt_name, "", XINSERT); @@ -466,10 +466,10 @@ void global_vhdl_netlist(int global) /* netlister driver */ vhdl_block_netlist(fd, i); } } - my_free(1243, &abs_path); + my_free(_ALLOC_ID_, &abs_path); } str_hash_free(&subckt_table); - my_free(1087, &subckt_name); + my_free(_ALLOC_ID_, &subckt_name); my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch])); xctx->currsch--; unselect_all(1); @@ -484,7 +484,7 @@ void global_vhdl_netlist(int global) /* netlister driver */ for(i=0;iinstances; i++) xctx->inst[i].color = stored_flags[i]; propagate_hilights(1, 0, XINSERT_NOREPLACE); draw_hilight_net(1); - my_free(1088, &stored_flags); + my_free(_ALLOC_ID_, &stored_flags); dbg(1, "global_vhdl_netlist(): starting awk on netlist!\n"); if(!split_f) { fclose(fd); @@ -498,9 +498,9 @@ void global_vhdl_netlist(int global) /* netlister driver */ } if(!debug_var) xunlink(netl_filename); } - my_free(1089, &sig_type); - my_free(1090, &type); - my_free(1091, &port_value); + my_free(_ALLOC_ID_, &sig_type); + my_free(_ALLOC_ID_, &type); + my_free(_ALLOC_ID_, &port_value); xctx->netlist_count = 0; } @@ -584,12 +584,12 @@ void vhdl_block_netlist(FILE *fd, int i) for(j=0;jsym[i].rects[PINLAYER];j++) { if(strcmp(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"vhdl_ignore",0), "true")) { - my_strdup(592, &sig_type, + my_strdup(_ALLOC_ID_, &sig_type, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"sig_type",0)); - my_strdup(593, &port_value, + my_strdup(_ALLOC_ID_, &port_value, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"value", 0) ); - if(!sig_type || sig_type[0]=='\0') my_strdup(594, &sig_type,"std_logic"); - my_strdup(595, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) ); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); + my_strdup(_ALLOC_ID_, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) ); str_tmp = get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"name",0); if(!int_hash_lookup(&table, str_tmp, 1, XINSERT_NOREPLACE)) { if(tmp) fprintf(fd, " ;\n"); @@ -600,7 +600,7 @@ void vhdl_block_netlist(FILE *fd, int i) fprintf(fd," := %s", port_value); tmp=1; } - my_free(1092, &dir_tmp); + my_free(_ALLOC_ID_, &dir_tmp); } } int_hash_free(&table); @@ -614,7 +614,7 @@ void vhdl_block_netlist(FILE *fd, int i) if(!strcmp(get_tok_value( (xctx->inst[l].ptr+ xctx->sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) { continue; } - my_strdup(596, &type,(xctx->inst[l].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[l].ptr+ xctx->sym)->type); if( type && (strcmp(type,"port_attributes"))==0) { if(xctx->inst[l].prop_ptr) fprintf(fd, "%s\n", xctx->inst[l].prop_ptr); @@ -637,7 +637,7 @@ void vhdl_block_netlist(FILE *fd, int i) if(!xctx->sym[j].type || (strcmp(xctx->sym[j].type,"primitive")!=0 && strcmp(xctx->sym[j].type,"subcircuit")!=0)) continue; - my_strdup2(1238, &abs_path, abs_sym_path(xctx->sym[i].name, "")); + my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, "")); if(( strcmp(xctx->sym[j].type,"subcircuit")==0 || strcmp(xctx->sym[j].type,"primitive")==0) && check_lib(1, abs_path) ) { @@ -665,19 +665,19 @@ void vhdl_block_netlist(FILE *fd, int i) for(k=0;ksym[j].rects[PINLAYER];k++) { if(strcmp(get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"vhdl_ignore",0), "true")) { - my_strdup(597, &sig_type,get_tok_value( + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value( xctx->sym[j].rect[PINLAYER][k].prop_ptr,"sig_type",0)); - my_strdup(598, &port_value, + my_strdup(_ALLOC_ID_, &port_value, get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"value", 0) ); - if(!sig_type || sig_type[0]=='\0') my_strdup(599, &sig_type,"std_logic"); - my_strdup(600, &dir_tmp, get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"dir",0) ); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); + my_strdup(_ALLOC_ID_, &dir_tmp, get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"dir",0) ); str_tmp = get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"name",0); if(!int_hash_lookup(&table, str_tmp, 1, XINSERT_NOREPLACE)) { if(!tmp) fprintf(fd, "port (\n"); if(tmp) fprintf(fd, " ;\n"); fprintf(fd," %s : %s %s",str_tmp, dir_tmp ? dir_tmp : "", sig_type); - my_free(1093, &dir_tmp); + my_free(_ALLOC_ID_, &dir_tmp); if(port_value &&port_value[0]) fprintf(fd," := %s", port_value); tmp=1; } @@ -689,7 +689,7 @@ void vhdl_block_netlist(FILE *fd, int i) } } /* for(j...) */ } /* if(!vhdl_stop) */ - my_free(1239, &abs_path); + my_free(_ALLOC_ID_, &abs_path); dbg(1, "vhdl_block_netlist(): netlisting %s\n", skip_dir( xctx->sch[xctx->currsch])); vhdl_netlist(fd, vhdl_stop); fprintf(fd,"//// begin user architecture code\n"); @@ -703,7 +703,7 @@ void vhdl_block_netlist(FILE *fd, int i) if(xctx->netlist_count && !strcmp(get_tok_value(xctx->inst[l].prop_ptr, "only_toplevel", 0), "true")) continue; - my_strdup(601, &type,(xctx->inst[l].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[l].ptr+ xctx->sym)->type); if(type && !strcmp(type,"netlist_commands")) { fprintf(fd, "%s\n", get_tok_value(xctx->inst[l].prop_ptr,"value", 0)); } @@ -711,9 +711,9 @@ void vhdl_block_netlist(FILE *fd, int i) if(xctx->schvhdlprop && xctx->schvhdlprop[0]) fprintf(fd, "%s\n", xctx->schvhdlprop); fprintf(fd, "end arch_%s ;\n\n", skip_dir(xctx->sym[i].name) ); /* skip_dir( xctx->sch[xctx->currsch]) ); */ - my_free(1094, &sig_type); - my_free(1095, &port_value); - my_free(1096, &type); + my_free(_ALLOC_ID_, &sig_type); + my_free(_ALLOC_ID_, &port_value); + my_free(_ALLOC_ID_, &type); } /* if(!sym_def[0]) */ if(split_f) { int save; diff --git a/src/xinit.c b/src/xinit.c index 09de49f8..101829d7 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -290,7 +290,7 @@ static void init_color_array(double dim, double dim_bg) if(g>0xff) g=0xff; if(b>0xff) b=0xff; my_snprintf(s, S(s), "#%02x%02x%02x", r, g, b); - my_strdup(643, &xctx->color_array[i], s); + my_strdup(_ALLOC_ID_, &xctx->color_array[i], s); } } @@ -322,64 +322,64 @@ static void free_xschem_data() xctx->delete_undo(); free_simdata(); - my_free(970, &xctx->node_table); - my_free(1385, &xctx->inst_table); - my_free(1387, &xctx->hilight_table); + my_free(_ALLOC_ID_, &xctx->node_table); + my_free(_ALLOC_ID_, &xctx->inst_table); + my_free(_ALLOC_ID_, &xctx->hilight_table); - my_free(1098, &xctx->wire); - my_free(1100, &xctx->text); - my_free(1107, &xctx->inst); + my_free(_ALLOC_ID_, &xctx->wire); + my_free(_ALLOC_ID_, &xctx->text); + my_free(_ALLOC_ID_, &xctx->inst); for(i=0;irect[i]); - my_free(1104, &xctx->line[i]); - my_free(1105, &xctx->poly[i]); - my_free(1106, &xctx->arc[i]); + my_free(_ALLOC_ID_, &xctx->rect[i]); + my_free(_ALLOC_ID_, &xctx->line[i]); + my_free(_ALLOC_ID_, &xctx->poly[i]); + my_free(_ALLOC_ID_, &xctx->arc[i]); } for(i=0;imaxs;i++) { - my_free(1109, &xctx->sym[i].line); - my_free(1110, &xctx->sym[i].rect); - my_free(1111, &xctx->sym[i].arc); - my_free(1112, &xctx->sym[i].poly); - my_free(1113, &xctx->sym[i].lines); - my_free(1114, &xctx->sym[i].polygons); - my_free(1115, &xctx->sym[i].arcs); - my_free(1116, &xctx->sym[i].rects); + my_free(_ALLOC_ID_, &xctx->sym[i].line); + my_free(_ALLOC_ID_, &xctx->sym[i].rect); + my_free(_ALLOC_ID_, &xctx->sym[i].arc); + my_free(_ALLOC_ID_, &xctx->sym[i].poly); + my_free(_ALLOC_ID_, &xctx->sym[i].lines); + my_free(_ALLOC_ID_, &xctx->sym[i].polygons); + my_free(_ALLOC_ID_, &xctx->sym[i].arcs); + my_free(_ALLOC_ID_, &xctx->sym[i].rects); } - my_free(1117, &xctx->sym); - my_free(1118, &xctx->rect); - my_free(1119, &xctx->line); - my_free(1125, &xctx->poly); - my_free(1126, &xctx->arc); - my_free(1124, &xctx->rects); - my_free(1127, &xctx->polygons); - my_free(1128, &xctx->arcs); - my_free(1129, &xctx->lines); - my_free(1130, &xctx->maxr); - my_free(1131, &xctx->maxp); - my_free(1132, &xctx->maxa); - my_free(1133, &xctx->maxl); - my_free(1108, &xctx->sel_array); + my_free(_ALLOC_ID_, &xctx->sym); + my_free(_ALLOC_ID_, &xctx->rect); + my_free(_ALLOC_ID_, &xctx->line); + my_free(_ALLOC_ID_, &xctx->poly); + my_free(_ALLOC_ID_, &xctx->arc); + my_free(_ALLOC_ID_, &xctx->rects); + my_free(_ALLOC_ID_, &xctx->polygons); + my_free(_ALLOC_ID_, &xctx->arcs); + my_free(_ALLOC_ID_, &xctx->lines); + my_free(_ALLOC_ID_, &xctx->maxr); + my_free(_ALLOC_ID_, &xctx->maxp); + my_free(_ALLOC_ID_, &xctx->maxa); + my_free(_ALLOC_ID_, &xctx->maxl); + my_free(_ALLOC_ID_, &xctx->sel_array); for(i=0;isch_path[i]) my_free(1139, &xctx->sch_path[i]); - if(xctx->hier_attr[i].templ) my_free(1608, &xctx->hier_attr[i].templ); - if(xctx->hier_attr[i].prop_ptr) my_free(959, &xctx->hier_attr[i].prop_ptr); - if(xctx->hier_attr[i].symname) my_free(960, &xctx->hier_attr[i].symname); + if(xctx->sch_path[i]) my_free(_ALLOC_ID_, &xctx->sch_path[i]); + if(xctx->hier_attr[i].templ) my_free(_ALLOC_ID_, &xctx->hier_attr[i].templ); + if(xctx->hier_attr[i].prop_ptr) my_free(_ALLOC_ID_, &xctx->hier_attr[i].prop_ptr); + if(xctx->hier_attr[i].symname) my_free(_ALLOC_ID_, &xctx->hier_attr[i].symname); } - my_free(1099, &xctx->gridpoint); - my_free(1214, &xctx->biggridpoint); - my_free(1135, &xctx->gc); - my_free(1136, &xctx->gcstipple); - for(i=0;icolor_array[i]); - my_free(605, &xctx->color_array); - my_free(1123, &xctx->enable_layer); - my_free(1121, &xctx->active_layer); - my_free(1295, &xctx->top_path); - my_free(1463, &xctx->current_win_path); - my_free(1120, &xctx->fill_type); - my_free(1543, &xctx->format); - if(xctx->inst_redraw_table) my_free(604, &xctx->inst_redraw_table); - my_free(269, &xctx); + my_free(_ALLOC_ID_, &xctx->gridpoint); + my_free(_ALLOC_ID_, &xctx->biggridpoint); + my_free(_ALLOC_ID_, &xctx->gc); + my_free(_ALLOC_ID_, &xctx->gcstipple); + for(i=0;icolor_array[i]); + my_free(_ALLOC_ID_, &xctx->color_array); + my_free(_ALLOC_ID_, &xctx->enable_layer); + my_free(_ALLOC_ID_, &xctx->active_layer); + my_free(_ALLOC_ID_, &xctx->top_path); + my_free(_ALLOC_ID_, &xctx->current_win_path); + my_free(_ALLOC_ID_, &xctx->fill_type); + my_free(_ALLOC_ID_, &xctx->format); + if(xctx->inst_redraw_table) my_free(_ALLOC_ID_, &xctx->inst_redraw_table); + my_free(_ALLOC_ID_, &xctx); } static void create_gc(void) @@ -409,7 +409,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path) { int i, j; - xctx = my_calloc(153, 1, sizeof(Xschem_ctx)); + xctx = my_calloc(_ALLOC_ID_, 1, sizeof(Xschem_ctx)); xctx->cur_undo_ptr = 0; xctx->head_undo_ptr = 0; xctx->tail_undo_ptr = 0; @@ -498,10 +498,10 @@ static void alloc_xschem_data(const char *top_path, const char *win_path) xctx->inst_spatial_table[i][j] = NULL; } } - xctx->node_table = my_calloc(517, HASHSIZE, sizeof(Node_hashentry *)); + xctx->node_table = my_calloc(_ALLOC_ID_, HASHSIZE, sizeof(Node_hashentry *)); xctx->inst_table.table = NULL; xctx->inst_table.size = 0; - xctx->hilight_table = my_calloc(1383, HASHSIZE, sizeof(Hilight_hashentry *)); + xctx->hilight_table = my_calloc(_ALLOC_ID_, HASHSIZE, sizeof(Hilight_hashentry *)); xctx->inst_redraw_table = NULL; xctx->inst_redraw_table_size = 0; @@ -551,30 +551,30 @@ static void alloc_xschem_data(const char *top_path, const char *win_path) xctx->hier_attr[i].symname = NULL; xctx->hier_attr[i].fd = NULL; } - my_strdup(1187, &xctx->sch_path[0],"."); + my_strdup(_ALLOC_ID_, &xctx->sch_path[0],"."); xctx->sch_inst_number[0] = 1; xctx->maxt=CADMAXTEXT; xctx->maxw=CADMAXWIRES; xctx->maxi=ELEMINST; xctx->maxs=ELEMDEF; - xctx->text=my_calloc(606, xctx->maxt,sizeof(xText)); - xctx->wire=my_calloc(607, xctx->maxw,sizeof(xWire)); - xctx->inst=my_calloc(609, xctx->maxi , sizeof(xInstance) ); - xctx->sym=my_calloc(610, xctx->maxs , sizeof(xSymbol) ); + xctx->text=my_calloc(_ALLOC_ID_, xctx->maxt,sizeof(xText)); + xctx->wire=my_calloc(_ALLOC_ID_, xctx->maxw,sizeof(xWire)); + xctx->inst=my_calloc(_ALLOC_ID_, xctx->maxi , sizeof(xInstance) ); + xctx->sym=my_calloc(_ALLOC_ID_, xctx->maxs , sizeof(xSymbol) ); for(i=0;imaxs;i++) { - xctx->sym[i].line=my_calloc(611, cadlayers, sizeof(xLine *)); - xctx->sym[i].poly=my_calloc(612, cadlayers, sizeof(xPoly *)); - xctx->sym[i].arc=my_calloc(613, cadlayers, sizeof(xArc *)); - xctx->sym[i].rect=my_calloc(614, cadlayers, sizeof(xRect *)); - xctx->sym[i].lines=my_calloc(615, cadlayers, sizeof(int)); - xctx->sym[i].rects=my_calloc(616, cadlayers, sizeof(int)); - xctx->sym[i].arcs=my_calloc(617, cadlayers, sizeof(int)); - xctx->sym[i].polygons=my_calloc(618, cadlayers, sizeof(int)); + xctx->sym[i].line=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *)); + xctx->sym[i].poly=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *)); + xctx->sym[i].arc=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *)); + xctx->sym[i].rect=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xRect *)); + xctx->sym[i].lines=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->sym[i].rects=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->sym[i].arcs=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->sym[i].polygons=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); } - xctx->maxr=my_calloc(620, cadlayers, sizeof(int)); - xctx->maxa=my_calloc(621, cadlayers, sizeof(int)); - xctx->maxp=my_calloc(622, cadlayers, sizeof(int)); - xctx->maxl=my_calloc(623, cadlayers, sizeof(int)); + xctx->maxr=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->maxa=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->maxp=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->maxl=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); for(i=0;imaxr[i]=CADMAXOBJECTS; @@ -582,25 +582,25 @@ static void alloc_xschem_data(const char *top_path, const char *win_path) xctx->maxl[i]=CADMAXOBJECTS; xctx->maxa[i]=CADMAXOBJECTS; } - xctx->rect=my_calloc(624, cadlayers, sizeof(xRect *)); - xctx->line=my_calloc(625, cadlayers, sizeof(xLine *)); - xctx->poly=my_calloc(626, cadlayers, sizeof(xPoly *)); - xctx->arc=my_calloc(627, cadlayers, sizeof(xArc *)); + xctx->rect=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xRect *)); + xctx->line=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *)); + xctx->poly=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *)); + xctx->arc=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *)); for(i=0;irect[i]=my_calloc(628, xctx->maxr[i],sizeof(xRect)); - xctx->arc[i]=my_calloc(629, xctx->maxa[i],sizeof(xArc)); - xctx->poly[i]=my_calloc(630, xctx->maxp[i],sizeof(xPoly)); - xctx->line[i]=my_calloc(631, xctx->maxl[i],sizeof(xLine)); + xctx->rect[i]=my_calloc(_ALLOC_ID_, xctx->maxr[i],sizeof(xRect)); + xctx->arc[i]=my_calloc(_ALLOC_ID_, xctx->maxa[i],sizeof(xArc)); + xctx->poly[i]=my_calloc(_ALLOC_ID_, xctx->maxp[i],sizeof(xPoly)); + xctx->line[i]=my_calloc(_ALLOC_ID_, xctx->maxl[i],sizeof(xLine)); } - xctx->rects=my_calloc(632, cadlayers, sizeof(int)); - xctx->polygons=my_calloc(633, cadlayers, sizeof(int)); - xctx->arcs=my_calloc(634, cadlayers, sizeof(int)); - xctx->lines=my_calloc(635, cadlayers, sizeof(int)); + xctx->rects=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->polygons=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->arcs=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->lines=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->maxsel=MAXGROUP; - xctx->sel_array=my_calloc(619, xctx->maxsel, sizeof(Selected)); - xctx->biggridpoint=(XSegment*)my_calloc(1213, CADMAXGRIDPOINTS,sizeof(XSegment)); - xctx->gridpoint=(XPoint*)my_calloc(608, CADMAXGRIDPOINTS,sizeof(XPoint)); + xctx->sel_array=my_calloc(_ALLOC_ID_, xctx->maxsel, sizeof(Selected)); + xctx->biggridpoint=(XSegment*)my_calloc(_ALLOC_ID_, CADMAXGRIDPOINTS,sizeof(XSegment)); + xctx->gridpoint=(XPoint*)my_calloc(_ALLOC_ID_, CADMAXGRIDPOINTS,sizeof(XPoint)); xctx->enable_drill = 0; xctx->prev_set_modify = -1; xctx->pending_fullzoom = 0; @@ -620,21 +620,21 @@ static void alloc_xschem_data(const char *top_path, const char *win_path) xctx->edit_sym_i = -1; xctx->netlist_commands = 0; xctx->draw_pixmap = 1; - xctx->gc=my_calloc(638, cadlayers, sizeof(GC)); - xctx->gcstipple=my_calloc(639, cadlayers, sizeof(GC)); - xctx->color_array=my_calloc(637, cadlayers, sizeof(char*)); - xctx->enable_layer=my_calloc(87, cadlayers, sizeof(int)); + xctx->gc=my_calloc(_ALLOC_ID_, cadlayers, sizeof(GC)); + xctx->gcstipple=my_calloc(_ALLOC_ID_, cadlayers, sizeof(GC)); + xctx->color_array=my_calloc(_ALLOC_ID_, cadlayers, sizeof(char*)); + xctx->enable_layer=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->n_active_layers = 0; - xctx->active_layer=my_calloc(563, cadlayers, sizeof(int)); + xctx->active_layer=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->hide_symbols = 0; xctx->netlist_type = CAD_SPICE_NETLIST; xctx->format = NULL; /* custom format string for netlist, otherwise use * "format", "verilog_format", "vhdl_format", "tedax_format" */ xctx->top_path = NULL; xctx->current_win_path = NULL; - my_strdup2(1296, &xctx->top_path, top_path); - my_strdup2(1462, &xctx->current_win_path, win_path); - xctx->fill_type=my_calloc(640, cadlayers, sizeof(int)); + my_strdup2(_ALLOC_ID_, &xctx->top_path, top_path); + my_strdup2(_ALLOC_ID_, &xctx->current_win_path, win_path); + xctx->fill_type=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->case_insensitive = 0; xctx->show_hidden_texts = 0; xctx->x_strcmp = strcmp; @@ -697,7 +697,7 @@ int compare_schematics(const char *f) /* HASH SCHEMATIC 1 */ for(i = 0; i < xctx->instances; i++) { l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); - my_realloc(1540, &s, l); + my_realloc(_ALLOC_ID_, &s, l); my_snprintf(s, l, "C %s %g %g %d %d %s", xctx->inst[i].name, xctx->inst[i].x0, xctx->inst[i].y0, xctx->inst[i].rot, xctx->inst[i].flip, xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); @@ -706,7 +706,7 @@ int compare_schematics(const char *f) for(i=0;iwires;i++) { l =1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : ""); - my_realloc(1541, &s, l); + my_realloc(_ALLOC_ID_, &s, l); my_snprintf(s, l, "N %g %g %g %g", xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2); int_hash_lookup(&table1, s, i, XINSERT_NOREPLACE); @@ -759,7 +759,7 @@ int compare_schematics(const char *f) /* HASH SCHEMATIC 2 , CHECK SCHEMATIC 2 WITH SCHEMATIC 1 */ for(i = 0; i < xctx->instances; i++) { l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); - my_realloc(1534, &s, l); + my_realloc(_ALLOC_ID_, &s, l); my_snprintf(s, l, "C %s %g %g %d %d %s", xctx->inst[i].name, xctx->inst[i].x0, xctx->inst[i].y0, xctx->inst[i].rot, xctx->inst[i].flip, xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); @@ -776,7 +776,7 @@ int compare_schematics(const char *f) for(i=0;iwires;i++) { l =1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : ""); - my_realloc(1535, &s, l); + my_realloc(_ALLOC_ID_, &s, l); my_snprintf(s, l, "N %g %g %g %g", xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2); int_hash_lookup(&table2, s, i, XINSERT_NOREPLACE); @@ -805,7 +805,7 @@ int compare_schematics(const char *f) /* CHECK SCHEMATIC 1 WITH SCHEMATIC 2*/ for(i = 0; i < xctx->instances; i++) { l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); - my_realloc(1536,&s, l); + my_realloc(_ALLOC_ID_,&s, l); my_snprintf(s, l, "C %s %g %g %d %d %s", xctx->inst[i].name, xctx->inst[i].x0, xctx->inst[i].y0, xctx->inst[i].rot, xctx->inst[i].flip, xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); @@ -819,7 +819,7 @@ int compare_schematics(const char *f) for(i=0;iwires;i++) { l = 1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : ""); - my_realloc(1537, &s, l); + my_realloc(_ALLOC_ID_, &s, l); my_snprintf(s, l, "N %g %g %g %g", xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2); found = int_hash_lookup(&table2, s, i, XLOOKUP); @@ -833,7 +833,7 @@ int compare_schematics(const char *f) int_hash_free(&table2); rebuild_selected_array(); draw_selection(xctx->gc[SELLAYER], 0); - my_free(1531, &s); + my_free(_ALLOC_ID_, &s); return ret; } @@ -863,18 +863,18 @@ static void xwin_exit(void) #else for(i = 0; i < cadlayers; i++) Tk_FreePixmap(display, pixmap[i]); #endif - my_free(1134, &pixmap); + my_free(_ALLOC_ID_, &pixmap); } dbg(1, "xwin_exit(): clearing drawing data structures\n"); /* global context - graphic preferences/settings */ for(i=0;ifill_type array that is used in create_gc() to set fill styles */ @@ -1168,7 +1168,7 @@ void preview_window(const char *what, const char *win_path, const char *fname) } Tk_DestroyWindow(tkpre_window); - my_free(1144, ¤t_file); + my_free(_ALLOC_ID_, ¤t_file); xctx = save_xctx; /* restore schematic */ save_xctx = NULL; set_modify(-1); @@ -2017,9 +2017,9 @@ int Tcl_AppInit(Tcl_Interp *inter) if (atoi(tclresult()) == 0) { running_in_src_dir = 1; /* no bin, so it's running in Visual studio source directory*/ - my_strdup(62, &up_hier, "../../.."); + my_strdup(_ALLOC_ID_, &up_hier, "../../.."); } - else my_strdup(63, &up_hier, ".."); + else my_strdup(_ALLOC_ID_, &up_hier, ".."); /* my_strcat(415, &win_xschem_library_path, "."); */ 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]); @@ -2031,8 +2031,8 @@ int Tcl_AppInit(Tcl_Interp *inter) const char *result2 = tcleval(tmp); const char *win_xschem_library_path_clean = tclgetvar("tmp2"); tclsetvar("XSCHEM_LIBRARY_PATH", win_xschem_library_path_clean); - my_free(432, &win_xschem_library_path); - my_free(441, &up_hier); + my_free(_ALLOC_ID_, &win_xschem_library_path); + my_free(_ALLOC_ID_, &up_hier); char *xschem_sharedir=NULL; if ((xschem_sharedir=getenv("XSCHEM_SHAREDIR")) != NULL) { if (!stat(xschem_sharedir, &buf)) { @@ -2219,7 +2219,7 @@ int Tcl_AppInit(Tcl_Interp *inter) /* */ /* resolve absolute pathname of xschem (argv[0]) for future usage */ - my_strdup(44, &xschem_executable, get_file_path(xschem_executable)); + my_strdup(_ALLOC_ID_, &xschem_executable, get_file_path(xschem_executable)); dbg(1, "Tcl_AppInit(): resolved xschem_executable=%s\n", xschem_executable); @@ -2249,12 +2249,12 @@ int Tcl_AppInit(Tcl_Interp *inter) alloc_xschem_data("", ".drw"); /* global context / graphic preferences/settings */ - pixdata=my_calloc(641, cadlayers, sizeof(char*)); + pixdata=my_calloc(_ALLOC_ID_, cadlayers, sizeof(char*)); for(i=0;iplotfile, cli_opt_plotfile, S(xctx->plotfile)); xctx->draw_window = tclgetintvar("draw_window"); diff --git a/src/xschem.h b/src/xschem.h index 01ec5382..b5114729 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -123,7 +123,8 @@ extern char win_temp_dir[PATH_MAX]; #include #include -#define _ALLOC_ID_ 0 /* to be replaced with unique IDs in my_*() allocations for memory tracking */ +#define _ALLOC_ID_ 0 /* to be replaced with unique IDs in my_*() allocations for memory tracking + * see create_alloc_ids.awk */ #define CADHEIGHT 700 /* initial window size */ #define CADWIDTH 1000 @@ -367,7 +368,7 @@ do { \ register size_t __str_alloc_tmp__ = add; \ if( __str_alloc_tmp__ >= *size) { \ *size = __str_alloc_tmp__ + CADCHUNKALLOC; \ - my_realloc(1212, dest_string, *size); \ + my_realloc(_ALLOC_ID_, dest_string, *size); \ } \ } while(0)