Cleanup: lift function call outside of condition
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 22 Feb 2016 20:18:02 +0000 (15:18 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 22 Feb 2016 20:18:02 +0000 (15:18 -0500)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/clock.c

index 253b033da398f50ebada3c851c08ef5a2e369959..9256bc1f26f58ef5cb4f04a8ca9a92d32dc364e7 100644 (file)
@@ -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;
 }
This page took 0.027443 seconds and 4 git commands to generate.