mqtt: Use LWIP_ARRAYSIZE to replace hardcoded value

Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
Axel Lin 2016-12-20 17:18:39 +08:00 committed by Dirk Ziegelmeier
parent b6a131edfb
commit 02f4610b1c

View File

@ -169,7 +169,7 @@ static const char * const mqtt_message_type_str[15] =
static const char * static const char *
mqtt_msg_type_to_str(u8_t msg_type) mqtt_msg_type_to_str(u8_t msg_type)
{ {
if(msg_type > 14) { if(msg_type >= LWIP_ARRAYSIZE(mqtt_message_type_str)) {
msg_type = 0; msg_type = 0;
} }
return mqtt_message_type_str[msg_type]; return mqtt_message_type_str[msg_type];