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 <xavier.chapron@stimio.fr>
This commit is contained in:
Xavier Chapron 2020-06-11 12:40:31 +02:00 committed by Carles Cufí
commit 8c29aa9881

View file

@ -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. */
};