Remove obsolete locks in Livestatus; apply style guide to DB IDO

This commit is contained in:
Michael Friedrich 2017-12-21 15:45:11 +01:00
parent 403ab5c357
commit 50106057bf
5 changed files with 17 additions and 93 deletions

View File

@ -51,11 +51,10 @@ Dictionary::Ptr HostDbObject::GetConfigFields() const
/* Compatibility fallback. */
String displayName = host->GetDisplayName();
if (!displayName.IsEmpty()) {
if (!displayName.IsEmpty())
fields->Set("alias", displayName);
} else {
else
fields->Set("alias", host->GetName());
}
fields->Set("display_name", displayName);
fields->Set("address", host->GetAddress());

View File

@ -99,12 +99,7 @@ Value CommandsTable::CustomVariableNamesAccessor(const Value& row)
if (!command)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(command);
vars = command->GetVars();
}
Dictionary::Ptr vars = command->GetVars();
Array::Ptr cv = new Array();
@ -128,12 +123,7 @@ Value CommandsTable::CustomVariableValuesAccessor(const Value& row)
if (!command)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(command);
vars = command->GetVars();
}
Dictionary::Ptr vars = command->GetVars();
Array::Ptr cv = new Array();
@ -157,12 +147,7 @@ Value CommandsTable::CustomVariablesAccessor(const Value& row)
if (!command)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(command);
vars = command->GetVars();
}
Dictionary::Ptr vars = command->GetVars();
Array::Ptr cv = new Array();

View File

@ -203,12 +203,7 @@ Value ContactsTable::CustomVariableNamesAccessor(const Value& row)
if (!user)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(user);
vars = user->GetVars();
}
Dictionary::Ptr vars = user->GetVars();
Array::Ptr cv = new Array();
@ -230,12 +225,7 @@ Value ContactsTable::CustomVariableValuesAccessor(const Value& row)
if (!user)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(user);
vars = user->GetVars();
}
Dictionary::Ptr vars = user->GetVars();
Array::Ptr cv = new Array();
@ -260,12 +250,7 @@ Value ContactsTable::CustomVariablesAccessor(const Value& row)
if (!user)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(user);
vars = user->GetVars();
}
Dictionary::Ptr vars = user->GetVars();
Array::Ptr cv = new Array();
@ -295,12 +280,7 @@ Value ContactsTable::CVIsJsonAccessor(const Value& row)
if (!user)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(user);
vars = user->GetVars();
}
Dictionary::Ptr vars = user->GetVars();
if (!vars)
return Empty;

View File

@ -1036,12 +1036,7 @@ Value HostsTable::CustomVariableNamesAccessor(const Value& row)
if (!host)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(host);
vars = host->GetVars();
}
Dictionary::Ptr vars = host->GetVars();
Array::Ptr cv = new Array();
@ -1063,12 +1058,7 @@ Value HostsTable::CustomVariableValuesAccessor(const Value& row)
if (!host)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(host);
vars = host->GetVars();
}
Dictionary::Ptr vars = host->GetVars();
Array::Ptr cv = new Array();
@ -1093,12 +1083,7 @@ Value HostsTable::CustomVariablesAccessor(const Value& row)
if (!host)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(host);
vars = host->GetVars();
}
Dictionary::Ptr vars = host->GetVars();
Array::Ptr cv = new Array();
@ -1128,12 +1113,7 @@ Value HostsTable::CVIsJsonAccessor(const Value& row)
if (!host)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(host);
vars = host->GetVars();
}
Dictionary::Ptr vars = host->GetVars();
if (!vars)
return Empty;

View File

@ -1058,12 +1058,7 @@ Value ServicesTable::CustomVariableNamesAccessor(const Value& row)
if (!service)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(service);
vars = service->GetVars();
}
Dictionary::Ptr vars = service->GetVars();
Array::Ptr cv = new Array();
@ -1085,12 +1080,7 @@ Value ServicesTable::CustomVariableValuesAccessor(const Value& row)
if (!service)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(service);
vars = service->GetVars();
}
Dictionary::Ptr vars = service->GetVars();
Array::Ptr cv = new Array();
@ -1115,12 +1105,7 @@ Value ServicesTable::CustomVariablesAccessor(const Value& row)
if (!service)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(service);
vars = service->GetVars();
}
Dictionary::Ptr vars = service->GetVars();
Array::Ptr cv = new Array();
@ -1150,12 +1135,7 @@ Value ServicesTable::CVIsJsonAccessor(const Value& row)
if (!service)
return Empty;
Dictionary::Ptr vars;
{
ObjectLock olock(service);
vars = service->GetVars();
}
Dictionary::Ptr vars = service->GetVars();
if (!vars)
return Empty;