aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-07-07 18:17:42 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-07-07 18:17:42 +0200
commit0c0e3c4b7cb45313a04e26b3c1c063fbe556c6c5 (patch)
tree21247ecf25cb8e22791b0d195de3cd9272c32f8c
parent984d8e2e70b686ad5f4450805d2f1d6f7c306094 (diff)
Fix: compile error on maybe unitialized variable
Change-Id: Iacc68e23a5d10a092b7c10f18adba4b8306365e9 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--high-can-binding/high.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/high-can-binding/high.cpp b/high-can-binding/high.cpp
index 097ef73..d7314e5 100644
--- a/high-can-binding/high.cpp
+++ b/high-can-binding/high.cpp
@@ -209,11 +209,10 @@ void High::tick(sd_event_source *source, const long &now, void *interv)
jsons[pp.first] = generateJson(pp.first);
}
}
- json_object *j;
+ json_object *j = json_object_new_object();
if(jsons.size() == 1) {
j = jsons[0];
} else if(jsons.size() > 1) {
- j = json_object_new_object();
for(const auto &pp : jsons)
json_object_object_add(j, pp.first.c_str(), pp.second);
}
@@ -296,11 +295,10 @@ void High::treatMessage(json_object *message)
jsons[pp.first] = generateJson(pp.first);
}
}
- json_object *j;
+ json_object *j = json_object_new_object();
if(jsons.size() == 1) {
j = jsons[0];
} else if(jsons.size() > 1) {
- j = json_object_new_object();
for(const auto &pp : jsons)
json_object_object_add(j, pp.first.c_str(), pp.second);
}