]> arthur.barton.de Git - netdata.git/blobdiff - src/proc_vmstat.c
improvements identified via static code analysis with cppcheck
[netdata.git] / src / proc_vmstat.c
index 3615f56f6333510adf9ff45b8919b7cbc22cf3c5..a8058398409077a2db021c43405e6794e0cc2672 100644 (file)
@@ -209,7 +209,6 @@ int do_proc_vmstat(int update_every, unsigned long long dt) {
     if(unlikely(!ff)) return 0; // we return 0, so that we will retry to open it next time
 
     uint32_t lines = procfile_lines(ff), l;
-    uint32_t words;
 
     // unsigned long long allocstall = 0ULL;
     // unsigned long long compact_blocks_moved = 0ULL;
@@ -305,7 +304,7 @@ int do_proc_vmstat(int update_every, unsigned long long dt) {
     // unsigned long long unevictable_pgs_stranded = 0ULL;
 
     for(l = 0; l < lines ;l++) {
-        words = procfile_linewords(ff, l);
+        uint32_t words = procfile_linewords(ff, l);
         if(unlikely(words < 2)) {
             if(unlikely(words)) error("Cannot read /proc/vmstat line %u. Expected 2 params, read %u.", l, words);
             continue;