diff options
-rw-r--r-- | build_win/filelist.win | 1 | ||||
-rw-r--r-- | dist/filelist | 1 | ||||
-rw-r--r-- | src/config/config_concat.c | 72 | ||||
-rw-r--r-- | src/include/extern.h | 1 | ||||
-rw-r--r-- | src/schema/schema_create.c | 4 |
5 files changed, 2 insertions, 77 deletions
diff --git a/build_win/filelist.win b/build_win/filelist.win index 270cd96ac86..d1b43bd8348 100644 --- a/build_win/filelist.win +++ b/build_win/filelist.win @@ -49,7 +49,6 @@ src/config/config.c src/config/config_api.c src/config/config_check.c src/config/config_collapse.c -src/config/config_concat.c src/config/config_def.c src/config/config_ext.c src/config/config_upgrade.c diff --git a/dist/filelist b/dist/filelist index ac3f29ad7ab..7d57864a788 100644 --- a/dist/filelist +++ b/dist/filelist @@ -49,7 +49,6 @@ src/config/config.c src/config/config_api.c src/config/config_check.c src/config/config_collapse.c -src/config/config_concat.c src/config/config_def.c src/config/config_ext.c src/config/config_upgrade.c diff --git a/src/config/config_concat.c b/src/config/config_concat.c deleted file mode 100644 index e872722a272..00000000000 --- a/src/config/config_concat.c +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * Copyright (c) 2014-2015 MongoDB, Inc. - * Copyright (c) 2008-2014 WiredTiger, Inc. - * All rights reserved. - * - * See the file LICENSE for redistribution information. - */ - -#include "wt_internal.h" - -/* - * __wt_config_concat -- - * Given a NULL-terminated list of configuration strings, concatenate them - * into newly allocated memory. Nothing special is assumed about any of - * the config strings, they are simply combined in order. - * - * This code deals with the case where some of the config strings are - * wrapped in brackets but others aren't: the resulting string does not - * have brackets. - */ -int -__wt_config_concat( - WT_SESSION_IMPL *session, const char **cfg, char **config_ret) -{ - WT_CONFIG cparser; - WT_CONFIG_ITEM k, v; - WT_DECL_ITEM(tmp); - WT_DECL_RET; - const char **cp; - - WT_RET(__wt_scr_alloc(session, 0, &tmp)); - - for (cp = cfg; *cp != NULL; ++cp) { - WT_ERR(__wt_config_init(session, &cparser, *cp)); - while ((ret = __wt_config_next(&cparser, &k, &v)) == 0) { - if (k.type != WT_CONFIG_ITEM_STRING && - k.type != WT_CONFIG_ITEM_ID) - WT_ERR_MSG(session, EINVAL, - "Invalid configuration key found: '%s'\n", - k.str); - /* Include the quotes around string keys/values. */ - if (k.type == WT_CONFIG_ITEM_STRING) { - --k.str; - k.len += 2; - } - if (v.type == WT_CONFIG_ITEM_STRING) { - --v.str; - v.len += 2; - } - WT_ERR(__wt_buf_catfmt(session, tmp, "%.*s%s%.*s,", - (int)k.len, k.str, - (v.len > 0) ? "=" : "", - (int)v.len, v.str)); - } - if (ret != WT_NOTFOUND) - goto err; - } - - /* - * If the caller passes us no valid configuration strings, we get here - * with no bytes to copy -- that's OK, the underlying string copy can - * handle empty strings. - * - * Strip any trailing comma. - */ - if (tmp->size != 0) - --tmp->size; - ret = __wt_strndup(session, tmp->data, tmp->size, config_ret); - -err: __wt_scr_free(session, &tmp); - return (ret); -} diff --git a/src/include/extern.h b/src/include/extern.h index deaeb02a978..8e848359bd6 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -197,7 +197,6 @@ extern int __wt_configure_method(WT_SESSION_IMPL *session, const char *method, c extern int __wt_config_check(WT_SESSION_IMPL *session, const WT_CONFIG_ENTRY *entry, const char *config, size_t config_len); extern int __wt_config_collapse( WT_SESSION_IMPL *session, const char **cfg, char **config_ret); extern int __wt_config_merge(WT_SESSION_IMPL *session, const char **cfg, const char *cfg_strip, const char **config_ret); -extern int __wt_config_concat( WT_SESSION_IMPL *session, const char **cfg, char **config_ret); extern int __wt_conn_config_init(WT_SESSION_IMPL *session); extern void __wt_conn_config_discard(WT_SESSION_IMPL *session); extern int __wt_ext_config_parser_open(WT_EXTENSION_API *wt_ext, WT_SESSION *wt_session, const char *config, size_t len, WT_CONFIG_PARSER **config_parserp); diff --git a/src/schema/schema_create.c b/src/schema/schema_create.c index 80e443d8a21..4212fb9558d 100644 --- a/src/schema/schema_create.c +++ b/src/schema/schema_create.c @@ -244,7 +244,7 @@ __create_colgroup(WT_SESSION_IMPL *session, table, cval.str, cval.len, NULL, 1, &fmt)); } sourcecfg[1] = fmt.data; - WT_ERR(__wt_config_concat(session, sourcecfg, &sourceconf)); + WT_ERR(__wt_config_merge(session, sourcecfg, NULL, &sourceconf)); WT_ERR(__wt_schema_create(session, source, sourceconf)); @@ -458,7 +458,7 @@ __create_index(WT_SESSION_IMPL *session, session, &fmt, ",index_key_columns=%u", npublic_cols)); sourcecfg[1] = fmt.data; - WT_ERR(__wt_config_concat(session, sourcecfg, &sourceconf)); + WT_ERR(__wt_config_merge(session, sourcecfg, NULL, &sourceconf)); WT_ERR(__wt_schema_create(session, source, sourceconf)); |