W
woodbrian77
Recently I noticed the last line in an if matched the last
line in an else here:
void
cmwAmbassador::mediateResponse (transactions_t::iterator itr)
{
bool safe_sending = true;
try {
localsendbuf.sock_ = itr->sock;
bool reqResult;
remoteMessages.Receive(cmwBuf, reqResult);
if (reqResult) {
changeDirectory(itr->path.c_str());
::std::vector<File> outputFiles;
remoteMessages.Receive(cmwBuf, outputFiles);
save_lastruntime(itr->filename, itr->time_in_seconds);
safe_sending = false;
localMessages.Marshal(localsendbuf, true);
localsendbuf.Flush();
} else {
::std::string errorMsg;
remoteMessages.Receive(cmwBuf, errorMsg);
safe_sending = false;
localMessages.Marshal(localsendbuf, false, errorMsg);
localsendbuf.Flush();
}
} catch:std::exception const& ex) {
#ifdef SYSLOG_AVAILABLE
syslog(LOG_ERR, "mediateResponse: %s", ex.what());
#endif
if (safe_sending) {
localMessages.Marshal(localsendbuf, false, ex.what());
localsendbuf.Flush();
}
}
}
.... and I factored it out. I felt certain the new version
would be the same size as it is such a simple thing. I was
surprised when the size of the executable decreased by 88
bytes using gcc 4.7.0 20120314. Using gcc 4.8.0 20120429
the size decreased by 56 bytes. I'm using -O3 in both
cases. This isn't some tricky thing and these are some
recent compilers. Shouldn't compilers be able to handle
this?
Shalom,
Brian
Ebenezer Enterprises
http://webEbenezer.net
line in an else here:
void
cmwAmbassador::mediateResponse (transactions_t::iterator itr)
{
bool safe_sending = true;
try {
localsendbuf.sock_ = itr->sock;
bool reqResult;
remoteMessages.Receive(cmwBuf, reqResult);
if (reqResult) {
changeDirectory(itr->path.c_str());
::std::vector<File> outputFiles;
remoteMessages.Receive(cmwBuf, outputFiles);
save_lastruntime(itr->filename, itr->time_in_seconds);
safe_sending = false;
localMessages.Marshal(localsendbuf, true);
localsendbuf.Flush();
} else {
::std::string errorMsg;
remoteMessages.Receive(cmwBuf, errorMsg);
safe_sending = false;
localMessages.Marshal(localsendbuf, false, errorMsg);
localsendbuf.Flush();
}
} catch:std::exception const& ex) {
#ifdef SYSLOG_AVAILABLE
syslog(LOG_ERR, "mediateResponse: %s", ex.what());
#endif
if (safe_sending) {
localMessages.Marshal(localsendbuf, false, ex.what());
localsendbuf.Flush();
}
}
}
.... and I factored it out. I felt certain the new version
would be the same size as it is such a simple thing. I was
surprised when the size of the executable decreased by 88
bytes using gcc 4.7.0 20120314. Using gcc 4.8.0 20120429
the size decreased by 56 bytes. I'm using -O3 in both
cases. This isn't some tricky thing and these are some
recent compilers. Shouldn't compilers be able to handle
this?
Shalom,
Brian
Ebenezer Enterprises
http://webEbenezer.net