cleanup clang-y static analysis

Some performance improvements.  eg. pass by ref.

Some paranoia pre-initialization of variables
which will be initialized later by indirection.

And some misc. cleanup.
This commit is contained in:
Michael Davidsaver
2023-06-12 19:55:03 -07:00
parent 51bd6a3d6c
commit b95b57945b
16 changed files with 19 additions and 23 deletions
+3 -2
View File
@@ -136,7 +136,7 @@ namespace {
void evlog_handler(int severity, const char *msg)
{
const char *sevr = "<\?\?\?>";
Level lvl = Level::Crit;
Level lvl;
switch(severity) {
#define CASE(EVLVL, PLVL) case EVENT_LOG_##EVLVL : lvl = Level::PLVL; sevr = #PLVL; break
CASE(DEBUG, Debug);
@@ -144,6 +144,7 @@ void evlog_handler(int severity, const char *msg)
CASE(WARN, Warn);
CASE(ERR, Err);
#undef CASE
default: lvl = Level::Crit; break;
}
if(logerr.test(lvl))
errlogPrintf("libevent %s: %s\n", sevr, msg);
@@ -289,7 +290,7 @@ void xerrlogHexPrintf(const void *buf, size_t buflen)
// printed line (4 groups of 4 bytes)
// addr : AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
char buf[4][9] = {"","","",""};
const unsigned addr = unsigned(pos);
const auto addr = unsigned(pos);
for(unsigned grp=0; grp<4 && pos<buflen ; grp++)
{