From 5bb956fb21656a273b9c1d325c382378c66d5515 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 30 Nov 2018 17:00:02 -0500 Subject: [PATCH] lib: remove BT_NOTIFICATION_TYPE_{UNKNOWN,NR} `BT_NOTIFICATION_TYPE_UNKNOWN` is not needed because we never return it. `BT_NOTIFICATION_TYPE_NR` is an implementation detail, so we use the last value instead. Signed-off-by: Philippe Proulx --- include/babeltrace/graph/notification-internal.h | 2 -- include/babeltrace/graph/notification.h | 2 -- lib/graph/notification/notification.c | 3 ++- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/babeltrace/graph/notification-internal.h b/include/babeltrace/graph/notification-internal.h index 662ffdee..33debfd0 100644 --- a/include/babeltrace/graph/notification-internal.h +++ b/include/babeltrace/graph/notification-internal.h @@ -115,8 +115,6 @@ static inline const char *bt_notification_type_string(enum bt_notification_type type) { switch (type) { - case BT_NOTIFICATION_TYPE_UNKNOWN: - return "BT_NOTIFICATION_TYPE_UNKNOWN"; case BT_NOTIFICATION_TYPE_EVENT: return "BT_NOTIFICATION_TYPE_EVENT"; case BT_NOTIFICATION_TYPE_INACTIVITY: diff --git a/include/babeltrace/graph/notification.h b/include/babeltrace/graph/notification.h index ba3d2357..658fe0e8 100644 --- a/include/babeltrace/graph/notification.h +++ b/include/babeltrace/graph/notification.h @@ -37,14 +37,12 @@ typedef struct bt_notification **bt_notification_array; * Notification types. Unhandled notification types should be ignored. */ enum bt_notification_type { - BT_NOTIFICATION_TYPE_UNKNOWN = -1, BT_NOTIFICATION_TYPE_EVENT = 0, BT_NOTIFICATION_TYPE_INACTIVITY = 1, BT_NOTIFICATION_TYPE_STREAM_BEGIN = 2, BT_NOTIFICATION_TYPE_STREAM_END = 3, BT_NOTIFICATION_TYPE_PACKET_BEGIN = 4, BT_NOTIFICATION_TYPE_PACKET_END = 5, - BT_NOTIFICATION_TYPE_NR, /* Not part of ABI. */ }; /** diff --git a/lib/graph/notification/notification.c b/lib/graph/notification/notification.c index 2b8c12d7..5a835092 100644 --- a/lib/graph/notification/notification.c +++ b/lib/graph/notification/notification.c @@ -49,7 +49,8 @@ void bt_notification_init(struct bt_notification *notification, bt_object_release_func release, struct bt_graph *graph) { - BT_ASSERT(type >= 0 && type < BT_NOTIFICATION_TYPE_NR); + BT_ASSERT(type >= 0 && + type <= BT_NOTIFICATION_TYPE_PACKET_END); notification->type = type; init_seq_num(notification); bt_object_init_shared(¬ification->base, release); -- 2.34.1