Refine use of integer variables to quiet static analyzers and reduce object code size a little
Note that the no bugs of consequence were found by the static analyzer. The analyzer used was codesafe.cn
diff --git a/test/run_tests.c b/test/run_tests.c
index 5b72398..133103f 100644
--- a/test/run_tests.c
+++ b/test/run_tests.c
@@ -24,7 +24,7 @@
Test configuration
*/
-typedef int (test_fun_t)(void);
+typedef int32_t (test_fun_t)(void);
typedef const char * (test_fun2_t)(void);
@@ -137,12 +137,12 @@
}
bool bDidSomeOutput = false;
- for(int n = nMax; n > 0; n/=10) {
- int x = nNum/n;
- if(x || bDidSomeOutput){
+ for(int32_t n = nMax; n > 0; n/=10) {
+ int nDigitValue = nNum/n;
+ if(nDigitValue || bDidSomeOutput){
bDidSomeOutput = true;
- UsefulOutBuf_AppendByte(&OutBuf, '0' + x);
- nNum -= x * n;
+ UsefulOutBuf_AppendByte(&OutBuf, (uint8_t)('0' + nDigitValue));
+ nNum -= nDigitValue * n;
}
}
if(!bDidSomeOutput){
@@ -238,7 +238,7 @@
}
}
- int nTestResult = (t->test_fun)();
+ int32_t nTestResult = (t->test_fun)();
nTestsRun++;
if(pfOutput) {
(*pfOutput)(t->szTestName, poutCtx, 0);