From 8c29aa9881dc459e52288817158fb2f4e6ee62b5 Mon Sep 17 00:00:00 2001 From: Xavier Chapron Date: Thu, 11 Jun 2020 12:40:31 +0200 Subject: [PATCH] net: mqtt: Constify utf8 pointer in mqtt_utf8 struct mqtt_utf8 structure is used to store the client_id, user_name, password, topic, will_message. There is no reason for the mqtt code to modify such data, therefore we can constify the utf8 pointer. This would also means that theses client, topic, ... strings can be safely stored in ROM. Signed-off-by: Xavier Chapron --- include/net/mqtt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/mqtt.h b/include/net/mqtt.h index 755c14d3301..26092b539de 100644 --- a/include/net/mqtt.h +++ b/include/net/mqtt.h @@ -150,7 +150,7 @@ enum mqtt_suback_return_code { /** @brief Abstracts UTF-8 encoded strings. */ struct mqtt_utf8 { - uint8_t *utf8; /**< Pointer to UTF-8 string. */ + const uint8_t *utf8; /**< Pointer to UTF-8 string. */ uint32_t size; /**< Size of UTF string, in bytes. */ };