From a148eb031e835e5afa0528453b6817dde34b14de Mon Sep 17 00:00:00 2001
From: Anders Lindh Olsson <anders.lindholsson@ess.eu>
Date: Tue, 12 Apr 2022 14:32:45 +0200
Subject: [PATCH] Minor linting fixes

---
 require-ess/src/expr.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/require-ess/src/expr.c b/require-ess/src/expr.c
index 37ade64a..b77d0302 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);
-- 
GitLab