From: Nicolas Iooss Date: Mon, 23 Jun 2014 16:08:15 +0000 (+0200) Subject: Turbostat: make DO_OR_GOTO_ERR look like a function X-Git-Tag: collectd-5.5.0~24^2~83 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=26ae8146236a7717d02dd5dda2caa0e5f9ee8fdd;p=collectd.git Turbostat: make DO_OR_GOTO_ERR look like a function Signed-off-by: Nicolas Iooss [git@lerya.net: Ported from other git, changed commit name] Signed-off-by: Vincent Brillault --- diff --git a/src/turbostat.c b/src/turbostat.c index 41e2219a..b6aa0a9d 100644 --- a/src/turbostat.c +++ b/src/turbostat.c @@ -1456,19 +1456,19 @@ initialize_counters(int cpu_id) #define DO_OR_GOTO_ERR(something) \ do { \ - ret = something; \ + ret = (something); \ if (ret < 0) \ goto err; \ -} while (0); +} while (0) static int setup_all_buffers(void) { int ret; - DO_OR_GOTO_ERR(topology_probe()) - DO_OR_GOTO_ERR(allocate_counters(&thread_even, &core_even, &package_even)) - DO_OR_GOTO_ERR(allocate_counters(&thread_odd, &core_odd, &package_odd)) - DO_OR_GOTO_ERR(for_all_proc_cpus(initialize_counters)) + DO_OR_GOTO_ERR(topology_probe()); + DO_OR_GOTO_ERR(allocate_counters(&thread_even, &core_even, &package_even)); + DO_OR_GOTO_ERR(allocate_counters(&thread_odd, &core_odd, &package_odd)); + DO_OR_GOTO_ERR(for_all_proc_cpus(initialize_counters)); allocated = true; return 0; @@ -1483,11 +1483,11 @@ turbostat_init(void) int ret; struct timespec ts; - DO_OR_GOTO_ERR(check_cpuid()) - DO_OR_GOTO_ERR(check_dev_msr()) - DO_OR_GOTO_ERR(check_super_user()) - DO_OR_GOTO_ERR(setup_all_buffers()) - DO_OR_GOTO_ERR(for_all_cpus(set_temperature_target, EVEN_COUNTERS)) + DO_OR_GOTO_ERR(check_cpuid()); + DO_OR_GOTO_ERR(check_dev_msr()); + DO_OR_GOTO_ERR(check_super_user()); + DO_OR_GOTO_ERR(setup_all_buffers()); + DO_OR_GOTO_ERR(for_all_cpus(set_temperature_target, EVEN_COUNTERS)); ts.tv_sec = interval_sec; ts.tv_nsec = 0;