Clang Format

This commit is contained in:
Mike Brady
2022-03-14 11:56:43 +11:00
parent 424c376b86
commit a382ac6672
10 changed files with 121 additions and 92 deletions
+3 -3
View File
@@ -96,17 +96,17 @@ void on_connect(struct mosquitto *mosq, __attribute__((unused)) void *userdata,
void mqtt_publish(char *topic, char *data_in, uint32_t length_in) {
char *data = data_in;
uint32_t length = length_in;
if ((length == 0) && (config.mqtt_empty_payload_substitute != NULL)) {
length = strlen(config.mqtt_empty_payload_substitute);
data = config.mqtt_empty_payload_substitute;
}
char fulltopic[strlen(config.mqtt_topic) + strlen(topic) + 3];
snprintf(fulltopic, strlen(config.mqtt_topic) + strlen(topic) + 2, "%s/%s", config.mqtt_topic,
topic);
debug(2, "[MQTT]: publishing under %s", fulltopic);
int rc;
if ((rc = mosquitto_publish(global_mosq, NULL, fulltopic, length, data, 0, 0)) !=
MOSQ_ERR_SUCCESS) {