projects
/
awesomized
/
libmemcached
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
73e36fc
)
Use setenv, not putenv.
author
Brian Aker
<brian@tangent.org>
Wed, 5 Dec 2012 00:52:38 +0000
(19:52 -0500)
committer
Brian Aker
<brian@tangent.org>
Wed, 5 Dec 2012 00:52:38 +0000
(19:52 -0500)
tests/parser.cc
patch
|
blob
|
history
diff --git
a/tests/parser.cc
b/tests/parser.cc
index a80c404a0bb3605b45e16bb3b8e5e105282f28d0..656c885a27c2e7fcd2cebdc3f694828f24e8a44b 100644
(file)
--- a/
tests/parser.cc
+++ b/
tests/parser.cc
@@
-58,10
+58,7
@@
static test_return_t memcached_zero_string_length_TEST(void*)
static test_return_t putenv_localhost_quoted_TEST(void*)
{
static test_return_t putenv_localhost_quoted_TEST(void*)
{
- char set_env[1024];
-
- snprintf(set_env, sizeof(set_env), "LIBMEMCACHED=\"--server=localhost\"");
- test_zero(putenv(set_env));
+ test_zero(setenv("LIBMEMCACHED", "\"--server=localhost\"", 1));
test_null(memcached(NULL, 0));
return TEST_SUCCESS;
test_null(memcached(NULL, 0));
return TEST_SUCCESS;
@@
-69,24
+66,7
@@
static test_return_t putenv_localhost_quoted_TEST(void*)
static test_return_t putenv_NULL_TEST(void*)
{
static test_return_t putenv_NULL_TEST(void*)
{
- char set_env[1024];
-
- snprintf(set_env, sizeof(set_env), "LIBMEMCACHED");
- test_zero(putenv(set_env));
- memcached_st *memc= memcached(NULL, 0);
- test_true(memc);
-
- memcached_free(memc);
-
- return TEST_SUCCESS;
-}
-
-static test_return_t putenv_NULL_TEST2(void*)
-{
- char set_env[1024];
-
- snprintf(set_env, sizeof(set_env), "LIBMEMCACHED=");
- test_zero(putenv(set_env));
+ test_zero(setenv("LIBMEMCACHED", "", 1));
memcached_st *memc= memcached(NULL, 0);
test_true(memc);
memcached_st *memc= memcached(NULL, 0);
test_true(memc);
@@
-97,10
+77,7
@@
static test_return_t putenv_NULL_TEST2(void*)
static test_return_t putenv_localhost_TEST(void*)
{
static test_return_t putenv_localhost_TEST(void*)
{
- char set_env[1024];
-
- snprintf(set_env, sizeof(set_env), "LIBMEMCACHED=--server=localhost");
- test_zero(putenv(set_env));
+ test_zero(setenv("LIBMEMCACHED", "--server=localhost", 1));
memcached_st *memc= memcached(NULL, 0);
test_true(memc);
memcached_st *memc= memcached(NULL, 0);
test_true(memc);
@@
-114,7
+91,6
@@
test_st memcached_TESTS[] ={
{"memcached(\"value\", 0)", false, (test_callback_fn*)memcached_zero_string_length_TEST },
{"putenv(LIBMEMCACHED=--server=localhost)", false, (test_callback_fn*)putenv_localhost_TEST },
{"putenv(LIBMEMCACHED)", false, (test_callback_fn*)putenv_NULL_TEST },
{"memcached(\"value\", 0)", false, (test_callback_fn*)memcached_zero_string_length_TEST },
{"putenv(LIBMEMCACHED=--server=localhost)", false, (test_callback_fn*)putenv_localhost_TEST },
{"putenv(LIBMEMCACHED)", false, (test_callback_fn*)putenv_NULL_TEST },
- {"putenv(LIBMEMCACHED=)", false, (test_callback_fn*)putenv_NULL_TEST2 },
{"putenv(LIBMEMCACHED=--server=\"localhost\")", false, (test_callback_fn*)putenv_localhost_quoted_TEST },
{0, 0, 0}
};
{"putenv(LIBMEMCACHED=--server=\"localhost\")", false, (test_callback_fn*)putenv_localhost_quoted_TEST },
{0, 0, 0}
};