From 5360350e4aeaa2c7498be4af29aee449f0ee49ad Mon Sep 17 00:00:00 2001 From: Kaige Ye Date: Wed, 15 Mar 2023 17:05:42 +0800 Subject: [PATCH] cleanup NBSP characters in comments (#10555) Replace NBSP character (0xC2 0xA0) with space (0x20). Looks like that was originally added due to misconfigured editor which seems to have been fixed by now. --- src/module.c | 48 +++++++++++++++++++++++------------------------ src/networking.c | 4 ++-- src/replication.c | 20 ++++++++++---------- src/resp_parser.c | 2 +- src/script_lua.c | 4 ++-- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/module.c b/src/module.c index a6c1b552ce..418c5bd323 100644 --- a/src/module.c +++ b/src/module.c @@ -2576,30 +2576,30 @@ RedisModuleString* RM_HoldString(RedisModuleCtx *ctx, RedisModuleString *str) { if (ctx != NULL) { /* * Put the str in the auto memory management of the ctx. -         * It might already be there, in this case, the ref count will -         * be 2 and we will decrease the ref count twice and free the -         * object in the auto memory free function. -         * -         * Why we can not do the same trick of just remove the object -         * from the auto memory (like in RM_RetainString)? -         * This code shows the issue: -         * -         * RM_AutoMemory(ctx); -         * str1 = RM_CreateString(ctx, "test", 4); -         * str2 = RM_HoldString(ctx, str1); -         * RM_FreeString(str1); -         * RM_FreeString(str2); -         * -         * If after the RM_HoldString we would just remove the string from -         * the auto memory, this example will cause access to a freed memory -         * on 'RM_FreeString(str2);' because the String will be free -         * on 'RM_FreeString(str1);'. -         * -         * So it's safer to just increase the ref count -         * and add the String to auto memory again. -         * -         * The limitation is that it is not possible to use RedisModule_StringAppendBuffer -         * on the String. + * It might already be there, in this case, the ref count will + * be 2 and we will decrease the ref count twice and free the + * object in the auto memory free function. + * + * Why we can not do the same trick of just remove the object + * from the auto memory (like in RM_RetainString)? + * This code shows the issue: + * + * RM_AutoMemory(ctx); + * str1 = RM_CreateString(ctx, "test", 4); + * str2 = RM_HoldString(ctx, str1); + * RM_FreeString(str1); + * RM_FreeString(str2); + * + * If after the RM_HoldString we would just remove the string from + * the auto memory, this example will cause access to a freed memory + * on 'RM_FreeString(str2);' because the String will be free + * on 'RM_FreeString(str1);'. + * + * So it's safer to just increase the ref count + * and add the String to auto memory again. + * + * The limitation is that it is not possible to use RedisModule_StringAppendBuffer + * on the String. */ autoMemoryAdd(ctx,REDISMODULE_AM_STRING,str); } diff --git a/src/networking.c b/src/networking.c index bc5d8128f8..954de341e5 100644 --- a/src/networking.c +++ b/src/networking.c @@ -575,8 +575,8 @@ void addReplyErrorObject(client *c, robj *err) { } /* Sends either a reply or an error reply by checking the first char. - * If the first char is '-' the reply is considered an error. - * In any case the given reply is sent, if the reply is also recognize + * If the first char is '-' the reply is considered an error. + * In any case the given reply is sent, if the reply is also recognize * as an error we also perform some post reply operations such as * logging and stats update. */ void addReplyOrErrorObject(client *c, robj *reply) { diff --git a/src/replication.c b/src/replication.c index 14f32a869a..0e575111b5 100644 --- a/src/replication.c +++ b/src/replication.c @@ -1764,16 +1764,16 @@ void replicationCreateMasterClient(connection *conn, int dbid) { connSetReadHandler(server.master->conn, readQueryFromClient); /** -     * Important note: -     * The CLIENT_DENY_BLOCKING flag is not, and should not, be set here. -     * For commands like BLPOP, it makes no sense to block the master -     * connection, and such blocking attempt will probably cause deadlock and -     * break the replication. We consider such a thing as a bug because -    * commands as BLPOP should never be sent on the replication link. -     * A possible use-case for blocking the replication link is if a module wants -     * to pass the execution to a background thread and unblock after the -     * execution is done. This is the reason why we allow blocking the replication -     * connection. */ + * Important note: + * The CLIENT_DENY_BLOCKING flag is not, and should not, be set here. + * For commands like BLPOP, it makes no sense to block the master + * connection, and such blocking attempt will probably cause deadlock and + * break the replication. We consider such a thing as a bug because + * commands as BLPOP should never be sent on the replication link. + * A possible use-case for blocking the replication link is if a module wants + * to pass the execution to a background thread and unblock after the + * execution is done. This is the reason why we allow blocking the replication + * connection. */ server.master->flags |= CLIENT_MASTER; server.master->authenticated = 1; diff --git a/src/resp_parser.c b/src/resp_parser.c index c9f5d0b004..b92a74cffb 100644 --- a/src/resp_parser.c +++ b/src/resp_parser.c @@ -35,7 +35,7 @@ * callback represents a different reply type. Each callback gets a p_ctx that * was given to the parseReply function. The callbacks also give the protocol * (underlying blob) of the current reply and the size. - * + * * Some callbacks also get the parser object itself: * - array_callback * - set_callback diff --git a/src/script_lua.c b/src/script_lua.c index cf0755e151..8cdd80523c 100644 --- a/src/script_lua.c +++ b/src/script_lua.c @@ -1562,8 +1562,8 @@ static void luaMaskCountHook(lua_State *lua, lua_Debug *ar) { /* * Set the hook to invoke all the time so the user -         * will not be able to catch the error with pcall and invoke -         * pcall again which will prevent the script from ever been killed + * will not be able to catch the error with pcall and invoke + * pcall again which will prevent the script from ever been killed */ lua_sethook(lua, luaMaskCountHook, LUA_MASKLINE, 0);