* SOFTWARE.
*/
+#define BT_LOG_TAG "PLUGIN-UTILS-TRIMMER-FLT"
+#include "logging.h"
+
+#include <babeltrace/compat/utc-internal.h>
#include <babeltrace/plugin/plugin-dev.h>
#include <babeltrace/graph/component.h>
#include <babeltrace/graph/private-component.h>
static
struct trimmer *create_trimmer_data(void)
{
- struct trimmer *trimmer;
-
- trimmer = g_new0(struct trimmer, 1);
- if (!trimmer) {
- goto end;
- }
-end:
- return trimmer;
+ return g_new0(struct trimmer, 1);
}
void finalize_trimmer(struct bt_private_component *component)
time_t result;
if (gmt) {
- result = timegm(&tm);
+ result = bt_timegm(&tm);
if (result < 0) {
return -1;
}
time_t result;
if (gmt) {
- result = timegm(&tm);
+ result = bt_timegm(&tm);
if (result < 0) {
return -1;
}
};
if (gmt) {
- value = timegm(&tm);
+ value = bt_timegm(&tm);
if (value < 0) {
return -1;
}
time_t result;
if (gmt) {
- result = timegm(&tm);
+ result = bt_timegm(&tm);
if (result < 0) {
return -1;
}
value_ret = bt_value_bool_get(value, &gmt);
if (value_ret) {
ret = BT_COMPONENT_STATUS_INVALID;
- printf_error("Failed to retrieve clock-gmt value. Expecting a boolean");
+ BT_LOGE_STR("Failed to retrieve clock-gmt value. Expecting a boolean");
}
}
bt_put(value);
if (value_ret || timestamp_from_arg(str,
trimmer, &trimmer->begin, gmt)) {
ret = BT_COMPONENT_STATUS_INVALID;
- printf_error("Failed to retrieve begin value. Expecting a timestamp string");
+ BT_LOGE_STR("Failed to retrieve begin value. Expecting a timestamp string");
}
}
bt_put(value);
if (value_ret || timestamp_from_arg(str,
trimmer, &trimmer->end, gmt)) {
ret = BT_COMPONENT_STATUS_INVALID;
- printf_error("Failed to retrieve end value. Expecting a timestamp string");
+ BT_LOGE_STR("Failed to retrieve end value. Expecting a timestamp string");
}
}
bt_put(value);
end:
if (trimmer->begin.set && trimmer->end.set) {
if (trimmer->begin.value > trimmer->end.value) {
- printf_error("Unexpected: time range begin value is above end value");
+ BT_LOGE_STR("Unexpected: time range begin value is above end value");
ret = BT_COMPONENT_STATUS_INVALID;
}
}
{
enum bt_component_status ret;
struct trimmer *trimmer = create_trimmer_data();
- struct bt_private_port *priv_port = NULL;
if (!trimmer) {
ret = BT_COMPONENT_STATUS_NOMEM;
}
/* Create input and output ports */
- priv_port = bt_private_component_filter_add_input_private_port(
- component, "in", NULL);
- if (!priv_port) {
+ ret = bt_private_component_filter_add_input_private_port(
+ component, "in", NULL, NULL);
+ if (ret != BT_COMPONENT_STATUS_OK) {
goto error;
}
- bt_put(priv_port);
- priv_port = bt_private_component_filter_add_output_private_port(
- component, "out", NULL);
- if (!priv_port) {
+ ret = bt_private_component_filter_add_output_private_port(
+ component, "out", NULL, NULL);
+ if (ret != BT_COMPONENT_STATUS_OK) {
goto error;
}
ret = init_from_params(trimmer, params);
end:
- bt_put(priv_port);
return ret;
error:
destroy_trimmer_data(trimmer);