EDS contacts: better check SYNCEVOLUTION_EDS_ACCESS_MODE in constructor

That way we can initialize m_accessMode immediately in the constructor,
which keeps cppcheck happy and avoids uninitalized data in the instance
between creation and open(), which is better than before.
This commit is contained in:
Patrick Ohly 2014-01-07 01:17:27 -08:00
parent e407d71410
commit ba7e3543f0

View file

@ -79,6 +79,10 @@ EvolutionContactSource::EvolutionContactSource(const SyncSourceParams &params,
m_contactsFromDB =
m_contactQueries = 0;
m_readAheadOrder = READ_NONE;
const char *mode = getEnv("SYNCEVOLUTION_EDS_ACCESS_MODE", "");
m_accessMode = boost::iequals(mode, "synchronous") ? SYNCHRONOUS :
boost::iequals(mode, "batched") ? BATCHED :
DEFAULT;
#endif
SyncSourceLogging::init(InitList<std::string>("N_FIRST") + "N_MIDDLE" + "N_LAST",
" ",
@ -191,10 +195,6 @@ void EvolutionContactSource::open()
m_addressbook.reset(E_BOOK_CLIENT(openESource(E_SOURCE_EXTENSION_ADDRESS_BOOK,
e_source_registry_ref_builtin_address_book,
newEBookClient).get()));
const char *mode = getEnv("SYNCEVOLUTION_EDS_ACCESS_MODE", "");
m_accessMode = boost::iequals(mode, "synchronous") ? SYNCHRONOUS :
boost::iequals(mode, "batched") ? BATCHED :
DEFAULT;
#else
GErrorCXX gerror;
bool created = false;