diff --git a/src/frontend/aspice.c b/src/frontend/aspice.c index c94c7c801..276a9a673 100644 --- a/src/frontend/aspice.c +++ b/src/frontend/aspice.c @@ -123,7 +123,7 @@ com_aspice(wordlist *wl) } (void) dup2(fileno(stdout), fileno(stderr)); - (void) execl(spicepath, spicepath, "-r", raw, (void*)0); + (void) execl(spicepath, spicepath, "-r", raw, NULL); /* Screwed up. */ perror(spicepath); @@ -328,7 +328,7 @@ com_rspice(wordlist *wl) dup2(from_serv[1], 1); /* stdout */ dup2(err_serv[1], 2); /* stderr */ - execlp(remote_shell, remote_shell, rhost, program, "-s", (void*)0); + execlp(remote_shell, remote_shell, rhost, program, "-s", NULL); /* system(com_buf); */ perror(remote_shell); exit(-1); diff --git a/src/frontend/breakp.c b/src/frontend/breakp.c index d9c6b49af..5582c761f 100644 --- a/src/frontend/breakp.c +++ b/src/frontend/breakp.c @@ -161,7 +161,7 @@ bad: void com_trce(wordlist *wl) { - settrace(wl, VF_PRINT, 0); + settrace(wl, VF_PRINT, NULL); } diff --git a/src/frontend/commands.c b/src/frontend/commands.c index bec672c31..e106188de 100644 --- a/src/frontend/commands.c +++ b/src/frontend/commands.c @@ -580,7 +580,7 @@ struct comm spcp_coms[] = { { 0, 0, 0, 0 }, E_DEFHMASK, 0, 0, NULL, ": Print circuit inventory" }, - { 0, NULL, FALSE, FALSE, + { NULL, NULL, FALSE, FALSE, { 0, 0, 0, 0 }, E_DEFHMASK, 0, LOTS, NULL, NULL } @@ -971,7 +971,7 @@ struct comm nutcp_coms[] = { { 0, 0, 0, 0 }, E_DEFHMASK, 0, 0, NULL, ": Print circuit inventory" } , - { 0, NULL, FALSE, FALSE, + { NULL, NULL, FALSE, FALSE, { 0, 0, 0, 0 }, E_DEFHMASK, 0, LOTS, NULL, NULL } diff --git a/src/frontend/control.c b/src/frontend/control.c index 10cdcca2e..b87a21978 100644 --- a/src/frontend/control.c +++ b/src/frontend/control.c @@ -551,7 +551,7 @@ get_alt_prompt(void) struct control *c; /* if nothing on the command stack return NULL */ - if (cend[stackp] == 0) + if (cend[stackp] == NULL) return NULL; /* measure stack depth */ diff --git a/src/frontend/device.c b/src/frontend/device.c index e7cb99282..e6f6cd3be 100644 --- a/src/frontend/device.c +++ b/src/frontend/device.c @@ -734,7 +734,7 @@ listparam(wordlist *p, dgen *dg) fprintf(cp_out, "%*.*s", LEFT_WIDTH, LEFT_WIDTH, p->wl_word); else fprintf(cp_out, "%*s", LEFT_WIDTH, " "); - k = dgen_for_n(dg, count, bogus1, 0, j); + k = dgen_for_n(dg, count, bogus1, NULL, j); fprintf(cp_out, "\n"); j += 1; } while (k > 0); @@ -746,7 +746,7 @@ listparam(wordlist *p, dgen *dg) fprintf(cp_out, "%*.*s", LEFT_WIDTH, LEFT_WIDTH, p->wl_word); else fprintf(cp_out, "%*s", LEFT_WIDTH, " "); - k = dgen_for_n(dg, count, bogus2, 0, j); + k = dgen_for_n(dg, count, bogus2, NULL, j); fprintf(cp_out, "\n"); j += 1; } while (k > 0); diff --git a/src/frontend/help/help.c b/src/frontend/help/help.c index d1cfe8693..bee81e218 100644 --- a/src/frontend/help/help.c +++ b/src/frontend/help/help.c @@ -71,7 +71,7 @@ findglobalsubject(char *subject) char **dict; long fpos; - place = 0; + place = NULL; for (dict = hlp_filelist; *dict && **dict; dict++) { fpos = findsubject(*dict, subject); if (fpos != -1) { diff --git a/src/frontend/help/readhelp.c b/src/frontend/help/readhelp.c index a14cfc896..15ec41e6c 100644 --- a/src/frontend/help/readhelp.c +++ b/src/frontend/help/readhelp.c @@ -69,7 +69,7 @@ hlp_read(fplace *place) bool mof = FALSE; if (!place) - return 0; + return NULL; top->place = copy_fplace(place); diff --git a/src/frontend/plotting/graf.c b/src/frontend/plotting/graf.c index 304b56c00..d26aa5e16 100644 --- a/src/frontend/plotting/graf.c +++ b/src/frontend/plotting/graf.c @@ -612,7 +612,7 @@ iplot(struct plot *pl, int id) int yt; char *yl = NULL; double xlims[2], ylims[2]; - static REQUEST reqst = { checkup_option, 0 }; + static REQUEST reqst = { checkup_option, NULL }; int inited = 0; char commandline[513]; @@ -680,7 +680,7 @@ iplot(struct plot *pl, int id) } else { /* plot the last points and resize if needed */ - Input(&reqst, 0); + Input(&reqst, NULL); /* First see if we have to make the screen bigger */ dy = (isreal(xs) ? xs->v_realdata[len - 1] : realpart(xs->v_compdata[len - 1])); diff --git a/src/frontend/quote.c b/src/frontend/quote.c index 9964434b5..cb62a19a6 100644 --- a/src/frontend/quote.c +++ b/src/frontend/quote.c @@ -91,6 +91,6 @@ cp_unquote(char *string) return (s); } else { - return 0; + return NULL; } } diff --git a/src/frontend/rawfile.c b/src/frontend/rawfile.c index de6527212..82e4322fa 100644 --- a/src/frontend/rawfile.c +++ b/src/frontend/rawfile.c @@ -293,7 +293,7 @@ raw_write(char *name, struct plot *pl, bool app, bool binary) struct plot * raw_read(char *name) { char *title = "default title"; - char *date = 0; + char *date = NULL; struct plot *plots = NULL, *curpl = NULL; char buf[BSIZE_SP], *s, *t, *r; int flags = 0, nvars = 0, npoints = 0, i, j; diff --git a/src/frontend/where.c b/src/frontend/where.c index ef13fab8c..066f45a35 100644 --- a/src/frontend/where.c +++ b/src/frontend/where.c @@ -30,7 +30,7 @@ com_where(wordlist *wl) return; } - msg = ft_sim->nonconvErr (ft_curckt->ci_ckt, 0); + msg = ft_sim->nonconvErr (ft_curckt->ci_ckt, NULL); printf("%s", msg); diff --git a/src/main.c b/src/main.c index e12d01e83..bebfe10a5 100644 --- a/src/main.c +++ b/src/main.c @@ -448,7 +448,7 @@ EVTfindvec(char *node) { #endif /* SIMULATOR */ -char *hlp_filelist[] = { "ngspice", 0 }; +char *hlp_filelist[] = { "ngspice", NULL }; /* allocate space for global constants in 'CONST.h' */ @@ -884,21 +884,21 @@ main(int argc, char **argv) enum { soa_log = 1001, }; static struct option long_options[] = { - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'v'}, - {"batch", no_argument, 0, 'b'}, - {"autorun", no_argument, 0, 'a'}, - {"circuitfile", required_argument, 0, 'c'}, - {"interactive", no_argument, 0, 'i'}, - {"no-spiceinit", no_argument, 0, 'n'}, - {"output", required_argument, 0, 'o'}, - {"pipe", no_argument, 0, 'p'}, - {"completion", no_argument, 0, 'q'}, - {"rawfile", required_argument, 0, 'r'}, - {"server", no_argument, 0, 's'}, - {"terminal", required_argument, 0, 't'}, - {"soa-log", required_argument, 0, soa_log}, - {0, 0, 0, 0} + {"help", no_argument, NULL, 'h'}, + {"version", no_argument, NULL, 'v'}, + {"batch", no_argument, NULL, 'b'}, + {"autorun", no_argument, NULL, 'a'}, + {"circuitfile", required_argument, NULL, 'c'}, + {"interactive", no_argument, NULL, 'i'}, + {"no-spiceinit", no_argument, NULL, 'n'}, + {"output", required_argument, NULL, 'o'}, + {"pipe", no_argument, NULL, 'p'}, + {"completion", no_argument, NULL, 'q'}, + {"rawfile", required_argument, NULL, 'r'}, + {"server", no_argument, NULL, 's'}, + {"terminal", required_argument, NULL, 't'}, + {"soa-log", required_argument, NULL, soa_log}, + {NULL, 0, NULL, 0} }; int option_index = 0; diff --git a/src/maths/fft/fftext.c b/src/maths/fft/fftext.c index c927965a5..f2528bcf7 100644 --- a/src/maths/fft/fftext.c +++ b/src/maths/fft/fftext.c @@ -42,18 +42,18 @@ int fftInit(int M) /*** I did NOT test cases with M>27 ***/ if ((M >= 0) && ((size_t) M < 8*sizeof(int))) { theError = 0; - if (UtblArray[M] == 0) { // have we not inited this size fft yet? + if (UtblArray[M] == NULL) { // have we not inited this size fft yet? // init cos table UtblArray[M] = TMALLOC(double, POW2(M)/4+1); - if (UtblArray[M] == 0) + if (UtblArray[M] == NULL) theError = 2; else { fftCosInit(M, UtblArray[M]); } if (M > 1) { - if (BRLowArray[M/2] == 0) { // init bit reversed table for cmplx fft + if (BRLowArray[M/2] == NULL) { // init bit reversed table for cmplx fft BRLowArray[M/2] = TMALLOC(short, POW2(M/2-1)); - if (BRLowArray[M/2] == 0) + if (BRLowArray[M/2] == NULL) theError = 2; else { fftBRInit(M, BRLowArray[M/2]); @@ -61,9 +61,9 @@ int fftInit(int M) } } if (M > 2) { - if (BRLowArray[(M-1)/2] == 0) { // init bit reversed table for real fft + if (BRLowArray[(M-1)/2] == NULL) { // init bit reversed table for real fft BRLowArray[(M-1)/2] = TMALLOC(short, POW2((M-1)/2-1)); - if (BRLowArray[(M-1)/2] == 0) + if (BRLowArray[(M-1)/2] == NULL) theError = 2; else { fftBRInit(M-1, BRLowArray[(M-1)/2]); @@ -80,15 +80,15 @@ void fftFree(void) // release storage for all private cosine and bit reversed tables int i1; for (i1=8*sizeof(int)/2-1; i1>=0; i1--) { - if (BRLowArray[i1] != 0) { + if (BRLowArray[i1] != NULL) { free(BRLowArray[i1]); - BRLowArray[i1] = 0; + BRLowArray[i1] = NULL; } } for (i1=8*sizeof(int)-1; i1>=0; i1--) { - if (UtblArray[i1] != 0) { + if (UtblArray[i1] != NULL) { free(UtblArray[i1]); - UtblArray[i1] = 0; + UtblArray[i1] = NULL; } } } diff --git a/src/spicelib/analysis/cktpzstr.c b/src/spicelib/analysis/cktpzstr.c index c28a6b79f..8e50d8e22 100644 --- a/src/spicelib/analysis/cktpzstr.c +++ b/src/spicelib/analysis/cktpzstr.c @@ -125,8 +125,8 @@ CKTpzFindZeros(CKTcircuit *ckt, PZtrial **rootinfo, int *rootcount) NIpzK_mag = 0; High_Guess = -1.0; Low_Guess = 1.0; - ZeroTrial = 0; - Trials = 0; + ZeroTrial = NULL; + Trials = NULL; NZeros = 0; NFlat = 0; Max_Zeros = SMPmatSize(ckt->CKTmatrix); diff --git a/src/spicelib/analysis/cktsens.c b/src/spicelib/analysis/cktsens.c index c181ae311..0c69fffa5 100644 --- a/src/spicelib/analysis/cktsens.c +++ b/src/spicelib/analysis/cktsens.c @@ -87,9 +87,9 @@ int sens_sens(CKTcircuit *ckt, int restart) IFuid *output_names, freq_name; int bypass; int type; - double *saved_rhs = 0, - *saved_irhs = 0; - SMPmatrix *saved_matrix = 0; + double *saved_rhs = NULL, + *saved_irhs = NULL; + SMPmatrix *saved_matrix = NULL; #ifndef notdef #ifdef notdef diff --git a/src/spicelib/analysis/cktsetup.c b/src/spicelib/analysis/cktsetup.c index 446749094..5aba27882 100644 --- a/src/spicelib/analysis/cktsetup.c +++ b/src/spicelib/analysis/cktsetup.c @@ -147,7 +147,7 @@ CKTunsetup(CKTcircuit *ckt) /* added by HT 050802*/ for(node=ckt->CKTnodes;node;node=node->next){ if(node->icGiven || node->nsGiven) { - node->ptr=0; + node->ptr=NULL; } } diff --git a/src/spicelib/devices/hfet1/hfetload.c b/src/spicelib/devices/hfet1/hfetload.c index 5222fa995..4e93bb3ad 100644 --- a/src/spicelib/devices/hfet1/hfetload.c +++ b/src/spicelib/devices/hfet1/hfetload.c @@ -721,8 +721,8 @@ cgd_calc: dtdvds = deltdvdse*dvdsevds+deltdvkneet*CK1*temp; *gmd = -delcgdvgs*dvdsevds+delcgdtd*dtdvds; } else { - gmg = 0; - gmd = 0; + gmg = NULL; + gmd = NULL; } if(model->HFETAgatemod != 0) { diff --git a/src/xspice/cmpp/writ_ifs.c b/src/xspice/cmpp/writ_ifs.c index 651f77232..bf9ca50ac 100644 --- a/src/xspice/cmpp/writ_ifs.c +++ b/src/xspice/cmpp/writ_ifs.c @@ -1251,7 +1251,7 @@ static char *boolean_to_str(Boolean_t value) default: print_error("INTERNAL ERROR - boolean_to_str() - Impossible boolean value."); { - char *p = 0; *p = 0; + char *p = NULL; *p = 0; } } diff --git a/src/xspice/ipc/ipctiein.c b/src/xspice/ipc/ipctiein.c index cbf6553be..37550a27c 100644 --- a/src/xspice/ipc/ipctiein.c +++ b/src/xspice/ipc/ipctiein.c @@ -479,7 +479,7 @@ void ipc_free_devices( for(i = 0; i < num_items; i++) { FREE(names[i]); - names[i] = 0; + names[i] = NULL; } if(num_items > 0)