got rid of accesses to global config through getMainConfig()

This commit is contained in:
Jean-Francois Dockes
2011-03-02 13:47:07 +01:00
parent bac0c1eeb9
commit e1a20aa810
31 changed files with 98 additions and 124 deletions
+8 -2
View File
@@ -183,8 +183,12 @@ RclConfig::RclConfig(const string *argcnf)
bool RclConfig::updateMainConfig()
{
m_conf = new ConfStack<ConfTree>("recoll.conf", m_cdirs, true);
if (m_conf == 0 || !m_conf->ok()) {
LOGDEB(("RclConfig::updateMainConfig\n"));
ConfStack<ConfTree> *newconf =
new ConfStack<ConfTree>("recoll.conf", m_cdirs, true);
if (newconf == 0 || !newconf->ok()) {
if (m_conf)
return false;
string where;
stringsToString(m_cdirs, where);
m_reason = string("No/bad main configuration file in: ") + where;
@@ -211,6 +215,8 @@ bool RclConfig::updateMainConfig()
TextSplit::noNumbers();
}
delete m_conf;
m_conf = newconf;
m_skpnstate.init(this, m_conf, "skippedNames");
m_rmtstate.init(this, m_conf, "indexedmimetypes");
return true;
-6
View File
@@ -64,12 +64,6 @@ class RclConfig {
// argcnf
RclConfig(const string *argcnf = 0);
// Main programs must implement this, it avoids having to carry
// the configuration parameter everywhere. Places where several
// RclConfig instances might be needed will take care of
// themselves.
static RclConfig* getMainConfig();
// Return a writable clone of the main config. This belongs to the
// caller (must delete it when done)
ConfNull *cloneMainConfig();