summaryrefslogtreecommitdiff
path: root/rsc
diff options
context:
space:
mode:
authorPierre-André Jacquod <pjacquod@alumni.ethz.ch>2011-10-02 15:49:43 +0200
committerPierre-André Jacquod <pjacquod@alumni.ethz.ch>2011-10-07 15:57:47 +0200
commit0921457488898b43152e33d1184929f7436aeeb4 (patch)
tree0c155119ff6ff80148013080598df085448321a5 /rsc
parentfb2fe60773654c17e366aa6857dbcf975cb9edb0 (diff)
cppcheck reduce scope of var in rsc/...cpp3.c/cpp4.c/cpp6.c
Diffstat (limited to 'rsc')
-rw-r--r--rsc/source/rscpp/cpp3.c7
-rw-r--r--rsc/source/rscpp/cpp4.c11
-rw-r--r--rsc/source/rscpp/cpp6.c3
3 files changed, 10 insertions, 11 deletions
diff --git a/rsc/source/rscpp/cpp3.c b/rsc/source/rscpp/cpp3.c
index 7f9c8adbaf8d..b9ed7a9e1af1 100644
--- a/rsc/source/rscpp/cpp3.c
+++ b/rsc/source/rscpp/cpp3.c
@@ -449,7 +449,6 @@ void initdefines()
register char **pp;
register char *tp;
register DEFBUF *dp;
- int i;
time_t tvec;
#if !defined( WNT ) && !defined(G3)
@@ -476,8 +475,10 @@ void initdefines()
* notices this and calls the appropriate routine.
* DEF_NOARGS is one greater than the first "magic" definition.
*/
- if (nflag < 2) {
- for (pp = magic, i = DEF_NOARGS; *pp != NULL; pp++) {
+ if (nflag < 2)
+ {
+ int i = DEF_NOARGS;
+ for (pp = magic; *pp != NULL; pp++) {
dp = defendel(*pp, FALSE);
dp->nargs = --i;
}
diff --git a/rsc/source/rscpp/cpp4.c b/rsc/source/rscpp/cpp4.c
index 3f5e03a0b5b7..af8995be4524 100644
--- a/rsc/source/rscpp/cpp4.c
+++ b/rsc/source/rscpp/cpp4.c
@@ -554,12 +554,9 @@ void expstuff(DEFBUF* tokenp)
* Stuff the macro body, replacing formal parameters by actual parameters.
*/
{
- register int c; /* Current character */
register char *inp; /* -> repl string */
register char *defp; /* -> macro output buff */
- int size; /* Actual parm. size */
char *defend; /* -> output buff end */
- int string_magic; /* String formal hack */
FILEINFO *file; /* Funny #include */
extern FILEINFO *getfile();
@@ -568,6 +565,7 @@ void expstuff(DEFBUF* tokenp)
defp = file->buffer; /* -> output buffer */
defend = defp + (NBUFF - 1); /* Note its end */
if (inp != NULL) {
+ register int c; /* Current character */
while ((c = (*inp++ & 0xFF)) != EOS) {
#ifdef SOLAR
if (c == DEL) {
@@ -575,14 +573,15 @@ void expstuff(DEFBUF* tokenp)
#else
if (c >= MAC_PARM && c <= (MAC_PARM + PAR_MAC)) {
#endif
- string_magic = (c == (MAC_PARM + PAR_MAC));
+ int string_magic = (c == (MAC_PARM + PAR_MAC));
if (string_magic)
c = (*inp++ & 0xFF);
/*
* Replace formal parameter by actual parameter string.
*/
- if ((c -= MAC_PARM) < nargs) {
- size = strlen(parlist[c]);
+ if ((c -= MAC_PARM) < nargs)
+ {
+ int size = strlen(parlist[c]);
if ((defp + size) >= defend)
goto nospace;
/*
diff --git a/rsc/source/rscpp/cpp6.c b/rsc/source/rscpp/cpp6.c
index cb628ba4c04d..6c021fb823c5 100644
--- a/rsc/source/rscpp/cpp6.c
+++ b/rsc/source/rscpp/cpp6.c
@@ -278,7 +278,6 @@ catenate()
* and return FALSE.
*/
{
- register int c;
register char *token1;
#if OK_CONCAT
@@ -288,7 +287,7 @@ catenate()
}
else {
token1 = savestring(token); /* Save first token */
- c = macroid(get()); /* Scan next token */
+ register int c = macroid(get()); /* Scan next token */
switch(type[c]) { /* What was it? */
case LET: /* An identifier, ... */
if (strlen(token1) + strlen(token) >= NWORK)