diff --git a/require-ess/src/expr.c b/require-ess/src/expr.c index 37ade64a787133ba5eb60761485acd53d24c78b1..b77d030289bc7d8b4668753b24ac0f318ade54e8 100644 --- a/require-ess/src/expr.c +++ b/require-ess/src/expr.c @@ -160,11 +160,11 @@ static int startsWith(const char *p, const char *s) { static int parseOp(const char **pp) { const char *p = *pp; - int o, l; skipSpace(p); if (ispunct((unsigned char)*p)) { - for (o = 1; o < (int)(sizeof(ops) / sizeof(ops[0])); o++) { + for (int o = 1; o < (int)(sizeof(ops) / sizeof(ops[0])); o++) { + int l; if ((l = startsWith(p, ops[o].str))) { /* operator found */ *pp = p + l; @@ -179,7 +179,7 @@ static int parseSubExpr(const char **pp, long *v, int pr, int o) { const char *p = *pp; long val = o ? *v : 0; long val2; - int o2 = o; + int o2; if (exprDebug) printf("parseExpr(%d): start %ld %s \"%s\"\n", pr, val, ops[o].str, p); @@ -322,10 +322,10 @@ static int parseSubExpr(const char **pp, long *v, int pr, int o) { static const char *getFormat(const char **pp) { static char format[20]; const char *p = *pp; - unsigned int i = 1; if (exprDebug) printf("getFormat %s\n", p); if ((format[0] = *p++) == '%') { + unsigned int i = 1; while (i < sizeof(format) && memchr(" #-+0", *p, 5)) format[i++] = *p++; while (i < sizeof(format) && *p >= '0' && *p <= '9') @@ -334,7 +334,7 @@ static const char *getFormat(const char **pp) { format[i++] = 'l'; if (i < sizeof(format) && memchr("diouxXc", *p, 7)) { format[i++] = *p++; - format[i] = 0; + format[i] = 0; // FIXME (alo): not our memory! *pp = p; if (exprDebug) printf("format = '%s'\n", format);