Author: stuge
Date: 2010-01-16 18:21:17 +0100 (Sat, 16 Jan 2010)
New Revision: 5020

Modified:
   trunk/util/msrtool/msrtool.c
Log:
msrtool: Remove indent by using continue inside for() to avoid an if block

The only actual code change is from
if (.. >= 1) {
}
to
if (.. < 1)
        continue
so this is pretty trivial.

Signed-off-by: Peter Stuge <pe...@stuge.se>
Acked-by: Peter Stuge <pe...@stuge.se>


Modified: trunk/util/msrtool/msrtool.c
===================================================================
--- trunk/util/msrtool/msrtool.c        2010-01-16 16:44:20 UTC (rev 5019)
+++ trunk/util/msrtool/msrtool.c        2010-01-16 17:21:17 UTC (rev 5020)
@@ -182,7 +182,7 @@
 int do_diff(const char *difffn) {
        char tmpfn[20], line[512];
        size_t start, len;
-       int ret = 1, tmp;
+       int ret = 1, found, tmp;
        FILE *fin = NULL, *fout = stdout;
        uint8_t rev = 0;
        uint32_t addr, linenum;
@@ -203,19 +203,20 @@
                goto done;
        for (linenum = 1; NULL != fgets(line, sizeof(line), fin); ++linenum) {
                start = (0 == strncmp("0x", line, 2)) ? 2 : 0;
-               if (sscanf(line + start, "%8x %n%*x", &addr, &tmp) >= 1) {
-                       start += tmp;
-                       for (len = strlen(line) - 1; NULL != strchr("\r\n", 
line[len]); --len)
-                               line[len] = 0;
-                       if (!str2msr(line + start, &mf)) {
-                               fprintf(stderr, "%s:%d: invalid MSR value 
'%s'\n", difffn, linenum, line + start);
-                               continue;
-                       }
-                       if (!sys->rdmsr(cpu, addr, &mhw))
-                               goto done;
-                       if (diff_msr(fout, addr, rev ? mhw : mf, rev ? mf : 
mhw))
-                               fprintf(fout, "\n");
+               found = sscanf(line + start, "%8x %n%*x", &addr, &tmp);
+               if (found < 1)
+                       continue;
+               start += tmp;
+               for (len = strlen(line) - 1; NULL != strchr("\r\n", line[len]); 
--len)
+                       line[len] = 0;
+               if (!str2msr(line + start, &mf)) {
+                       fprintf(stderr, "%s:%d: invalid MSR value '%s'\n", 
difffn, linenum, line + start);
+                       continue;
                }
+               if (!sys->rdmsr(cpu, addr, &mhw))
+                       goto done;
+               if (diff_msr(fout, addr, rev ? mhw : mf, rev ? mf : mhw))
+                       fprintf(fout, "\n");
        }
        if (!feof(fin))
                fprintf(stderr, "%s:%d: fgets: %s\n", difffn, linenum, 
strerror(errno));


-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to