lib: standardize status of bt_util_clock_cycles_to_ns_from_origin()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 14 Aug 2019 19:02:50 +0000 (15:02 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 15 Aug 2019 15:41:44 +0000 (11:41 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ibfe6f7e345f838503b94140e30ec7a7b35866595
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1931
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
include/babeltrace2/util.h
src/lib/util.c

index 8d9585c3288b07a03c6aee6187eb3d518e28240f..d4826541f4f7734d05f2921764745b74a9190d8b 100644 (file)
 extern "C" {
 #endif
 
-typedef enum bt_util_status {
-       BT_UTIL_STATUS_OK = 0,
-       BT_UTIL_STATUS_OVERFLOW_ERROR = -75,
-} bt_util_status;
+typedef enum bt_util_clock_cycles_to_ns_from_origin_status {
+       BT_UTIL_CLOCK_CYCLES_TO_NS_FROM_ORIGIN_STATUS_OK                = __BT_FUNC_STATUS_OK,
+       BT_UTIL_CLOCK_CYCLES_TO_NS_FROM_ORIGIN_STATUS_OVERFLOW_ERROR    = __BT_FUNC_STATUS_OVERFLOW_ERROR,
+} bt_util_clock_cycles_to_ns_from_origin_status;
 
-bt_util_status bt_util_clock_cycles_to_ns_from_origin(uint64_t cycles,
+bt_util_clock_cycles_to_ns_from_origin_status
+bt_util_clock_cycles_to_ns_from_origin(uint64_t cycles,
                uint64_t frequency, int64_t offset_seconds,
                uint64_t offset_cycles, int64_t *ns);
 
index d6b90537af06f51d8bd983c5e323f275045524a9..3ba4c47611862ed9a7edcfab991788d51bda14c1 100644 (file)
 #include <babeltrace2/babeltrace.h>
 #include "lib/trace-ir/utils.h"
 
-bt_util_status bt_util_clock_cycles_to_ns_from_origin(uint64_t cycles,
+bt_util_clock_cycles_to_ns_from_origin_status
+bt_util_clock_cycles_to_ns_from_origin(uint64_t cycles,
                uint64_t frequency, int64_t offset_seconds,
                uint64_t offset_cycles, int64_t *ns)
 {
        bool overflows;
        int64_t base_offset_ns;
-       bt_util_status status = BT_UTIL_STATUS_OK;
+       bt_util_clock_cycles_to_ns_from_origin_status status =
+               BT_FUNC_STATUS_OK;
        int ret;
 
        BT_ASSERT_PRE_NON_NULL(ns, "Nanoseconds (output)");
@@ -51,7 +53,7 @@ bt_util_status bt_util_clock_cycles_to_ns_from_origin(uint64_t cycles,
        overflows = bt_util_get_base_offset_ns(offset_seconds, offset_cycles,
                frequency, &base_offset_ns);
        if (overflows) {
-               status = BT_UTIL_STATUS_OVERFLOW_ERROR;
+               status = BT_FUNC_STATUS_OVERFLOW_ERROR;
                goto end;
        }
 
@@ -59,7 +61,7 @@ bt_util_status bt_util_clock_cycles_to_ns_from_origin(uint64_t cycles,
                offset_seconds, offset_cycles,
                frequency, cycles, ns);
        if (ret) {
-               status = BT_UTIL_STATUS_OVERFLOW_ERROR;
+               status = BT_FUNC_STATUS_OVERFLOW_ERROR;
        }
 
 end:
This page took 0.025849 seconds and 4 git commands to generate.