cleanup, use NULL instead of 0 in pointer context

This commit is contained in:
rlar 2015-05-02 10:24:49 +02:00
parent 6513aa5173
commit 19e427e3a5
19 changed files with 51 additions and 51 deletions

View File

@ -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);

View File

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

View File

@ -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 }

View File

@ -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 */

View File

@ -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);

View File

@ -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) {

View File

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

View File

@ -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]));

View File

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

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;
}
}
}

View File

@ -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);

View File

@ -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

View File

@ -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;
}
}

View File

@ -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) {

View File

@ -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;
}
}

View File

@ -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)