Browse Source

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

pre-master-46
rlar 11 years ago
parent
commit
7bc6374138
  1. 8
      src/frontend/com_let.c
  2. 4
      src/frontend/device.c
  3. 4
      src/frontend/dotcards.c
  4. 12
      src/frontend/misccoms.c
  5. 2
      src/frontend/newcoms.c
  6. 2
      src/frontend/parser/complete.c
  7. 2
      src/frontend/parser/unixcom.c
  8. 2
      src/frontend/plotting/graf.c
  9. 4
      src/frontend/plotting/x11.c
  10. 2
      src/frontend/wdisp/windisp.c
  11. 4
      src/misc/tilde.c
  12. 2
      src/ngproc2mod.c
  13. 2
      src/spicelib/parser/inpgmod.c
  14. 2
      src/spicelib/parser/inpgtok.c
  15. 4
      src/spicelib/parser/inppas3.c
  16. 2
      src/xspice/cmpp/writ_ifs.c
  17. 2
      src/xspice/mif/mifgetmod.c

8
src/frontend/com_let.c

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

4
src/frontend/device.c

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

4
src/frontend/dotcards.c

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

12
src/frontend/misccoms.c

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

2
src/frontend/newcoms.c

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

2
src/frontend/parser/complete.c

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

2
src/frontend/parser/unixcom.c

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

2
src/frontend/plotting/graf.c

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

4
src/frontend/plotting/x11.c

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

2
src/frontend/wdisp/windisp.c

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

4
src/misc/tilde.c

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

2
src/ngproc2mod.c

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

2
src/spicelib/parser/inpgmod.c

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

2
src/spicelib/parser/inpgtok.c

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

4
src/spicelib/parser/inppas3.c

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

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

2
src/xspice/mif/mifgetmod.c

@ -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…
Cancel
Save