← Commit list

5e87c2ef1

Maksym Kryzhanovskyy
Maksym Kryzhanovskyy
2010-07-30
FAILED Duration: 41s

Subject

mpstat: small code shrink

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

procps/mpstat.c+7 -9
@@ -954,16 +954,14 @@ int mpstat_main(int UNUSED_PARAM argc, char **argv)
}
if (opt & OPT_INTS) {
- if (strcmp(opt_irq_fmt, "ALL") == 0)
- G.options |= D_IRQ_SUM + D_IRQ_CPU + D_SOFTIRQS;
- else if (strcmp(opt_irq_fmt, "CPU") == 0)
- G.options |= D_IRQ_CPU;
- else if (strcmp(opt_irq_fmt, "SUM") == 0)
- G.options |= D_IRQ_SUM;
- else if (strcmp(opt_irq_fmt, "SCPU") == 0)
- G.options |= D_SOFTIRQS;
- else
+ static const char v[] = {
+ D_IRQ_CPU, D_IRQ_SUM, D_SOFTIRQS,
+ D_IRQ_SUM + D_IRQ_CPU + D_SOFTIRQS
+ };
+ i = index_in_strings("CPU\0SUM\0SCPU\0ALL\0", opt_irq_fmt);
+ if (i == -1)
bb_show_usage();
+ G.options |= v[i];
}
if ((opt & OPT_UTIL) /* -u? */