diff options
-rw-r--r-- | build_posix/wiredtiger.pc.in | 4 | ||||
-rw-r--r-- | src/conn/conn_api.c | 18 | ||||
-rw-r--r-- | src/include/extern.h | 2 | ||||
-rw-r--r-- | src/os_posix/os_getenv.c | 11 | ||||
-rw-r--r-- | src/os_win/os_getenv.c | 12 |
5 files changed, 22 insertions, 25 deletions
diff --git a/build_posix/wiredtiger.pc.in b/build_posix/wiredtiger.pc.in index be257efcef3..fb45c74bb08 100644 --- a/build_posix/wiredtiger.pc.in +++ b/build_posix/wiredtiger.pc.in @@ -7,5 +7,5 @@ Name: WiredTiger Description: The WiredTiger Data Engine Requires: Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lwiredtiger-@VERSION_NOPATCH@ -Cflags: -I${includedir}/wiredtiger-@VERSION_NOPATCH@ +Libs: -L${libdir} -lwiredtiger +Cflags: -I${includedir} diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c index 12c9bec31ef..c878024edb4 100644 --- a/src/conn/conn_api.c +++ b/src/conn/conn_api.c @@ -519,8 +519,8 @@ err: if (nextractor != NULL) { * Given a configuration, configure the extractor. */ int -__wt_extractor_config(WT_SESSION_IMPL *session, const char *config, - WT_EXTRACTOR **extractorp, int *ownp) +__wt_extractor_config(WT_SESSION_IMPL *session, + const char *config, WT_EXTRACTOR **extractorp, int *ownp) { WT_CONNECTION_IMPL *conn; WT_CONFIG_ITEM cval; @@ -531,21 +531,18 @@ __wt_extractor_config(WT_SESSION_IMPL *session, const char *config, conn = S2C(session); - WT_CLEAR(cval); WT_RET_NOTFOUND_OK( __wt_config_getones_none(session, config, "extractor", &cval)); if (cval.len == 0) return (0); TAILQ_FOREACH(nextractor, &conn->extractorqh, q) - if (WT_STRING_MATCH( - nextractor->name, cval.str, cval.len)) + if (WT_STRING_MATCH(nextractor->name, cval.str, cval.len)) break; if (nextractor == NULL) WT_RET_MSG(session, EINVAL, - "unknown extractor '%.*s'", - (int)cval.len, cval.str); + "unknown extractor '%.*s'", (int)cval.len, cval.str); if (nextractor->extractor->customize != NULL) { WT_RET(__wt_config_getones(session, @@ -1013,9 +1010,11 @@ __conn_config_env(WT_SESSION_IMPL *session, const char *cfg[], WT_ITEM *cbuf) ret = __wt_getenv(session, "WIREDTIGER_CONFIG", &env_config); if (ret == WT_NOTFOUND) return (0); + WT_ERR(ret); + len = strlen(env_config); if (len == 0) - return (0); + goto err; /* Free the memory. */ WT_ERR(__wt_buf_set(session, cbuf, env_config, len + 1)); /* @@ -1043,8 +1042,7 @@ __conn_config_env(WT_SESSION_IMPL *session, const char *cfg[], WT_ITEM *cbuf) /* Append it to the stack. */ __conn_config_append(cfg, cbuf->data); -err: if (env_config != NULL) - __wt_free(session, env_config); +err: __wt_free(session, env_config); return (ret); } diff --git a/src/include/extern.h b/src/include/extern.h index 99323a0b126..056058f3828 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -442,7 +442,7 @@ extern int __wt_directory_sync(WT_SESSION_IMPL *session, char *path); extern int __wt_fsync(WT_SESSION_IMPL *session, WT_FH *fh); extern int __wt_fsync_async(WT_SESSION_IMPL *session, WT_FH *fh); extern int __wt_ftruncate(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t len); -extern int __wt_getenv(WT_SESSION_IMPL *session, const char *variable, const char **env); +extern int __wt_getenv(WT_SESSION_IMPL *session, const char *variable, const char **envp); extern int __wt_getline(WT_SESSION_IMPL *session, WT_ITEM *buf, FILE *fp); extern int __wt_getopt( const char *progname, int nargc, char *const *nargv, const char *ostr); extern int __wt_mmap(WT_SESSION_IMPL *session, WT_FH *fh, void *mapp, size_t *lenp, void **mappingcookie); diff --git a/src/os_posix/os_getenv.c b/src/os_posix/os_getenv.c index 83cf8a75770..37fe2af8501 100644 --- a/src/os_posix/os_getenv.c +++ b/src/os_posix/os_getenv.c @@ -9,18 +9,17 @@ /* * __wt_getenv -- - * Get a non-null environment variable + * Get a non-NULL, greater than zero-length environment variable. */ int -__wt_getenv(WT_SESSION_IMPL *session, const char *variable, const char **env) +__wt_getenv(WT_SESSION_IMPL *session, const char *variable, const char **envp) { const char *temp; - *env = NULL; + *envp = NULL; - if (((temp = getenv(variable)) != NULL) && strlen(temp) > 0) { - return (__wt_strdup(session, temp, env)); - } + if (((temp = getenv(variable)) != NULL) && strlen(temp) > 0) + return (__wt_strdup(session, temp, envp)); return (WT_NOTFOUND); } diff --git a/src/os_win/os_getenv.c b/src/os_win/os_getenv.c index 31505266d76..8cc94abb524 100644 --- a/src/os_win/os_getenv.c +++ b/src/os_win/os_getenv.c @@ -9,24 +9,24 @@ /* * __wt_getenv -- - * Get a non-null environment variable + * Get a non-NULL, greater than zero-length environment variable. */ int -__wt_getenv(WT_SESSION_IMPL *session, const char *variable, const char **env) +__wt_getenv(WT_SESSION_IMPL *session, const char *variable, const char **envp) { WT_DECL_RET; DWORD size; - *env = NULL; + *envp = NULL; size = GetEnvironmentVariableA(variable, NULL, 0); if (size <= 1) return (WT_NOTFOUND); - WT_RET(__wt_calloc(session, 1, size, env)); + WT_RET(__wt_calloc(session, 1, size, envp)); - ret = GetEnvironmentVariableA(variable, *env, size); - /* We expect the number of bytes not including null terminator */ + ret = GetEnvironmentVariableA(variable, *envp, size); + /* We expect the number of bytes not including nul terminator. */ if ((ret + 1) != size) WT_RET_MSG(session, __wt_errno(), "GetEnvironmentVariableA failed: %s", variable); |