8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 04:03:04 +01:00

[s|g]etConfigFile renamed [s|g]setConfigFilePath. Clearer, since we have a class named ConfigFile but the function only returns a string with the path, not an object.

This commit is contained in:
robocop 2005-12-25 03:59:49 +00:00
parent 07905b801a
commit 03a066dcb9
5 changed files with 11 additions and 9 deletions

View File

@ -139,20 +139,22 @@ static Firebird::Mutex config_init_lock;
const ConfigImpl& ConfigImpl::instance() const ConfigImpl& ConfigImpl::instance()
{ {
if (!sys_config) { if (!sys_config)
{
#ifdef MULTI_THREAD #ifdef MULTI_THREAD
try { try {
config_init_lock.enter(); config_init_lock.enter();
if (!sys_config) { if (!sys_config) {
#endif
sys_config = FB_NEW(*getDefaultMemoryPool()) ConfigImpl(*getDefaultMemoryPool()); sys_config = FB_NEW(*getDefaultMemoryPool()) ConfigImpl(*getDefaultMemoryPool());
#ifdef MULTI_THREAD
} }
} catch(const std::exception&) { } catch(const std::exception&) {
config_init_lock.leave(); config_init_lock.leave();
throw; throw;
} }
config_init_lock.leave(); config_init_lock.leave();
#else
sys_config = FB_NEW(*getDefaultMemoryPool()) ConfigImpl(*getDefaultMemoryPool());
#endif #endif
} }
return *sys_config; return *sys_config;
@ -175,7 +177,7 @@ ConfigImpl::ConfigImpl(MemoryPool& p) : ConfigRoot(p)
values = FB_NEW(p) ConfigValue[size]; values = FB_NEW(p) ConfigValue[size];
string val_sep = ","; string val_sep = ",";
file.setConfigFile(getConfigFile()); file.setConfigFilePath(getConfigFilePath());
/* Iterate through the known configuration entries */ /* Iterate through the known configuration entries */

View File

@ -68,8 +68,8 @@ public:
fExceptionOnError(ExceptionOnError), parameters(getPool()) {} fExceptionOnError(ExceptionOnError), parameters(getPool()) {}
// configuration file management // configuration file management
const string getConfigFile() { return configFile; } const string getConfigFilePath() const { return configFile; }
void setConfigFile(const string& newFile) { configFile = newFile; } void setConfigFilePath(const string& newFile) { configFile = newFile; }
bool isLoaded() const { return isLoadedFlg; } bool isLoaded() const { return isLoadedFlg; }

View File

@ -63,7 +63,7 @@ void Configuration::loadConfigFile(void)
configFile = new ConfigFile (0); configFile = new ConfigFile (0);
} }
void Configuration::setConfigFile(const char* filename) void Configuration::setConfigFilePath(const char* filename)
{ {
if (!configFile) if (!configFile)
configFile = new ConfigFile (filename, 0); configFile = new ConfigFile (filename, 0);

View File

@ -41,7 +41,7 @@ public:
static ConfObject* findObject(const char* objectType, const char* objectName); static ConfObject* findObject(const char* objectType, const char* objectName);
static const char* getRootDirectory(void); static const char* getRootDirectory(void);
static void loadConfigFile(void); static void loadConfigFile(void);
static void setConfigFile (const char* filename); static void setConfigFilePath(const char* filename);
static ConfObject* getObject(const char* objectType); static ConfObject* getObject(const char* objectType);
static ConfObject* getObject(const char* objectType, const char* objectName); static ConfObject* getObject(const char* objectType, const char* objectName);
}; };

View File

@ -36,7 +36,7 @@ bool ResolveDatabaseAlias(const string& alias, string& database)
string alias_filename; string alias_filename;
Firebird::Prefix(alias_filename, ALIAS_FILE); Firebird::Prefix(alias_filename, ALIAS_FILE);
ConfigFile aliasConfig(false); ConfigFile aliasConfig(false);
aliasConfig.setConfigFile(alias_filename); aliasConfig.setConfigFilePath(alias_filename);
const char correct_dir_sep = PathUtils::dir_sep; const char correct_dir_sep = PathUtils::dir_sep;
const char incorrect_dir_sep = (correct_dir_sep == '/') ? '\\' : '/'; const char incorrect_dir_sep = (correct_dir_sep == '/') ? '\\' : '/';