Browse Source

cleanup, use NULL instead of 0 in pointer context

pre-master-46
rlar 11 years ago
parent
commit
19e427e3a5
  1. 4
      src/frontend/aspice.c
  2. 2
      src/frontend/breakp.c
  3. 4
      src/frontend/commands.c
  4. 2
      src/frontend/control.c
  5. 4
      src/frontend/device.c
  6. 2
      src/frontend/help/help.c
  7. 2
      src/frontend/help/readhelp.c
  8. 4
      src/frontend/plotting/graf.c
  9. 2
      src/frontend/quote.c
  10. 2
      src/frontend/rawfile.c
  11. 2
      src/frontend/where.c
  12. 32
      src/main.c
  13. 20
      src/maths/fft/fftext.c
  14. 4
      src/spicelib/analysis/cktpzstr.c
  15. 6
      src/spicelib/analysis/cktsens.c
  16. 2
      src/spicelib/analysis/cktsetup.c
  17. 4
      src/spicelib/devices/hfet1/hfetload.c
  18. 2
      src/xspice/cmpp/writ_ifs.c
  19. 2
      src/xspice/ipc/ipctiein.c

4
src/frontend/aspice.c

@ -123,7 +123,7 @@ com_aspice(wordlist *wl)
} }
(void) dup2(fileno(stdout), fileno(stderr)); (void) dup2(fileno(stdout), fileno(stderr));
(void) execl(spicepath, spicepath, "-r", raw, (void*)0);
(void) execl(spicepath, spicepath, "-r", raw, NULL);
/* Screwed up. */ /* Screwed up. */
perror(spicepath); perror(spicepath);
@ -328,7 +328,7 @@ com_rspice(wordlist *wl)
dup2(from_serv[1], 1); /* stdout */ dup2(from_serv[1], 1); /* stdout */
dup2(err_serv[1], 2); /* stderr */ 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); */ /* system(com_buf); */
perror(remote_shell); perror(remote_shell);
exit(-1); exit(-1);

2
src/frontend/breakp.c

@ -161,7 +161,7 @@ bad:
void void
com_trce(wordlist *wl) com_trce(wordlist *wl)
{ {
settrace(wl, VF_PRINT, 0);
settrace(wl, VF_PRINT, NULL);
} }

4
src/frontend/commands.c

@ -580,7 +580,7 @@ struct comm spcp_coms[] = {
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, 0, { 0, 0, 0, 0 }, E_DEFHMASK, 0, 0,
NULL, NULL,
": Print circuit inventory" }, ": Print circuit inventory" },
{ 0, NULL, FALSE, FALSE,
{ NULL, NULL, FALSE, FALSE,
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, LOTS, { 0, 0, 0, 0 }, E_DEFHMASK, 0, LOTS,
NULL, NULL,
NULL } NULL }
@ -971,7 +971,7 @@ struct comm nutcp_coms[] = {
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, 0, { 0, 0, 0, 0 }, E_DEFHMASK, 0, 0,
NULL, NULL,
": Print circuit inventory" } , ": Print circuit inventory" } ,
{ 0, NULL, FALSE, FALSE,
{ NULL, NULL, FALSE, FALSE,
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, LOTS, { 0, 0, 0, 0 }, E_DEFHMASK, 0, LOTS,
NULL, NULL,
NULL } NULL }

2
src/frontend/control.c

@ -551,7 +551,7 @@ get_alt_prompt(void)
struct control *c; struct control *c;
/* if nothing on the command stack return NULL */ /* if nothing on the command stack return NULL */
if (cend[stackp] == 0)
if (cend[stackp] == NULL)
return NULL; return NULL;
/* measure stack depth */ /* measure stack depth */

4
src/frontend/device.c

@ -734,7 +734,7 @@ listparam(wordlist *p, dgen *dg)
fprintf(cp_out, "%*.*s", LEFT_WIDTH, LEFT_WIDTH, p->wl_word); fprintf(cp_out, "%*.*s", LEFT_WIDTH, LEFT_WIDTH, p->wl_word);
else else
fprintf(cp_out, "%*s", LEFT_WIDTH, " "); 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"); fprintf(cp_out, "\n");
j += 1; j += 1;
} while (k > 0); } while (k > 0);
@ -746,7 +746,7 @@ listparam(wordlist *p, dgen *dg)
fprintf(cp_out, "%*.*s", LEFT_WIDTH, LEFT_WIDTH, p->wl_word); fprintf(cp_out, "%*.*s", LEFT_WIDTH, LEFT_WIDTH, p->wl_word);
else else
fprintf(cp_out, "%*s", LEFT_WIDTH, " "); 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"); fprintf(cp_out, "\n");
j += 1; j += 1;
} while (k > 0); } while (k > 0);

2
src/frontend/help/help.c

@ -71,7 +71,7 @@ findglobalsubject(char *subject)
char **dict; char **dict;
long fpos; long fpos;
place = 0;
place = NULL;
for (dict = hlp_filelist; *dict && **dict; dict++) { for (dict = hlp_filelist; *dict && **dict; dict++) {
fpos = findsubject(*dict, subject); fpos = findsubject(*dict, subject);
if (fpos != -1) { if (fpos != -1) {

2
src/frontend/help/readhelp.c

@ -69,7 +69,7 @@ hlp_read(fplace *place)
bool mof = FALSE; bool mof = FALSE;
if (!place) if (!place)
return 0;
return NULL;
top->place = copy_fplace(place); top->place = copy_fplace(place);

4
src/frontend/plotting/graf.c

@ -612,7 +612,7 @@ iplot(struct plot *pl, int id)
int yt; int yt;
char *yl = NULL; char *yl = NULL;
double xlims[2], ylims[2]; double xlims[2], ylims[2];
static REQUEST reqst = { checkup_option, 0 };
static REQUEST reqst = { checkup_option, NULL };
int inited = 0; int inited = 0;
char commandline[513]; char commandline[513];
@ -680,7 +680,7 @@ iplot(struct plot *pl, int id)
} else { } else {
/* plot the last points and resize if needed */ /* plot the last points and resize if needed */
Input(&reqst, 0);
Input(&reqst, NULL);
/* First see if we have to make the screen bigger */ /* First see if we have to make the screen bigger */
dy = (isreal(xs) ? xs->v_realdata[len - 1] : dy = (isreal(xs) ? xs->v_realdata[len - 1] :
realpart(xs->v_compdata[len - 1])); realpart(xs->v_compdata[len - 1]));

2
src/frontend/quote.c

@ -91,6 +91,6 @@ cp_unquote(char *string)
return (s); return (s);
} else { } else {
return 0;
return NULL;
} }
} }

2
src/frontend/rawfile.c

@ -293,7 +293,7 @@ raw_write(char *name, struct plot *pl, bool app, bool binary)
struct plot * struct plot *
raw_read(char *name) { raw_read(char *name) {
char *title = "default title"; char *title = "default title";
char *date = 0;
char *date = NULL;
struct plot *plots = NULL, *curpl = NULL; struct plot *plots = NULL, *curpl = NULL;
char buf[BSIZE_SP], *s, *t, *r; char buf[BSIZE_SP], *s, *t, *r;
int flags = 0, nvars = 0, npoints = 0, i, j; int flags = 0, nvars = 0, npoints = 0, i, j;

2
src/frontend/where.c

@ -30,7 +30,7 @@ com_where(wordlist *wl)
return; return;
} }
msg = ft_sim->nonconvErr (ft_curckt->ci_ckt, 0);
msg = ft_sim->nonconvErr (ft_curckt->ci_ckt, NULL);
printf("%s", msg); printf("%s", msg);

32
src/main.c

@ -448,7 +448,7 @@ EVTfindvec(char *node) {
#endif /* SIMULATOR */ #endif /* SIMULATOR */
char *hlp_filelist[] = { "ngspice", 0 };
char *hlp_filelist[] = { "ngspice", NULL };
/* allocate space for global constants in 'CONST.h' */ /* allocate space for global constants in 'CONST.h' */
@ -884,21 +884,21 @@ main(int argc, char **argv)
enum { soa_log = 1001, }; enum { soa_log = 1001, };
static struct option long_options[] = { 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; int option_index = 0;

20
src/maths/fft/fftext.c

@ -42,18 +42,18 @@ int fftInit(int M)
/*** I did NOT test cases with M>27 ***/ /*** I did NOT test cases with M>27 ***/
if ((M >= 0) && ((size_t) M < 8*sizeof(int))) { if ((M >= 0) && ((size_t) M < 8*sizeof(int))) {
theError = 0; 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 // init cos table
UtblArray[M] = TMALLOC(double, POW2(M)/4+1); UtblArray[M] = TMALLOC(double, POW2(M)/4+1);
if (UtblArray[M] == 0)
if (UtblArray[M] == NULL)
theError = 2; theError = 2;
else { else {
fftCosInit(M, UtblArray[M]); fftCosInit(M, UtblArray[M]);
} }
if (M > 1) { 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)); BRLowArray[M/2] = TMALLOC(short, POW2(M/2-1));
if (BRLowArray[M/2] == 0)
if (BRLowArray[M/2] == NULL)
theError = 2; theError = 2;
else { else {
fftBRInit(M, BRLowArray[M/2]); fftBRInit(M, BRLowArray[M/2]);
@ -61,9 +61,9 @@ int fftInit(int M)
} }
} }
if (M > 2) { 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)); 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; theError = 2;
else { else {
fftBRInit(M-1, BRLowArray[(M-1)/2]); fftBRInit(M-1, BRLowArray[(M-1)/2]);
@ -80,15 +80,15 @@ void fftFree(void)
// release storage for all private cosine and bit reversed tables // release storage for all private cosine and bit reversed tables
int i1; int i1;
for (i1=8*sizeof(int)/2-1; i1>=0; i1--) { for (i1=8*sizeof(int)/2-1; i1>=0; i1--) {
if (BRLowArray[i1] != 0) {
if (BRLowArray[i1] != NULL) {
free(BRLowArray[i1]); free(BRLowArray[i1]);
BRLowArray[i1] = 0;
BRLowArray[i1] = NULL;
} }
} }
for (i1=8*sizeof(int)-1; i1>=0; i1--) { for (i1=8*sizeof(int)-1; i1>=0; i1--) {
if (UtblArray[i1] != 0) {
if (UtblArray[i1] != NULL) {
free(UtblArray[i1]); free(UtblArray[i1]);
UtblArray[i1] = 0;
UtblArray[i1] = NULL;
} }
} }
} }

4
src/spicelib/analysis/cktpzstr.c

@ -125,8 +125,8 @@ CKTpzFindZeros(CKTcircuit *ckt, PZtrial **rootinfo, int *rootcount)
NIpzK_mag = 0; NIpzK_mag = 0;
High_Guess = -1.0; High_Guess = -1.0;
Low_Guess = 1.0; Low_Guess = 1.0;
ZeroTrial = 0;
Trials = 0;
ZeroTrial = NULL;
Trials = NULL;
NZeros = 0; NZeros = 0;
NFlat = 0; NFlat = 0;
Max_Zeros = SMPmatSize(ckt->CKTmatrix); Max_Zeros = SMPmatSize(ckt->CKTmatrix);

6
src/spicelib/analysis/cktsens.c

@ -87,9 +87,9 @@ int sens_sens(CKTcircuit *ckt, int restart)
IFuid *output_names, freq_name; IFuid *output_names, freq_name;
int bypass; int bypass;
int type; 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 #ifndef notdef
#ifdef notdef #ifdef notdef

2
src/spicelib/analysis/cktsetup.c

@ -147,7 +147,7 @@ CKTunsetup(CKTcircuit *ckt)
/* added by HT 050802*/ /* added by HT 050802*/
for(node=ckt->CKTnodes;node;node=node->next){ for(node=ckt->CKTnodes;node;node=node->next){
if(node->icGiven || node->nsGiven) { if(node->icGiven || node->nsGiven) {
node->ptr=0;
node->ptr=NULL;
} }
} }

4
src/spicelib/devices/hfet1/hfetload.c

@ -721,8 +721,8 @@ cgd_calc:
dtdvds = deltdvdse*dvdsevds+deltdvkneet*CK1*temp; dtdvds = deltdvdse*dvdsevds+deltdvkneet*CK1*temp;
*gmd = -delcgdvgs*dvdsevds+delcgdtd*dtdvds; *gmd = -delcgdvgs*dvdsevds+delcgdtd*dtdvds;
} else { } else {
gmg = 0;
gmd = 0;
gmg = NULL;
gmd = NULL;
} }
if(model->HFETAgatemod != 0) { if(model->HFETAgatemod != 0) {

2
src/xspice/cmpp/writ_ifs.c

@ -1251,7 +1251,7 @@ static char *boolean_to_str(Boolean_t value)
default: default:
print_error("INTERNAL ERROR - boolean_to_str() - Impossible boolean value."); print_error("INTERNAL ERROR - boolean_to_str() - Impossible boolean value.");
{ {
char *p = 0; *p = 0;
char *p = NULL; *p = 0;
} }
} }

2
src/xspice/ipc/ipctiein.c

@ -479,7 +479,7 @@ void ipc_free_devices(
for(i = 0; i < num_items; i++) for(i = 0; i < num_items; i++)
{ {
FREE(names[i]); FREE(names[i]);
names[i] = 0;
names[i] = NULL;
} }
if(num_items > 0) if(num_items > 0)

Loading…
Cancel
Save