cleanup, use '\0' instead of 0 in char context

This commit is contained in:
rlar 2015-05-02 10:24:54 +02:00
parent 19e427e3a5
commit 7bc6374138
17 changed files with 30 additions and 30 deletions

View File

@ -38,7 +38,7 @@ com_let(wordlist *wl)
/* extract indices */
numdims = 0;
if ((rhs = strchr(p, '=')) != NULL) {
*rhs++ = 0;
*rhs++ = '\0';
} else {
fprintf(cp_err, "Error: bad let syntax\n");
tfree(p);
@ -47,7 +47,7 @@ com_let(wordlist *wl)
if ((s = strchr(p, '[')) != NULL) {
need_open = 0;
*s++ = 0;
*s++ = '\0';
while (!need_open || *s == '[') {
depth = 0;
if (need_open)
@ -75,7 +75,7 @@ com_let(wordlist *wl)
need_open = 0;
if (*q)
*q++ = 0;
*q++ = '\0';
/* evaluate expression between s and q */
/* va, indexing */
@ -120,7 +120,7 @@ com_let(wordlist *wl)
for (q = p + strlen(p) - 1; *q <= ' ' && p <= q; q--)
;
*++q = 0;
*++q = '\0';
/* sanity check */
if (eq(p, "all") ||strchr(p, '@')) {

View File

@ -1280,11 +1280,11 @@ com_alter_common(wordlist *wl, int do_model)
dev = p + 1;
p = strchr(p, '[');
if (p) {
*p++ = 0;
*p++ = '\0';
param = p;
p = strchr(p, ']');
if (p)
*p = 0;
*p = '\0';
}
} else {
dev = p;

View File

@ -601,7 +601,7 @@ gettoks(char *s)
c = r;
if (c)
*c = 0;
*c = '\0';
wl = wl_cons(NULL, NULL);
*prevp = wl;
@ -617,7 +617,7 @@ gettoks(char *s)
}
if (c != r) {
*r = 0;
*r = '\0';
wl = wl_cons(copy(c + 1), NULL);
*prevp = wl;
prevp = &wl->wl_next;

View File

@ -180,9 +180,9 @@ com_version(wordlist *wl)
"** Copyright 1985-1994, Regents of the University of California.\n"
"** %s\n",
ft_sim->simulator, ft_sim->version, ft_sim->description, Spice_Manual);
if (Spice_Notice != NULL && *Spice_Notice != 0)
if (Spice_Notice != NULL && *Spice_Notice != '\0')
fprintf(cp_out, "** %s\n", Spice_Notice);
if (Spice_Build_Date != NULL && *Spice_Build_Date != 0)
if (Spice_Build_Date != NULL && *Spice_Build_Date != '\0')
fprintf(cp_out, "** Creation Date: %s\n", Spice_Build_Date);
fprintf(cp_out, "******\n");
@ -197,9 +197,9 @@ com_version(wordlist *wl)
"** %s-%s\n"
"** %s\n",
ft_sim->simulator, ft_sim->version, Spice_Manual);
if (Spice_Notice != NULL && *Spice_Notice != 0)
if (Spice_Notice != NULL && *Spice_Notice != '\0')
fprintf(cp_out, "** %s\n", Spice_Notice);
if (Spice_Build_Date != NULL && *Spice_Build_Date != 0)
if (Spice_Build_Date != NULL && *Spice_Build_Date != '\0')
fprintf(cp_out, "** Creation Date: %s\n", Spice_Build_Date);
fprintf(cp_out, "******\n");
@ -212,9 +212,9 @@ com_version(wordlist *wl)
"** Copyright 1985-1994, Regents of the University of California.\n"
"** %s\n",
ft_sim->simulator, ft_sim->version, ft_sim->description, Spice_Manual);
if (Spice_Notice != NULL && *Spice_Notice != 0)
if (Spice_Notice != NULL && *Spice_Notice != '\0')
fprintf(cp_out, "** %s\n", Spice_Notice);
if (Spice_Build_Date != NULL && *Spice_Build_Date != 0)
if (Spice_Build_Date != NULL && *Spice_Build_Date != '\0')
fprintf(cp_out, "** Creation Date: %s\n", Spice_Build_Date);
fprintf(cp_out, "**\n");
#ifdef CIDER

View File

@ -54,7 +54,7 @@ com_reshape(wordlist *wl)
if (p != w->wl_word)
w = w->wl_next;
wlast = w;
*p++ = 0;
*p++ = '\0';
} else {
wlast = NULL;
}

View File

@ -414,7 +414,7 @@ cp_ccon(bool on)
(void) ioctl(fileno(cp_in), TERM_GET, &OS_Buf);
#endif
sbuf = OS_Buf;
sbuf.c_cc[VEOF] = 0;
sbuf.c_cc[VEOF] = '\0';
sbuf.c_cc[VEOL] = ESCAPE;
sbuf.c_cc[VEOL2] = CNTRL_D;
#if HAVE_TCSETATTR

View File

@ -96,7 +96,7 @@ cp_rehash(char *pathlist, bool docc)
# ifdef HAVE_GETCWD
(void) getcwd(buf, sizeof(buf));
# else
*buf = 0;
*buf = '\0';
# endif
#endif
i = strlen(buf);

View File

@ -440,7 +440,7 @@ void
gr_pmsg(char *text)
{
char buf[BSIZE_SP];
buf[0] = 0;
buf[0] = '\0';
DevUpdate();

View File

@ -434,7 +434,7 @@ X11_NewViewport(GRAPH *graph)
if (p != fontname) {
for (q = fontname; *p; *q++ = *p++)
;
*q = 0;
*q = '\0';
}
trys = 1;
@ -823,7 +823,7 @@ zoomin(GRAPH *graph)
strncpy(buf2, graph->plotname, sizeof(buf2));
if ((t = strchr(buf2, ':')) != NULL)
*t = 0;
*t = '\0';
if (!eq(plot_cur->pl_typename, buf2)) {
(void) sprintf(buf,

View File

@ -482,7 +482,7 @@ LRESULT CALLBACK PlotWindowProc( HWND hwnd,
strncpy(buf2, gr->plotname, sizeof(buf2));
if ((t = strchr(buf2, ':')) != NULL)
*t = 0;
*t = '\0';
if (!eq(plot_cur->pl_typename, buf2)) {
(void) sprintf(buf,

View File

@ -62,7 +62,7 @@ tildexpand(char *string)
pw = getpwuid(getuid());
if (pw)
result = pw->pw_dir;
*buf = 0;
*buf = '\0';
}
} else {
@ -70,7 +70,7 @@ tildexpand(char *string)
k = buf;
while ((c = *string) && c != '/')
*k++ = c, string++;
*k = 0;
*k = '\0';
pw = getpwnam(buf);
if (pw)
result = pw->pw_dir;

View File

@ -99,7 +99,7 @@ main(void) {
*typeline == '\n' ) {
typeline ++;
}
if(*typeline == 0) break;
if(*typeline == '\0') break;
if(strncmp("nm",typeline,2) == 0) {
ncur = TMALLOC(nmod, 1);
ncur->nnext = NULL;

View File

@ -80,7 +80,7 @@ create_model( CKTcircuit* ckt, INPmodel* modtmp, INPtables* tab )
tfree(parm);
INPgetTok(&line, &parm, 1); /* throw away 'modname' */
tfree(parm);
while (*line != 0) {
while (*line != '\0') {
INPgetTok(&line, &parm, 1);
if (!*parm)
continue;

View File

@ -255,7 +255,7 @@ INPgetUTok(char **line, char **token, int gobble)
separator = '\'';
point++;
} else
separator = 0;
separator = '\0';
/* mark beginning of token */
*line = point;

View File

@ -68,7 +68,7 @@ INPpas3(CKTcircuit *ckt, card *data, INPtables *tab, TSKtask *task,
for(;;) {
/* loop until we run out of data */
INPgetTok(&line,&name,1);
if( *name == 0) break; /* end of line */
if( *name == '\0') break; /* end of line */
/* If we have 'all = value' , then set all voltage nodes to 'value',
except for ground node at node->number 0 */
@ -113,7 +113,7 @@ INPpas3(CKTcircuit *ckt, card *data, INPtables *tab, TSKtask *task,
/* loop until we run out of data */
INPgetTok(&line,&name,1);
/* check to see if in the form V(xxx) and grab the xxx */
if( *name == 0) {
if( *name == '\0') {
FREE(name);
break; /* end of line */
}

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 = NULL; *p = 0;
char *p = NULL; *p = '\0';
}
}

View File

@ -182,7 +182,7 @@ char *MIFgetMod(
INPgetTok(&line,&parm,1); /* throw away 'modtype' */
tfree(parm);
while(*line != 0) {
while(*line != '\0') {
INPgetTok(&line,&parm,1);
for(j=0 ; j < *(ft_sim->devices[modtmp->INPmodType]->numModelParms); j++) {
if (strcmp(parm, ft_sim->devices[modtmp->INPmodType]->modelParms[j].keyword) == 0) {