print_spice_subckt(): check for tcl_hook2() errors, check for NULL in strtoupper/strtolower, fix unitialized local variable
This commit is contained in:
parent
bd5cb7b9df
commit
0f5881cd61
|
|
@ -192,7 +192,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
double delta_threshold = 0.25;
|
double delta_threshold = 0.25;
|
||||||
double zoom_m = 0.5;
|
double zoom_m = 0.5;
|
||||||
int save_mouse_at_end = 0, clear_graphpan_at_end = 0;
|
int save_mouse_at_end = 0, clear_graphpan_at_end = 0;
|
||||||
xRect *r;
|
xRect *r = NULL;
|
||||||
#if HAS_CAIRO==1
|
#if HAS_CAIRO==1
|
||||||
cairo_save(xctx->cairo_ctx);
|
cairo_save(xctx->cairo_ctx);
|
||||||
cairo_save(xctx->cairo_save_ctx);
|
cairo_save(xctx->cairo_save_ctx);
|
||||||
|
|
@ -333,7 +333,6 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
|
||||||
|
|
||||||
/* second loop: after having determined the master graph do the others */
|
/* second loop: after having determined the master graph do the others */
|
||||||
for(i=0; i< xctx->rects[GRIDLAYER]; i++) {
|
for(i=0; i< xctx->rects[GRIDLAYER]; i++) {
|
||||||
xRect *r;
|
|
||||||
r = &xctx->rect[GRIDLAYER][i];
|
r = &xctx->rect[GRIDLAYER][i];
|
||||||
need_redraw = 0;
|
need_redraw = 0;
|
||||||
if( !(r->flags & 1) ) continue;
|
if( !(r->flags & 1) ) continue;
|
||||||
|
|
|
||||||
|
|
@ -477,12 +477,12 @@ int my_strncpy(char *d, const char *s, size_t n)
|
||||||
|
|
||||||
char *strtolower(char* s) {
|
char *strtolower(char* s) {
|
||||||
char *p;
|
char *p;
|
||||||
for(p=s; *p; p++) *p=(char)tolower(*p);
|
if(s) for(p=s; *p; p++) *p=(char)tolower(*p);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
char *strtoupper(char* s) {
|
char *strtoupper(char* s) {
|
||||||
char *p;
|
char *p;
|
||||||
for(p=s; *p; p++) *p=(char)toupper(*p);
|
if(s) for(p=s; *p; p++) *p=(char)toupper(*p);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
13
src/token.c
13
src/token.c
|
|
@ -1653,11 +1653,18 @@ void print_spice_subckt(FILE *fd, int symbol)
|
||||||
size_t token_pos=0;
|
size_t token_pos=0;
|
||||||
int escape=0;
|
int escape=0;
|
||||||
int no_of_pins=0;
|
int no_of_pins=0;
|
||||||
|
const char *tclres;
|
||||||
|
|
||||||
my_strdup(103, &format1, get_tok_value(xctx->sym[symbol].prop_ptr,"format",2));
|
my_strdup(103, &format1, get_tok_value(xctx->sym[symbol].prop_ptr,"format",2));
|
||||||
dbg(1, "print_spice_subckt(): format1=%s\n", format1);
|
dbg(0, "print_spice_subckt(): format1=%s\n", format1);
|
||||||
my_strdup(455, &format, tcl_hook2(&format1));
|
if(strstr(format1, "tcleval(") == format1) {
|
||||||
dbg(1, "print_spice_subckt(): format=%s\n", format);
|
tclres = tcl_hook2(&format1);
|
||||||
|
if(!strcmp(tclres, "?\n")) my_strdup(1529, &format, format1 + 8);
|
||||||
|
else my_strdup(455, &format, tclres);
|
||||||
|
} else {
|
||||||
|
my_strdup(1530, &format, format1);
|
||||||
|
}
|
||||||
|
dbg(0, "print_spice_subckt(): format=%s\n", format);
|
||||||
if( format==NULL ) {
|
if( format==NULL ) {
|
||||||
my_free(1012, &format);
|
my_free(1012, &format);
|
||||||
return; /* no format */
|
return; /* no format */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue