cleanup, use '\0' instead of 0 in char context
This commit is contained in:
parent
19e427e3a5
commit
7bc6374138
|
|
@ -38,7 +38,7 @@ com_let(wordlist *wl)
|
||||||
/* extract indices */
|
/* extract indices */
|
||||||
numdims = 0;
|
numdims = 0;
|
||||||
if ((rhs = strchr(p, '=')) != NULL) {
|
if ((rhs = strchr(p, '=')) != NULL) {
|
||||||
*rhs++ = 0;
|
*rhs++ = '\0';
|
||||||
} else {
|
} else {
|
||||||
fprintf(cp_err, "Error: bad let syntax\n");
|
fprintf(cp_err, "Error: bad let syntax\n");
|
||||||
tfree(p);
|
tfree(p);
|
||||||
|
|
@ -47,7 +47,7 @@ com_let(wordlist *wl)
|
||||||
|
|
||||||
if ((s = strchr(p, '[')) != NULL) {
|
if ((s = strchr(p, '[')) != NULL) {
|
||||||
need_open = 0;
|
need_open = 0;
|
||||||
*s++ = 0;
|
*s++ = '\0';
|
||||||
while (!need_open || *s == '[') {
|
while (!need_open || *s == '[') {
|
||||||
depth = 0;
|
depth = 0;
|
||||||
if (need_open)
|
if (need_open)
|
||||||
|
|
@ -75,7 +75,7 @@ com_let(wordlist *wl)
|
||||||
need_open = 0;
|
need_open = 0;
|
||||||
|
|
||||||
if (*q)
|
if (*q)
|
||||||
*q++ = 0;
|
*q++ = '\0';
|
||||||
|
|
||||||
/* evaluate expression between s and q */
|
/* evaluate expression between s and q */
|
||||||
/* va, indexing */
|
/* va, indexing */
|
||||||
|
|
@ -120,7 +120,7 @@ com_let(wordlist *wl)
|
||||||
for (q = p + strlen(p) - 1; *q <= ' ' && p <= q; q--)
|
for (q = p + strlen(p) - 1; *q <= ' ' && p <= q; q--)
|
||||||
;
|
;
|
||||||
|
|
||||||
*++q = 0;
|
*++q = '\0';
|
||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
if (eq(p, "all") ||strchr(p, '@')) {
|
if (eq(p, "all") ||strchr(p, '@')) {
|
||||||
|
|
|
||||||
|
|
@ -1280,11 +1280,11 @@ com_alter_common(wordlist *wl, int do_model)
|
||||||
dev = p + 1;
|
dev = p + 1;
|
||||||
p = strchr(p, '[');
|
p = strchr(p, '[');
|
||||||
if (p) {
|
if (p) {
|
||||||
*p++ = 0;
|
*p++ = '\0';
|
||||||
param = p;
|
param = p;
|
||||||
p = strchr(p, ']');
|
p = strchr(p, ']');
|
||||||
if (p)
|
if (p)
|
||||||
*p = 0;
|
*p = '\0';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dev = p;
|
dev = p;
|
||||||
|
|
|
||||||
|
|
@ -601,7 +601,7 @@ gettoks(char *s)
|
||||||
c = r;
|
c = r;
|
||||||
|
|
||||||
if (c)
|
if (c)
|
||||||
*c = 0;
|
*c = '\0';
|
||||||
|
|
||||||
wl = wl_cons(NULL, NULL);
|
wl = wl_cons(NULL, NULL);
|
||||||
*prevp = wl;
|
*prevp = wl;
|
||||||
|
|
@ -617,7 +617,7 @@ gettoks(char *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c != r) {
|
if (c != r) {
|
||||||
*r = 0;
|
*r = '\0';
|
||||||
wl = wl_cons(copy(c + 1), NULL);
|
wl = wl_cons(copy(c + 1), NULL);
|
||||||
*prevp = wl;
|
*prevp = wl;
|
||||||
prevp = &wl->wl_next;
|
prevp = &wl->wl_next;
|
||||||
|
|
|
||||||
|
|
@ -180,9 +180,9 @@ com_version(wordlist *wl)
|
||||||
"** Copyright 1985-1994, Regents of the University of California.\n"
|
"** Copyright 1985-1994, Regents of the University of California.\n"
|
||||||
"** %s\n",
|
"** %s\n",
|
||||||
ft_sim->simulator, ft_sim->version, ft_sim->description, Spice_Manual);
|
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);
|
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, "** Creation Date: %s\n", Spice_Build_Date);
|
||||||
fprintf(cp_out, "******\n");
|
fprintf(cp_out, "******\n");
|
||||||
|
|
||||||
|
|
@ -197,9 +197,9 @@ com_version(wordlist *wl)
|
||||||
"** %s-%s\n"
|
"** %s-%s\n"
|
||||||
"** %s\n",
|
"** %s\n",
|
||||||
ft_sim->simulator, ft_sim->version, Spice_Manual);
|
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);
|
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, "** Creation Date: %s\n", Spice_Build_Date);
|
||||||
fprintf(cp_out, "******\n");
|
fprintf(cp_out, "******\n");
|
||||||
|
|
||||||
|
|
@ -212,9 +212,9 @@ com_version(wordlist *wl)
|
||||||
"** Copyright 1985-1994, Regents of the University of California.\n"
|
"** Copyright 1985-1994, Regents of the University of California.\n"
|
||||||
"** %s\n",
|
"** %s\n",
|
||||||
ft_sim->simulator, ft_sim->version, ft_sim->description, Spice_Manual);
|
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);
|
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, "** Creation Date: %s\n", Spice_Build_Date);
|
||||||
fprintf(cp_out, "**\n");
|
fprintf(cp_out, "**\n");
|
||||||
#ifdef CIDER
|
#ifdef CIDER
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ com_reshape(wordlist *wl)
|
||||||
if (p != w->wl_word)
|
if (p != w->wl_word)
|
||||||
w = w->wl_next;
|
w = w->wl_next;
|
||||||
wlast = w;
|
wlast = w;
|
||||||
*p++ = 0;
|
*p++ = '\0';
|
||||||
} else {
|
} else {
|
||||||
wlast = NULL;
|
wlast = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -414,7 +414,7 @@ cp_ccon(bool on)
|
||||||
(void) ioctl(fileno(cp_in), TERM_GET, &OS_Buf);
|
(void) ioctl(fileno(cp_in), TERM_GET, &OS_Buf);
|
||||||
#endif
|
#endif
|
||||||
sbuf = OS_Buf;
|
sbuf = OS_Buf;
|
||||||
sbuf.c_cc[VEOF] = 0;
|
sbuf.c_cc[VEOF] = '\0';
|
||||||
sbuf.c_cc[VEOL] = ESCAPE;
|
sbuf.c_cc[VEOL] = ESCAPE;
|
||||||
sbuf.c_cc[VEOL2] = CNTRL_D;
|
sbuf.c_cc[VEOL2] = CNTRL_D;
|
||||||
#if HAVE_TCSETATTR
|
#if HAVE_TCSETATTR
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ cp_rehash(char *pathlist, bool docc)
|
||||||
# ifdef HAVE_GETCWD
|
# ifdef HAVE_GETCWD
|
||||||
(void) getcwd(buf, sizeof(buf));
|
(void) getcwd(buf, sizeof(buf));
|
||||||
# else
|
# else
|
||||||
*buf = 0;
|
*buf = '\0';
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
i = strlen(buf);
|
i = strlen(buf);
|
||||||
|
|
|
||||||
|
|
@ -440,7 +440,7 @@ void
|
||||||
gr_pmsg(char *text)
|
gr_pmsg(char *text)
|
||||||
{
|
{
|
||||||
char buf[BSIZE_SP];
|
char buf[BSIZE_SP];
|
||||||
buf[0] = 0;
|
buf[0] = '\0';
|
||||||
|
|
||||||
DevUpdate();
|
DevUpdate();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -434,7 +434,7 @@ X11_NewViewport(GRAPH *graph)
|
||||||
if (p != fontname) {
|
if (p != fontname) {
|
||||||
for (q = fontname; *p; *q++ = *p++)
|
for (q = fontname; *p; *q++ = *p++)
|
||||||
;
|
;
|
||||||
*q = 0;
|
*q = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
trys = 1;
|
trys = 1;
|
||||||
|
|
@ -823,7 +823,7 @@ zoomin(GRAPH *graph)
|
||||||
|
|
||||||
strncpy(buf2, graph->plotname, sizeof(buf2));
|
strncpy(buf2, graph->plotname, sizeof(buf2));
|
||||||
if ((t = strchr(buf2, ':')) != NULL)
|
if ((t = strchr(buf2, ':')) != NULL)
|
||||||
*t = 0;
|
*t = '\0';
|
||||||
|
|
||||||
if (!eq(plot_cur->pl_typename, buf2)) {
|
if (!eq(plot_cur->pl_typename, buf2)) {
|
||||||
(void) sprintf(buf,
|
(void) sprintf(buf,
|
||||||
|
|
|
||||||
|
|
@ -482,7 +482,7 @@ LRESULT CALLBACK PlotWindowProc( HWND hwnd,
|
||||||
|
|
||||||
strncpy(buf2, gr->plotname, sizeof(buf2));
|
strncpy(buf2, gr->plotname, sizeof(buf2));
|
||||||
if ((t = strchr(buf2, ':')) != NULL)
|
if ((t = strchr(buf2, ':')) != NULL)
|
||||||
*t = 0;
|
*t = '\0';
|
||||||
|
|
||||||
if (!eq(plot_cur->pl_typename, buf2)) {
|
if (!eq(plot_cur->pl_typename, buf2)) {
|
||||||
(void) sprintf(buf,
|
(void) sprintf(buf,
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ tildexpand(char *string)
|
||||||
pw = getpwuid(getuid());
|
pw = getpwuid(getuid());
|
||||||
if (pw)
|
if (pw)
|
||||||
result = pw->pw_dir;
|
result = pw->pw_dir;
|
||||||
*buf = 0;
|
*buf = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -70,7 +70,7 @@ tildexpand(char *string)
|
||||||
k = buf;
|
k = buf;
|
||||||
while ((c = *string) && c != '/')
|
while ((c = *string) && c != '/')
|
||||||
*k++ = c, string++;
|
*k++ = c, string++;
|
||||||
*k = 0;
|
*k = '\0';
|
||||||
pw = getpwnam(buf);
|
pw = getpwnam(buf);
|
||||||
if (pw)
|
if (pw)
|
||||||
result = pw->pw_dir;
|
result = pw->pw_dir;
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ main(void) {
|
||||||
*typeline == '\n' ) {
|
*typeline == '\n' ) {
|
||||||
typeline ++;
|
typeline ++;
|
||||||
}
|
}
|
||||||
if(*typeline == 0) break;
|
if(*typeline == '\0') break;
|
||||||
if(strncmp("nm",typeline,2) == 0) {
|
if(strncmp("nm",typeline,2) == 0) {
|
||||||
ncur = TMALLOC(nmod, 1);
|
ncur = TMALLOC(nmod, 1);
|
||||||
ncur->nnext = NULL;
|
ncur->nnext = NULL;
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ create_model( CKTcircuit* ckt, INPmodel* modtmp, INPtables* tab )
|
||||||
tfree(parm);
|
tfree(parm);
|
||||||
INPgetTok(&line, &parm, 1); /* throw away 'modname' */
|
INPgetTok(&line, &parm, 1); /* throw away 'modname' */
|
||||||
tfree(parm);
|
tfree(parm);
|
||||||
while (*line != 0) {
|
while (*line != '\0') {
|
||||||
INPgetTok(&line, &parm, 1);
|
INPgetTok(&line, &parm, 1);
|
||||||
if (!*parm)
|
if (!*parm)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,7 @@ INPgetUTok(char **line, char **token, int gobble)
|
||||||
separator = '\'';
|
separator = '\'';
|
||||||
point++;
|
point++;
|
||||||
} else
|
} else
|
||||||
separator = 0;
|
separator = '\0';
|
||||||
|
|
||||||
/* mark beginning of token */
|
/* mark beginning of token */
|
||||||
*line = point;
|
*line = point;
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ INPpas3(CKTcircuit *ckt, card *data, INPtables *tab, TSKtask *task,
|
||||||
for(;;) {
|
for(;;) {
|
||||||
/* loop until we run out of data */
|
/* loop until we run out of data */
|
||||||
INPgetTok(&line,&name,1);
|
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',
|
/* If we have 'all = value' , then set all voltage nodes to 'value',
|
||||||
except for ground node at node->number 0 */
|
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 */
|
/* loop until we run out of data */
|
||||||
INPgetTok(&line,&name,1);
|
INPgetTok(&line,&name,1);
|
||||||
/* check to see if in the form V(xxx) and grab the xxx */
|
/* check to see if in the form V(xxx) and grab the xxx */
|
||||||
if( *name == 0) {
|
if( *name == '\0') {
|
||||||
FREE(name);
|
FREE(name);
|
||||||
break; /* end of line */
|
break; /* end of line */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 = NULL; *p = 0;
|
char *p = NULL; *p = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ char *MIFgetMod(
|
||||||
INPgetTok(&line,&parm,1); /* throw away 'modtype' */
|
INPgetTok(&line,&parm,1); /* throw away 'modtype' */
|
||||||
tfree(parm);
|
tfree(parm);
|
||||||
|
|
||||||
while(*line != 0) {
|
while(*line != '\0') {
|
||||||
INPgetTok(&line,&parm,1);
|
INPgetTok(&line,&parm,1);
|
||||||
for(j=0 ; j < *(ft_sim->devices[modtmp->INPmodType]->numModelParms); j++) {
|
for(j=0 ; j < *(ft_sim->devices[modtmp->INPmodType]->numModelParms); j++) {
|
||||||
if (strcmp(parm, ft_sim->devices[modtmp->INPmodType]->modelParms[j].keyword) == 0) {
|
if (strcmp(parm, ft_sim->devices[modtmp->INPmodType]->modelParms[j].keyword) == 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue