From e0412ccd89b602b41641d79615169cd57635c8bc Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Thu, 6 Feb 2014 14:09:31 +0100 Subject: wpa: rename _COUNT to _CNT We use _CNT all the time, so be consistent and rename the max-values. Signed-off-by: David Herrmann --- src/libwfd.h | 5 +++-- src/wpa_parser.c | 2 +- test/test_wpa.c | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/libwfd.h b/src/libwfd.h index c06475f..6ff9d45 100644 --- a/src/libwfd.h +++ b/src/libwfd.h @@ -575,7 +575,7 @@ enum wfd_wpa_event_type { WFD_WPA_EVENT_P2P_SERV_DISC_RESP, WFD_WPA_EVENT_P2P_INVITATION_RECEIVED, WFD_WPA_EVENT_P2P_INVITATION_RESULT, - WFD_WPA_EVENT_COUNT, + WFD_WPA_EVENT_CNT, }; enum wfd_wpa_event_priority { @@ -584,12 +584,13 @@ enum wfd_wpa_event_priority { WFD_WPA_EVENT_P_INFO, WFD_WPA_EVENT_P_WARNING, WFD_WPA_EVENT_P_ERROR, - WFD_WPA_EVENT_P_COUNT + WFD_WPA_EVENT_P_CNT }; enum wfd_wpa_event_role { WFD_WPA_EVENT_ROLE_GO, WFD_WPA_EVENT_ROLE_CLIENT, + WFD_WPA_EVENT_ROLE_CNT, }; #define WFD_WPA_EVENT_MAC_STRLEN 18 diff --git a/src/wpa_parser.c b/src/wpa_parser.c index 9f98b5d..7fe5d83 100644 --- a/src/wpa_parser.c +++ b/src/wpa_parser.c @@ -474,7 +474,7 @@ int wfd_wpa_event_parse(struct wfd_wpa_event *ev, const char *event) ++t; ev->priority = strtoul(event + 1, &end, 10); - if (ev->priority >= WFD_WPA_EVENT_P_COUNT || + if (ev->priority >= WFD_WPA_EVENT_P_CNT || end + 1 != t || event[1] == '+' || event[1] == '-') diff --git a/test/test_wpa.c b/test/test_wpa.c index 7198ed7..6e8a499 100644 --- a/test/test_wpa.c +++ b/test/test_wpa.c @@ -32,7 +32,7 @@ static void parse(struct wfd_wpa_event *ev, const char *event) wfd_wpa_event_init(ev); r = wfd_wpa_event_parse(ev, event); ck_assert_msg(!r, "cannot parse event %s", event); - ck_assert(ev->priority < WFD_WPA_EVENT_P_COUNT); + ck_assert(ev->priority < WFD_WPA_EVENT_P_CNT); } static const char *event_list[] = { @@ -57,7 +57,7 @@ static const char *event_list[] = { [WFD_WPA_EVENT_P2P_SERV_DISC_RESP] = "P2P-SERV-DISC-RESP", [WFD_WPA_EVENT_P2P_INVITATION_RECEIVED] = "P2P-INVITATION-RECEIVED", [WFD_WPA_EVENT_P2P_INVITATION_RESULT] = "P2P-INVITATION-RESULT", - [WFD_WPA_EVENT_COUNT] = NULL + [WFD_WPA_EVENT_CNT] = NULL }; START_TEST(test_wpa_parser) @@ -71,7 +71,7 @@ START_TEST(test_wpa_parser) parse(&ev, "asdf"); ck_assert(ev.type == WFD_WPA_EVENT_UNKNOWN); - for (i = 0; i < WFD_WPA_EVENT_COUNT; ++i) { + for (i = 0; i < WFD_WPA_EVENT_CNT; ++i) { ck_assert_msg(event_list[i] != NULL, "event %d missing", i); parse(&ev, event_list[i]); ck_assert_msg(ev.type == i, "event %d invalid", i); -- cgit v1.2.3