From 7bc6374138ec608c8f0666256e9542fc4e7e0705 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 2 May 2015 10:24:54 +0200 Subject: [PATCH] cleanup, use '\0' instead of 0 in char context --- src/frontend/com_let.c | 8 ++++---- src/frontend/device.c | 4 ++-- src/frontend/dotcards.c | 4 ++-- src/frontend/misccoms.c | 12 ++++++------ src/frontend/newcoms.c | 2 +- src/frontend/parser/complete.c | 2 +- src/frontend/parser/unixcom.c | 2 +- src/frontend/plotting/graf.c | 2 +- src/frontend/plotting/x11.c | 4 ++-- src/frontend/wdisp/windisp.c | 2 +- src/misc/tilde.c | 4 ++-- src/ngproc2mod.c | 2 +- src/spicelib/parser/inpgmod.c | 2 +- src/spicelib/parser/inpgtok.c | 2 +- src/spicelib/parser/inppas3.c | 4 ++-- src/xspice/cmpp/writ_ifs.c | 2 +- src/xspice/mif/mifgetmod.c | 2 +- 17 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/frontend/com_let.c b/src/frontend/com_let.c index 25cd187f4..37117be1e 100644 --- a/src/frontend/com_let.c +++ b/src/frontend/com_let.c @@ -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, '@')) { diff --git a/src/frontend/device.c b/src/frontend/device.c index e6f6cd3be..e42d0d4d5 100644 --- a/src/frontend/device.c +++ b/src/frontend/device.c @@ -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; diff --git a/src/frontend/dotcards.c b/src/frontend/dotcards.c index fb1c62f34..ad7b5f9f2 100644 --- a/src/frontend/dotcards.c +++ b/src/frontend/dotcards.c @@ -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; diff --git a/src/frontend/misccoms.c b/src/frontend/misccoms.c index cad85ad25..450da7966 100644 --- a/src/frontend/misccoms.c +++ b/src/frontend/misccoms.c @@ -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 diff --git a/src/frontend/newcoms.c b/src/frontend/newcoms.c index 2e806a671..fa10ea1a9 100644 --- a/src/frontend/newcoms.c +++ b/src/frontend/newcoms.c @@ -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; } diff --git a/src/frontend/parser/complete.c b/src/frontend/parser/complete.c index 8601a2f2a..c2211ddb0 100644 --- a/src/frontend/parser/complete.c +++ b/src/frontend/parser/complete.c @@ -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 diff --git a/src/frontend/parser/unixcom.c b/src/frontend/parser/unixcom.c index 313857c03..b8ba51ba2 100644 --- a/src/frontend/parser/unixcom.c +++ b/src/frontend/parser/unixcom.c @@ -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); diff --git a/src/frontend/plotting/graf.c b/src/frontend/plotting/graf.c index d26aa5e16..28ebf76b7 100644 --- a/src/frontend/plotting/graf.c +++ b/src/frontend/plotting/graf.c @@ -440,7 +440,7 @@ void gr_pmsg(char *text) { char buf[BSIZE_SP]; - buf[0] = 0; + buf[0] = '\0'; DevUpdate(); diff --git a/src/frontend/plotting/x11.c b/src/frontend/plotting/x11.c index 3497a7b0f..ca9f810f3 100644 --- a/src/frontend/plotting/x11.c +++ b/src/frontend/plotting/x11.c @@ -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, diff --git a/src/frontend/wdisp/windisp.c b/src/frontend/wdisp/windisp.c index a5541c17a..877a42f49 100644 --- a/src/frontend/wdisp/windisp.c +++ b/src/frontend/wdisp/windisp.c @@ -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, diff --git a/src/misc/tilde.c b/src/misc/tilde.c index d31775917..ed7141b71 100644 --- a/src/misc/tilde.c +++ b/src/misc/tilde.c @@ -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; diff --git a/src/ngproc2mod.c b/src/ngproc2mod.c index 521c13b7c..4321801bf 100644 --- a/src/ngproc2mod.c +++ b/src/ngproc2mod.c @@ -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; diff --git a/src/spicelib/parser/inpgmod.c b/src/spicelib/parser/inpgmod.c index 17c885924..eb03dfbe1 100644 --- a/src/spicelib/parser/inpgmod.c +++ b/src/spicelib/parser/inpgmod.c @@ -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; diff --git a/src/spicelib/parser/inpgtok.c b/src/spicelib/parser/inpgtok.c index 35b71c1c7..f914db7e0 100644 --- a/src/spicelib/parser/inpgtok.c +++ b/src/spicelib/parser/inpgtok.c @@ -255,7 +255,7 @@ INPgetUTok(char **line, char **token, int gobble) separator = '\''; point++; } else - separator = 0; + separator = '\0'; /* mark beginning of token */ *line = point; diff --git a/src/spicelib/parser/inppas3.c b/src/spicelib/parser/inppas3.c index 7f57918c4..6e5a7d773 100644 --- a/src/spicelib/parser/inppas3.c +++ b/src/spicelib/parser/inppas3.c @@ -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 */ } diff --git a/src/xspice/cmpp/writ_ifs.c b/src/xspice/cmpp/writ_ifs.c index bf9ca50ac..1ee3f0453 100644 --- a/src/xspice/cmpp/writ_ifs.c +++ b/src/xspice/cmpp/writ_ifs.c @@ -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'; } } diff --git a/src/xspice/mif/mifgetmod.c b/src/xspice/mif/mifgetmod.c index 8a2c4b683..b2e9d607d 100644 --- a/src/xspice/mif/mifgetmod.c +++ b/src/xspice/mif/mifgetmod.c @@ -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) {