From: Jérémie Galarneau Date: Mon, 22 Feb 2016 20:18:02 +0000 (-0500) Subject: Cleanup: lift function call outside of condition X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=49e545f5e9872f7698bae46553c0274efe49420e;p=deliverable%2Fbabeltrace.git Cleanup: lift function call outside of condition Signed-off-by: Jérémie Galarneau --- diff --git a/formats/ctf/ir/clock.c b/formats/ctf/ir/clock.c index 253b033da..9256bc1f2 100644 --- a/formats/ctf/ir/clock.c +++ b/formats/ctf/ir/clock.c @@ -365,6 +365,7 @@ end: int bt_ctf_clock_set_time(struct bt_ctf_clock *clock, int64_t time) { int ret = 0; + int64_t value; /* Timestamps are strictly monotonic */ if (!clock) { @@ -384,13 +385,13 @@ int bt_ctf_clock_set_time(struct bt_ctf_clock *clock, int64_t time) /* Common case where cycles are actually nanoseconds */ if (clock->frequency == 1000000000) { - clock->value = time; - goto end; + value = time; + } else { + value = (uint64_t) (((double) time * + (double) clock->frequency) / 1e9); } - ret = bt_ctf_clock_set_value(clock, - (uint64_t) (((double) time * (double) clock->frequency) / 1e9)); - + ret = bt_ctf_clock_set_value(clock, value); end: return ret; }