fix for argp usage

This commit is contained in:
john30
2017-01-08 16:38:30 +01:00
parent d3b584257a
commit 8e7edc6d1e
2 changed files with 8 additions and 5 deletions
+4 -4
View File
@@ -31,7 +31,7 @@ using namespace std;
static const struct argp_child g_last_argp_child = {NULL, 0, NULL, 0}; static const struct argp_child g_last_argp_child = {NULL, 0, NULL, 0};
/** the list of @a argp_child structures. */ /** the list of @a argp_child structures. */
static const struct argp_child* g_argp_children[ static struct argp_child g_argp_children[
#ifdef HAVE_MQTT #ifdef HAVE_MQTT
1 1
#endif #endif
@@ -42,11 +42,11 @@ const struct argp_child* datahandler_getargs()
{ {
size_t count = 0; size_t count = 0;
#ifdef HAVE_MQTT #ifdef HAVE_MQTT
g_argp_children[count++] = mqtthandler_getargs(); g_argp_children[count++] = *mqtthandler_getargs();
#endif #endif
if (count>0) { if (count>0) {
g_argp_children[count] = &g_last_argp_child; g_argp_children[count] = g_last_argp_child;
return g_argp_children[0]; return g_argp_children;
} }
return NULL; return NULL;
} }
+4 -1
View File
@@ -69,7 +69,7 @@ static error_t mqtt_parse_opt(int key, char *arg, struct argp_state *state)
return 0; return 0;
} }
static struct argp g_mqtt_argp = { g_mqtt_argp_options, mqtt_parse_opt, NULL, NULL, NULL, NULL, NULL }; static const struct argp g_mqtt_argp = { g_mqtt_argp_options, mqtt_parse_opt, NULL, NULL, NULL, NULL, NULL };
static const struct argp_child g_mqtt_argp_child = {&g_mqtt_argp, 0, "", 1}; static const struct argp_child g_mqtt_argp_child = {&g_mqtt_argp, 0, "", 1};
const struct argp_child* mqtthandler_getargs() const struct argp_child* mqtthandler_getargs()
@@ -151,6 +151,9 @@ MqttHandler::MqttHandler(BusHandler* busHandler, MessageMap* messages)
logOtherError("mqtt", "malformed topic %s", g_topic); logOtherError("mqtt", "malformed topic %s", g_topic);
return; return;
} }
if (!enabled) {
return;
}
if (m_topicCols.empty()) { if (m_topicCols.empty()) {
if (m_topicStrs.empty()) { if (m_topicStrs.empty()) {
m_topicStrs.push_back(""); m_topicStrs.push_back("");