From: Philippe Proulx Date: Sat, 15 Jun 2019 06:29:58 +0000 (-0400) Subject: Move bt_{self_component,message_iterator}_status_string() to `common.h` X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=de625d1c106f5c13b37fcbdb8304cbba3c147542 Move bt_{self_component,message_iterator}_status_string() to `common.h` Now `muxer.c` does not include internal library headers. Signed-off-by: Philippe Proulx Change-Id: I33a9cf2db3df6a8d06d385f352280d90a922c4d9 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1465 Tested-by: jenkins Reviewed-by: Francis Deslauriers --- diff --git a/src/common/common.h b/src/common/common.h index 8ac99535..31448a45 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include #include @@ -590,6 +592,48 @@ const char *bt_common_logging_level_string( } }; +static inline +const char *bt_self_component_status_string( + enum bt_self_component_status status) +{ + switch (status) { + case BT_SELF_COMPONENT_STATUS_OK: + return "BT_SELF_COMPONENT_STATUS_OK"; + case BT_SELF_COMPONENT_STATUS_END: + return "BT_SELF_COMPONENT_STATUS_END"; + case BT_SELF_COMPONENT_STATUS_AGAIN: + return "BT_SELF_COMPONENT_STATUS_AGAIN"; + case BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION: + return "BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION"; + case BT_SELF_COMPONENT_STATUS_ERROR: + return "BT_SELF_COMPONENT_STATUS_ERROR"; + case BT_SELF_COMPONENT_STATUS_NOMEM: + return "BT_SELF_COMPONENT_STATUS_NOMEM"; + default: + return "(unknown)"; + } +} + +static inline +const char *bt_message_iterator_status_string( + enum bt_message_iterator_status status) +{ + switch (status) { + case BT_MESSAGE_ITERATOR_STATUS_AGAIN: + return "BT_MESSAGE_ITERATOR_STATUS_AGAIN"; + case BT_MESSAGE_ITERATOR_STATUS_END: + return "BT_MESSAGE_ITERATOR_STATUS_END"; + case BT_MESSAGE_ITERATOR_STATUS_OK: + return "BT_MESSAGE_ITERATOR_STATUS_OK"; + case BT_MESSAGE_ITERATOR_STATUS_ERROR: + return "BT_MESSAGE_ITERATOR_STATUS_ERROR"; + case BT_MESSAGE_ITERATOR_STATUS_NOMEM: + return "BT_MESSAGE_ITERATOR_STATUS_NOMEM"; + default: + return "(unknown)"; + } +} + #define NS_PER_S_I INT64_C(1000000000) #define NS_PER_S_U UINT64_C(1000000000) diff --git a/src/lib/graph/component.h b/src/lib/graph/component.h index 2155d5da..accd5d1f 100644 --- a/src/lib/graph/component.h +++ b/src/lib/graph/component.h @@ -141,26 +141,4 @@ BT_HIDDEN void bt_component_remove_destroy_listener(struct bt_component *component, bt_component_destroy_listener_func func, void *data); -static inline -const char *bt_self_component_status_string( - enum bt_self_component_status status) -{ - switch (status) { - case BT_SELF_COMPONENT_STATUS_OK: - return "BT_SELF_COMPONENT_STATUS_OK"; - case BT_SELF_COMPONENT_STATUS_END: - return "BT_SELF_COMPONENT_STATUS_END"; - case BT_SELF_COMPONENT_STATUS_AGAIN: - return "BT_SELF_COMPONENT_STATUS_AGAIN"; - case BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION: - return "BT_SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION"; - case BT_SELF_COMPONENT_STATUS_ERROR: - return "BT_SELF_COMPONENT_STATUS_ERROR"; - case BT_SELF_COMPONENT_STATUS_NOMEM: - return "BT_SELF_COMPONENT_STATUS_NOMEM"; - default: - return "(unknown)"; - } -} - #endif /* BABELTRACE_GRAPH_COMPONENT_INTERNAL_H */ diff --git a/src/lib/graph/graph.h b/src/lib/graph/graph.h index e108d508..d2ce47ad 100644 --- a/src/lib/graph/graph.h +++ b/src/lib/graph/graph.h @@ -30,6 +30,7 @@ #include "lib/object.h" #include "lib/object-pool.h" #include "common/assert.h" +#include "common/common.h" #include #include diff --git a/src/lib/graph/message/iterator.h b/src/lib/graph/message/iterator.h index 475abf55..2c442a15 100644 --- a/src/lib/graph/message/iterator.h +++ b/src/lib/graph/message/iterator.h @@ -137,26 +137,6 @@ void bt_self_component_port_input_message_iterator_set_connection( struct bt_self_component_port_input_message_iterator *iterator, struct bt_connection *connection); -static inline -const char *bt_message_iterator_status_string( - enum bt_message_iterator_status status) -{ - switch (status) { - case BT_MESSAGE_ITERATOR_STATUS_AGAIN: - return "BT_MESSAGE_ITERATOR_STATUS_AGAIN"; - case BT_MESSAGE_ITERATOR_STATUS_END: - return "BT_MESSAGE_ITERATOR_STATUS_END"; - case BT_MESSAGE_ITERATOR_STATUS_OK: - return "BT_MESSAGE_ITERATOR_STATUS_OK"; - case BT_MESSAGE_ITERATOR_STATUS_ERROR: - return "BT_MESSAGE_ITERATOR_STATUS_ERROR"; - case BT_MESSAGE_ITERATOR_STATUS_NOMEM: - return "BT_MESSAGE_ITERATOR_STATUS_NOMEM"; - default: - return "(unknown)"; - } -}; - static inline const char *bt_self_component_port_input_message_iterator_state_string( enum bt_self_component_port_input_message_iterator_state state) diff --git a/src/plugins/utils/muxer/muxer.c b/src/plugins/utils/muxer/muxer.c index 9c48a760..90d692f2 100644 --- a/src/plugins/utils/muxer/muxer.c +++ b/src/plugins/utils/muxer/muxer.c @@ -26,10 +26,6 @@ #include "common/macros.h" #include "compat/uuid.h" #include -#include "lib/value.h" -#include "lib/graph/component.h" -#include "lib/graph/message/iterator.h" -#include "lib/graph/connection.h" #include #include #include