fix uninitialized var in interpolate_yval()

This commit is contained in:
stefan schippers 2023-10-15 13:24:19 +02:00
parent a7bcfb7941
commit d1309a8a47
2 changed files with 18 additions and 8 deletions

View File

@ -4526,14 +4526,24 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
/* test /* test
* testmode */ * testmode */
else if(!strcmp(argv[1], "test")) else if(0 && !strcmp(argv[1], "test"))
{ {
/* static int swap = 0;
* if(argc > 3) { static Raw *saveraw = NULL;
* char *r = my_strcasestr(argv[2], argv[3]); if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
* dbg(0, "%s\n", r ? r : "NULL"); if(swap == 0) {
* } saveraw = xctx->raw;
*/ swap = 1;
xctx->raw = NULL;
raw_read("/home/schippes/.xschem/simulations/cmos_example_ngspice2.raw", &xctx->raw, "dc");
draw();
} else {
free_rawfile(&xctx->raw, 0);
swap = 0;
xctx->raw = saveraw;
draw();
}
Tcl_ResetResult(interp); Tcl_ResetResult(interp);
} }

View File

@ -3387,7 +3387,7 @@ static double interpolate_yval(int idx)
if((xctx->raw->allpoints > 1) && xctx->raw->annot_sweep_idx >= 0) { if((xctx->raw->allpoints > 1) && xctx->raw->annot_sweep_idx >= 0) {
Raw *raw = xctx->raw; Raw *raw = xctx->raw;
int dset; int dset;
int npoints; int npoints = 0;
SPICE_DATA *sweep_gv = raw->values[raw->annot_sweep_idx]; SPICE_DATA *sweep_gv = raw->values[raw->annot_sweep_idx];
SPICE_DATA *gv = raw->values[idx]; SPICE_DATA *gv = raw->values[idx];
for(dset = 0 ; dset < raw->datasets; dset++) { for(dset = 0 ; dset < raw->datasets; dset++) {