MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / loadValues

Method loadValues

src/common/config/config.cpp:230–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230void Config::loadValues(const ConfigFile& file, const char* srcName)
231{
232 unsigned srcIdx = 0;
233
234 // Iterate through the known configuration entries
235
236 for (int i = 0; i < MAX_CONFIG_KEY; i++)
237 {
238 const ConfigEntry& entry = entries[i];
239 const ConfigFile::Parameter* par = file.findParameter(entry.key);
240
241 // Don't assign values to the global keys at non-default config
242 if (par && (defaultConfig || !entry.is_global) && (par->hasValue || par->sub))
243 {
244 // Assign the actual value
245
246 switch (entry.data_type)
247 {
248 case TYPE_BOOLEAN:
249 values[i].boolVal = par->asBoolean();
250 break;
251 case TYPE_INTEGER:
252 values[i].intVal = par->asInteger();
253 break;
254 case TYPE_STRING:
255 values[i].strVal = par->value.c_str();
256 break;
257 //case TYPE_STRING_VECTOR:
258 // break;
259 }
260
261 if (!srcIdx)
262 {
263 const size_t len = strlen(srcName);
264 char* str = FB_NEW char[len + 1];
265 strcpy(str, srcName);
266 srcIdx = valuesSource.add(str);
267
268 fb_assert(srcIdx <= MAX_UCHAR);
269 }
270 sourceIdx[i] = srcIdx;
271 }
272
273 if (entry.data_type == TYPE_STRING && values[i] != defaults[i])
274 {
275 const char* src = values[i].strVal;
276 char* dst = FB_NEW_POOL(getPool()) char[strlen(src) + 1];
277 strcpy(dst, src);
278 values[i] = (ConfigValue) dst;
279 }
280 }
281
282 checkValues();
283}
284
285static const char* txtServerModes[6] =
286{

Callers

nothing calls this directly

Calls 5

findParameterMethod · 0.80
asBooleanMethod · 0.45
asIntegerMethod · 0.45
c_strMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected