Commit aea6e2d1 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[master] Assign rcode

Strictly, this is done to silence clang-analyzer. In every case,
parseAnswer() does set rcode (which is passed by reference) unless it
throws.  It looks like clang-analyzer gets confused by the exception
paths.

In any case, it's good to initialize it to the unexpected case and not
depend on parseAnswer().
parent e15c8882
......@@ -456,7 +456,7 @@ ModuleCCSession::ModuleCCSession(
ConstElementPtr answer, env;
session_.group_recvmsg(env, answer, false, seq);
int rcode;
int rcode = -1;
ConstElementPtr err = parseAnswer(rcode, answer);
if (rcode != 0) {
LOG_ERROR(config_logger, CONFIG_MOD_SPEC_REJECT).arg(answer->str());
......@@ -535,7 +535,7 @@ ModuleCCSession::handleConfigUpdate(ConstElementPtr new_config) {
ConstElementPtr diff = removeIdentical(new_config, getLocalConfig());
// handle config update
answer = config_handler_(diff);
int rcode;
int rcode = -1;
parseAnswer(rcode, answer);
if (rcode == 0) {
ElementPtr local_config = getLocalConfig();
......@@ -652,7 +652,7 @@ ModuleCCSession::fetchRemoteSpec(const std::string& module, bool is_filename) {
unsigned int seq = session_.group_sendmsg(cmd, "ConfigManager");
ConstElementPtr env, answer;
session_.group_recvmsg(env, answer, false, seq);
int rcode;
int rcode = -1;
ConstElementPtr spec_data = parseAnswer(rcode, answer);
if (rcode == 0 && spec_data) {
// received OK, construct the spec out of it
......@@ -689,7 +689,7 @@ ModuleCCSession::addRemoteConfig(const std::string& spec_name,
ConstElementPtr env, answer;
session_.group_recvmsg(env, answer, false, seq);
int rcode;
int rcode = -1;
ConstElementPtr new_config = parseAnswer(rcode, answer);
ElementPtr local_config;
if (rcode == 0 && new_config) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment