diff options
author | Michael Cahill <michael.cahill@wiredtiger.com> | 2012-11-07 11:06:50 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@wiredtiger.com> | 2012-11-07 11:06:50 +1100 |
commit | a828010c3aa72c20b3122a8d39d1ac51f8169807 (patch) | |
tree | 912ce58dacfc3cdecfe5eb47b4f5a4fe8890dfc0 /src/config/config.c | |
parent | 34b38436d0e9f5fefe9fd038c7efa91ff36b4626 (diff) | |
download | mongo-a828010c3aa72c20b3122a8d39d1ac51f8169807.tar.gz |
Add support for getting config values with "X.Y" keys, update auto-generated defaults to match.
Diffstat (limited to 'src/config/config.c')
-rw-r--r-- | src/config/config.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/config/config.c b/src/config/config.c index bde794eee17..e351a7bf946 100644 --- a/src/config/config.c +++ b/src/config/config.c @@ -568,17 +568,29 @@ int __wt_config_getraw( WT_CONFIG *cparser, WT_CONFIG_ITEM *key, WT_CONFIG_ITEM *value) { - WT_CONFIG_ITEM k, v; + WT_CONFIG sparser; + WT_CONFIG_ITEM k, v, subk; WT_DECL_RET; int found; found = 0; while ((ret = __config_next(cparser, &k, &v)) == 0) { - if ((k.type == ITEM_STRING || k.type == ITEM_ID) && - key->len == k.len && + if (k.type != ITEM_STRING && k.type != ITEM_ID) + continue; + if (k.len == key->len && strncasecmp(key->str, k.str, k.len) == 0) { *value = v; found = 1; + } else if (k.len < key->len && key->str[k.len] == '.' && + strncasecmp(key->str, k.str, k.len) == 0) { + subk.str = key->str + k.len + 1; + subk.len = key->len - k.len - 1; + WT_RET(__wt_config_initn( + cparser->session, &sparser, v.str, v.len)); + if ((ret = + __wt_config_getraw(&sparser, &subk, value)) == 0) + found = 1; + WT_RET_NOTFOUND_OK(ret); } } |