From aee72918851db8af296e096b759dfb7aaea17968 Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Fri, 22 Mar 2024 21:49:09 +0100 Subject: examples/* ssl.c test.c: update strings Signed-off-by: Anna (navi) Figueiredo Gomes --- examples/example-libevent-ssl.c | 2 +- examples/example-push.c | 4 ++-- examples/example-redictmoduleapi.c | 1 - examples/example-ssl.c | 4 ++-- examples/example.c | 4 ++-- ssl.c | 2 +- test.c | 40 +++++++++++++++++++------------------- 7 files changed, 28 insertions(+), 29 deletions(-) diff --git a/examples/example-libevent-ssl.c b/examples/example-libevent-ssl.c index b2c6b56..a142b22 100644 --- a/examples/example-libevent-ssl.c +++ b/examples/example-libevent-ssl.c @@ -69,7 +69,7 @@ int main (int argc, char **argv) { ssl = redisCreateSSLContext(caCert, NULL, cert, certKey, NULL, &ssl_error); if (!ssl) { - printf("Error: %s\n", redisSSLContextGetError(ssl_error)); + printf("Error: %s\n", redictSSLContextGetError(ssl_error)); return 1; } diff --git a/examples/example-push.c b/examples/example-push.c index a00422f..ce28c38 100644 --- a/examples/example-push.c +++ b/examples/example-push.c @@ -25,7 +25,7 @@ static void assertReplyAndFree(redisContext *context, redisReply *reply, int typ if (reply->type != type) { if (reply->type == REDIS_REPLY_ERROR) - fprintf(stderr, "Redis Error: %s\n", reply->str); + fprintf(stderr, "Redict Error: %s\n", reply->str); panicAbort("Expected reply type %d but got type %d", type, reply->type); } @@ -42,7 +42,7 @@ static void enableClientTracking(redisContext *c) { if (reply->type != REDIS_REPLY_MAP) { fprintf(stderr, "Error: Can't send HELLO 3 command. Are you sure you're "); - fprintf(stderr, "connected to redis-server >= 6.0.0?\nRedis error: %s\n", + fprintf(stderr, "connected to redict-server >= 6.0.0?\nRedict error: %s\n", reply->type == REDIS_REPLY_ERROR ? reply->str : "(unknown)"); exit(-1); } diff --git a/examples/example-redictmoduleapi.c b/examples/example-redictmoduleapi.c index c95546c..f929ffc 100644 --- a/examples/example-redictmoduleapi.c +++ b/examples/example-redictmoduleapi.c @@ -74,7 +74,6 @@ int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) } if (redisModuleCompatibilityCheck() != REDIS_OK) { - printf("Redis 7.0 or above is required! \n"); return REDISMODULE_ERR; } diff --git a/examples/example-ssl.c b/examples/example-ssl.c index 1654f5d..ac3dfb8 100644 --- a/examples/example-ssl.c +++ b/examples/example-ssl.c @@ -34,7 +34,7 @@ int main(int argc, char **argv) { redisInitOpenSSL(); ssl = redisCreateSSLContext(ca, NULL, cert, key, NULL, &ssl_error); if (!ssl || ssl_error != REDIS_SSL_CTX_NONE) { - printf("SSL Context error: %s\n", redisSSLContextGetError(ssl_error)); + printf("SSL Context error: %s\n", redictSSLContextGetError(ssl_error)); exit(1); } @@ -49,7 +49,7 @@ int main(int argc, char **argv) { printf("Connection error: %s\n", c->errstr); redisFree(c); } else { - printf("Connection error: can't allocate redis context\n"); + printf("Connection error: can't allocate redict context\n"); } exit(1); } diff --git a/examples/example.c b/examples/example.c index a87e5cf..41c8189 100644 --- a/examples/example.c +++ b/examples/example.c @@ -42,7 +42,7 @@ static void example_argv_command(redisContext *c, size_t n) { reply = redisCommandArgv(c, n + 2, (const char **)argv, (const size_t*)argvlen); if (reply == NULL || c->err) { - fprintf(stderr, "Error: Couldn't execute redisCommandArgv\n"); + fprintf(stderr, "Error: Couldn't execute redictCommandArgv\n"); exit(1); } @@ -88,7 +88,7 @@ int main(int argc, char **argv) { printf("Connection error: %s\n", c->errstr); redisFree(c); } else { - printf("Connection error: can't allocate redis context\n"); + printf("Connection error: can't allocate redict context\n"); } exit(1); } diff --git a/ssl.c b/ssl.c index a2c3b07..1fcf45c 100644 --- a/ssl.c +++ b/ssl.c @@ -337,7 +337,7 @@ error: static int redisSSLConnect(redisContext *c, SSL *ssl) { if (c->privctx) { - __redisSetError(c, REDIS_ERR_OTHER, "redisContext was already associated"); + __redisSetError(c, REDIS_ERR_OTHER, "redictContext was already associated"); return REDIS_ERR; } diff --git a/test.c b/test.c index 02a2197..7703292 100644 --- a/test.c +++ b/test.c @@ -123,7 +123,7 @@ static long long usec(void) { } while (1) /* Helper to extract Redis version information. Aborts on any failure. */ -#define REDIS_VERSION_FIELD "redis_version:" +#define REDIS_VERSION_FIELD "redict_version:" void get_redis_version(redisContext *c, int *majorptr, int *minorptr) { redisReply *reply; char *eptr, *s, *e; @@ -155,7 +155,7 @@ void get_redis_version(redisContext *c, int *majorptr, int *minorptr) { abort: freeReplyObject(reply); - fprintf(stderr, "Error: Cannot determine Redis version, aborting\n"); + fprintf(stderr, "Error: Cannot determine Redict version, aborting\n"); exit(1); } @@ -254,7 +254,7 @@ static redisContext *do_connect(struct config config) { } if (c == NULL) { - printf("Connection error: can't allocate redis context\n"); + printf("Connection error: can't allocate redict context\n"); exit(1); } else if (c->err) { printf("Connection error: %s\n", c->errstr); @@ -878,7 +878,7 @@ static void test_free_null(void) { void *redisCtx = NULL; void *reply = NULL; - test("Don't fail when redisFree is passed a NULL value: "); + test("Don't fail when redictFree is passed a NULL value: "); redisFree(redisCtx); test_cond(redisCtx == NULL); @@ -925,16 +925,16 @@ static void test_allocator_injection(void) { // Override hiredis allocators hiredisSetAllocators(&ha); - test("redisContext uses injected allocators: "); + test("redictContext uses injected allocators: "); redisContext *c = redisConnect("localhost", 6379); test_cond(c == NULL); - test("redisReader uses injected allocators: "); + test("redictReader uses injected allocators: "); redisReader *reader = redisReaderCreate(); test_cond(reader == NULL); /* Make sure hiredis itself protects against a non-overflow checking calloc */ - test("hiredis calloc wrapper protects against overflow: "); + test("hiredict calloc wrapper protects against overflow: "); ha.callocFn = hi_calloc_insecure; hiredisSetAllocators(&ha); ptr = hi_calloc((SIZE_MAX / sizeof(void*)) + 3, sizeof(void*)); @@ -1114,13 +1114,13 @@ static void test_resp3_push_options(struct config config) { redisContext *c; redisOptions options; - test("We set a default RESP3 handler for redisContext: "); + test("We set a default RESP3 handler for redictContext: "); options = get_redis_tcp_options(config); assert((c = redisConnectWithOptions(&options)) != NULL); test_cond(c->push_cb != NULL); redisFree(c); - test("We don't set a default RESP3 push handler for redisAsyncContext: "); + test("We don't set a default RESP3 push handler for redictAsyncContext: "); options = get_redis_tcp_options(config); assert((ac = redisAsyncConnectWithOptions(&options)) != NULL); test_cond(ac->c.push_cb == NULL); @@ -1133,14 +1133,14 @@ static void test_resp3_push_options(struct config config) { test_cond(c->push_cb == NULL); redisFree(c); - test("We can use redisOptions to set a custom PUSH handler for redisContext: "); + test("We can use redictOptions to set a custom PUSH handler for redctsContext: "); options = get_redis_tcp_options(config); options.push_cb = push_handler; assert((c = redisConnectWithOptions(&options)) != NULL); test_cond(c->push_cb == push_handler); redisFree(c); - test("We can use redisOptions to set a custom PUSH handler for redisAsyncContext: "); + test("We can use redictOptions to set a custom PUSH handler for redictAsyncContext: "); options = get_redis_tcp_options(config); options.async_push_cb = push_handler_async; assert((ac = redisAsyncConnectWithOptions(&options)) != NULL); @@ -1158,7 +1158,7 @@ static void test_privdata_hooks(struct config config) { redisOptions options; redisContext *c; - test("We can use redisOptions to set privdata: "); + test("We can use redictOptions to set privdata: "); options = get_redis_tcp_options(config); REDIS_OPTIONS_SET_PRIVDATA(&options, &data, free_privdata); assert((c = redisConnectWithOptions(&options)) != NULL); @@ -1253,7 +1253,7 @@ static void test_blocking_connection(struct config config) { freeReplyObject(reply); /* Make sure passing NULL to redisGetReply is safe */ - test("Can pass NULL to redisGetReply: "); + test("Can pass NULL to redictGetReply: "); assert(redisAppendCommand(c, "PING") == REDIS_OK); test_cond(redisGetReply(c, NULL) == REDIS_OK); @@ -1273,7 +1273,7 @@ static int detect_debug_sleep(redisContext *c) { if (reply == NULL || c->err) { const char *cause = c->err ? c->errstr : "(none)"; - fprintf(stderr, "Error testing for DEBUG SLEEP (Redis error: %s), exiting\n", cause); + fprintf(stderr, "Error testing for DEBUG SLEEP (Redict error: %s), exiting\n", cause); exit(-1); } @@ -1565,33 +1565,33 @@ static void test_throughput(struct config config) { // test_cond(__test_callback_flags == 1); // redisFree(c); // -// test("Calls disconnect callback on redisDisconnect: "); +// test("Calls disconnect callback on redictDisconnect: "); // c = __connect_nonblock(); // redisSetDisconnectCallback(c,__test_callback,(void*)2); // redisDisconnect(c); // test_cond(__test_callback_flags == 2); // redisFree(c); // -// test("Calls disconnect callback and free callback on redisFree: "); +// test("Calls disconnect callback and free callback on redictFree: "); // c = __connect_nonblock(); // redisSetDisconnectCallback(c,__test_callback,(void*)2); // redisSetFreeCallback(c,__test_callback,(void*)4); // redisFree(c); // test_cond(__test_callback_flags == ((2 << 8) | 4)); // -// test("redisBufferWrite against empty write buffer: "); +// test("redictBufferWrite against empty write buffer: "); // c = __connect_nonblock(); // test_cond(redisBufferWrite(c,&wdone) == REDIS_OK && wdone == 1); // redisFree(c); // -// test("redisBufferWrite against not yet connected fd: "); +// test("redictBufferWrite against not yet connected fd: "); // c = __connect_nonblock(); // redisCommand(c,"PING"); // test_cond(redisBufferWrite(c,NULL) == REDIS_ERR && // strncmp(c->error,"write:",6) == 0); // redisFree(c); // -// test("redisBufferWrite against closed fd: "); +// test("redictBufferWrite against closed fd: "); // c = __connect_nonblock(); // redisCommand(c,"PING"); // redisDisconnect(c); @@ -1622,7 +1622,7 @@ static void test_throughput(struct config config) { // test_cond(__test_callback_flags == 0x010203); // redisFree(c); // -// test("redisDisconnect executes pending callbacks with NULL reply: "); +// test("redictDisconnect executes pending callbacks with NULL reply: "); // c = __connect_nonblock(); // redisSetDisconnectCallback(c,__test_callback,(void*)1); // redisCommandWithCallback(c,__test_reply_callback,(void*)2,"PING"); -- cgit v1.2.3