From 07e06cf701d65c8b1ffc385d4fe2c00be087ee33 Mon Sep 17 00:00:00 2001 From: dwarning Date: Sun, 4 Oct 2009 11:48:37 +0000 Subject: [PATCH] initialize local variables --- src/frontend/com_fft.c | 2 +- src/frontend/com_gnuplot.c | 2 +- src/frontend/com_xgraph.c | 2 +- src/frontend/device.c | 4 ++-- src/frontend/inp.c | 4 ++-- src/frontend/inpcom.c | 3 ++- src/frontend/plotting/gnuplot.c | 2 +- src/frontend/resource.c | 2 +- src/frontend/subckt.c | 6 +++--- 9 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/frontend/com_fft.c b/src/frontend/com_fft.c index 6980159ac..ced012d4e 100644 --- a/src/frontend/com_fft.c +++ b/src/frontend/com_fft.c @@ -24,7 +24,7 @@ com_fft(wordlist *wl) double *freq, *win, *time; double delta_t, span; int fpts, i, j, tlen, ngood; - struct dvec *f, *vlist, *lv, *vec; + struct dvec *f, *vlist, *lv = NULL, *vec; struct pnode *names, *first_name; float *reald, *imagd; diff --git a/src/frontend/com_gnuplot.c b/src/frontend/com_gnuplot.c index 392513ae0..57bb859c5 100644 --- a/src/frontend/com_gnuplot.c +++ b/src/frontend/com_gnuplot.c @@ -13,7 +13,7 @@ void com_gnuplot(wordlist *wl) { - char *fname; + char *fname = NULL; bool tempf = FALSE; if (wl) { diff --git a/src/frontend/com_xgraph.c b/src/frontend/com_xgraph.c index 72ae95da2..e80d3ccb0 100644 --- a/src/frontend/com_xgraph.c +++ b/src/frontend/com_xgraph.c @@ -13,7 +13,7 @@ void com_xgraph(wordlist *wl) { - char *fname; + char *fname = NULL; bool tempf = FALSE; if (wl) { diff --git a/src/frontend/device.c b/src/frontend/device.c index 1945f01a4..361b42253 100644 --- a/src/frontend/device.c +++ b/src/frontend/device.c @@ -868,7 +868,7 @@ com_altermod(wordlist *wl) void com_alter_common(wordlist *wl, int do_model) { - wordlist *eqword, *words; + wordlist *eqword = NULL, *words; char *dev, *p; char *param; struct dvec *dv; @@ -878,7 +878,7 @@ com_alter_common(wordlist *wl, int do_model) char *argument; char **arglist; int i=0, step=0, n, wlen, maxelem=3; - wordlist *wl2, *wlin, *wleq; + wordlist *wl2 = NULL, *wlin, *wleq; bool eqfound = FALSE, vecfound = FALSE; if (!ft_curckt) { diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 9ca06457d..680f043a4 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -318,7 +318,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename) */ { struct line *deck, *dd, *ld, *prev_param = NULL, *prev_card = NULL; - struct line *realdeck, *options = NULL, *curr_meas = NULL; + struct line *realdeck = NULL, *options = NULL, *curr_meas = NULL; char *tt = NULL, name[BSIZE_SP], *s, *t, *temperature = NULL; double testemp = 0.0; bool nosubckts, commands = FALSE; @@ -654,7 +654,7 @@ inp_dodeck( struct circ *ct; struct line *dd; char *ckt, *s; - INPtables *tab; + INPtables *tab = NULL; struct variable *eev = NULL; wordlist *wl; bool noparse, ii; diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 9e298a6bb..877f0b9b9 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -1021,7 +1021,8 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name) int ipc_len; #endif char *copys=NULL, big_buff2[5000]; - char *global_copy = NULL, keep_char; +/* char *global_copy = NULL; */ + char keep_char; int line_number = 1; /* sjb - renamed to avoid confusion with struct line */ int line_number_orig = 1, line_number_lib = 1, line_number_inc = 1; int no_braces = 0; /* number of '{' */ diff --git a/src/frontend/plotting/gnuplot.c b/src/frontend/plotting/gnuplot.c index ebad0a06a..b3ee771fe 100644 --- a/src/frontend/plotting/gnuplot.c +++ b/src/frontend/plotting/gnuplot.c @@ -26,7 +26,7 @@ ft_gnuplot(double *xlims, double *ylims, char *filename, char *title, char *xlab { FILE *file, *file_data; - struct dvec *v, *scale; + struct dvec *v, *scale = NULL; double xval, yval; int i, numVecs, linewidth; bool xlog, ylog, nogrid, markers; diff --git a/src/frontend/resource.c b/src/frontend/resource.c index b1dcda03c..bf9134946 100644 --- a/src/frontend/resource.c +++ b/src/frontend/resource.c @@ -201,7 +201,7 @@ printres(char *name) #endif bool yy = FALSE; static long lastsec = 0, lastusec = 0; - struct variable *v, *vfree; + struct variable *v, *vfree = NULL; char *cpu_elapsed; #ifdef XSPICE diff --git a/src/frontend/subckt.c b/src/frontend/subckt.c index c5196700d..9b822da42 100644 --- a/src/frontend/subckt.c +++ b/src/frontend/subckt.c @@ -144,7 +144,7 @@ inp_subcktexpand(struct line *deck) { struct line *ll, *c; char *s; - int ok; + int ok = 0; char *t; int i; wordlist *wl; @@ -320,7 +320,7 @@ inp_subcktexpand(struct line *deck) if (ciprefix(invoke, c->li_line)) { fprintf(cp_err, "Error: unknown subckt: %s\n", c->li_line); if ( use_numparams ) { - ok= ok && nupa_signal(NUPAEVALDONE, NULL); + ok = ok && nupa_signal(NUPAEVALDONE, NULL); } return NULL; } @@ -374,7 +374,7 @@ doit(struct line *deck) { struct line *c, *last, *lc, *lcc; struct line *savenext; - struct subs *sssfree, *sss = (struct subs *) NULL, *ks; /* *sss and *ks temporarily hold decks to substitute */ + struct subs *sssfree = (struct subs *) NULL, *sss = (struct subs *) NULL, *ks; /* *sss and *ks temporarily hold decks to substitute */ char *s, *t, *scname, *subname; int nest, numpasses = MAXNEST, i; bool gotone;