Rename symbols, part four

This commit is contained in:
Drew DeVault 2024-03-21 17:06:18 +01:00
parent 1c50b46ebf
commit 32618409c6
22 changed files with 119 additions and 119 deletions

View File

@ -2513,7 +2513,7 @@ int ACLSaveToFile(const char *filename) {
}
offset += written_bytes;
}
if (redis_fsync(fd) == -1) {
if (redict_fsync(fd) == -1) {
serverLog(LL_WARNING,"Syncing ACL file for ACL SAVE: %s",
strerror(errno));
goto cleanup;

View File

@ -233,7 +233,7 @@ int aeDeleteTimeEvent(aeEventLoop *eventLoop, long long id)
* If there are no timers, -1 is returned.
*
* Note that's O(N) since time events are unsorted.
* Possible optimizations (not needed by Redis so far, but...):
* Possible optimizations (not needed by Redict so far, but...):
* 1) Insert the event in order, so that the nearest is just the head.
* Much better but still insertion or deletion of timers is O(N).
* 2) Use a skiplist to have this operation as O(1) and insertion as O(log(N)).

View File

@ -349,7 +349,7 @@ int anetResolve(char *err, char *host, char *ipbuf, size_t ipbuf_len,
static int anetSetReuseAddr(char *err, int fd) {
int yes = 1;
/* Make sure connection-intensive things like the redis benchmark
/* Make sure connection-intensive things like the redict benchmark
* will be able to close/open sockets a zillion of times */
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) == -1) {
anetSetError(err, "setsockopt SO_REUSEADDR: %s", strerror(errno));
@ -365,7 +365,7 @@ static int anetCreateSocket(char *err, int domain) {
return ANET_ERR;
}
/* Make sure connection-intensive things like the redis benchmark
/* Make sure connection-intensive things like the redict benchmark
* will be able to close/open sockets a zillion of times */
if (anetSetReuseAddr(err,s) == ANET_ERR) {
close(s);
@ -478,7 +478,7 @@ int anetUnixGenericConnect(char *err, const char *path, int flags)
return ANET_ERR;
sa.sun_family = AF_LOCAL;
redis_strlcpy(sa.sun_path,path,sizeof(sa.sun_path));
redict_strlcpy(sa.sun_path,path,sizeof(sa.sun_path));
if (flags & ANET_CONNECT_NONBLOCK) {
if (anetNonBlock(err,s) != ANET_OK) {
close(s);
@ -590,7 +590,7 @@ int anetUnixServer(char *err, char *path, mode_t perm, int backlog)
memset(&sa,0,sizeof(sa));
sa.sun_family = AF_LOCAL;
redis_strlcpy(sa.sun_path,path,sizeof(sa.sun_path));
redict_strlcpy(sa.sun_path,path,sizeof(sa.sun_path));
if (anetListen(err,s,(struct sockaddr*)&sa,sizeof(sa),backlog,perm) == ANET_ERR)
return ANET_ERR;
return s;

View File

@ -539,7 +539,7 @@ int writeAofManifestFile(sds buf) {
buf += nwritten;
}
if (redis_fsync(fd) == -1) {
if (redict_fsync(fd) == -1) {
serverLog(LL_WARNING, "Fail to fsync the temp AOF file %s: %s.",
tmp_am_name, strerror(errno));
@ -931,7 +931,7 @@ void killAppendOnlyChild(void) {
void stopAppendOnly(void) {
serverAssert(server.aof_state != AOF_OFF);
flushAppendOnlyFile(1);
if (redis_fsync(server.aof_fd) == -1) {
if (redict_fsync(server.aof_fd) == -1) {
serverLog(LL_WARNING,"Fail to fsync the AOF file: %s",strerror(errno));
} else {
server.aof_last_fsync = server.mstime;
@ -1226,13 +1226,13 @@ try_fsync:
/* Perform the fsync if needed. */
if (server.aof_fsync == AOF_FSYNC_ALWAYS) {
/* redis_fsync is defined as fdatasync() for Linux in order to avoid
/* redict_fsync is defined as fdatasync() for Linux in order to avoid
* flushing metadata. */
latencyStartMonitor(latency);
/* Let's try to get this data on the disk. To guarantee data safe when
* the AOF fsync policy is 'always', we should exit if failed to fsync
* AOF (see comment next to the exit(1) after write error above). */
if (redis_fsync(server.aof_fd) == -1) {
if (redict_fsync(server.aof_fd) == -1) {
serverLog(LL_WARNING,"Can't persist AOF for fsync error when the "
"AOF fsync policy is 'always': %s. Exiting...", strerror(errno));
exit(1);

View File

@ -155,7 +155,7 @@ void *bioProcessBackgroundJobs(void *arg) {
/* Check that the worker is within the right interval. */
serverAssert(worker < BIO_WORKER_NUM);
redis_set_thread_title(bio_worker_title[worker]);
redict_set_thread_title(bio_worker_title[worker]);
redictSetCpuAffinity(server.bio_cpulist);
@ -190,7 +190,7 @@ void *bioProcessBackgroundJobs(void *arg) {
if (job_type == BIO_CLOSE_FILE) {
if (job->fd_args.need_fsync &&
redis_fsync(job->fd_args.fd) == -1 &&
redict_fsync(job->fd_args.fd) == -1 &&
errno != EBADF && errno != EINVAL)
{
serverLog(LL_WARNING, "Fail to fsync the AOF file: %s",strerror(errno));
@ -205,7 +205,7 @@ void *bioProcessBackgroundJobs(void *arg) {
/* The fd may be closed by main thread and reused for another
* socket, pipe, or file. We just ignore these errno because
* aof fsync did not really fail. */
if (redis_fsync(job->fd_args.fd) == -1 &&
if (redict_fsync(job->fd_args.fd) == -1 &&
errno != EBADF && errno != EINVAL)
{
int last_status;
@ -268,7 +268,7 @@ void bioDrainWorker(int job_type) {
/* Kill the running bio threads in an unclean way. This function should be
* used only when it's critical to stop the threads for some reason.
* Currently Redis does this only on crash (for instance on SIGSEGV) in order
* Currently Redict does this only on crash (for instance on SIGSEGV) in order
* to perform a fast memory check without other threads messing with memory. */
void bioKillThreads(void) {
int err;

View File

@ -75,7 +75,7 @@ long long redictPopcount(void *s, long count) {
* no zero bit is found, it returns count*8 assuming the string is zero
* padded on the right. However if 'bit' is 1 it is possible that there is
* not a single set bit in the bitmap. In this special case -1 is returned. */
long long redisBitpos(void *s, unsigned long count, int bit) {
long long redictBitpos(void *s, unsigned long count, int bit) {
unsigned long *l;
unsigned char *c;
unsigned long skipval, word = 0, one;
@ -158,7 +158,7 @@ long long redisBitpos(void *s, unsigned long count, int bit) {
/* If we reached this point, there is a bug in the algorithm, since
* the case of no match is handled as a special case before. */
serverPanic("End of redisBitpos() reached.");
serverPanic("End of redictBitpos() reached.");
return 0; /* Just to avoid warnings. */
}
@ -383,7 +383,7 @@ void printBits(unsigned char *p, unsigned long count) {
/* This helper function used by GETBIT / SETBIT parses the bit offset argument
* making sure an error is returned if it is negative or if it overflows
* Redis 512 MB limit for the string value or more (server.proto_max_bulk_len).
* Redict 512 MB limit for the string value or more (server.proto_max_bulk_len).
*
* If the 'hash' argument is true, and 'bits is positive, then the command
* will also parse bit offsets prefixed by "#". In such a case the offset
@ -420,7 +420,7 @@ int getBitOffsetFromArgument(client *c, robj *o, uint64_t *offset, int hash, int
/* This helper function for BITFIELD parses a bitfield type in the form
* <sign><bits> where sign is 'u' or 'i' for unsigned and signed, and
* the bits is a value between 1 and 64. However 64 bits unsigned integers
* are reported as an error because of current limitations of Redis protocol
* are reported as an error because of current limitations of Redict protocol
* to return unsigned integer values greater than INT64_MAX.
*
* On error C_ERR is returned and an error is sent to the client. */
@ -966,7 +966,7 @@ void bitposCommand(client *c) {
if (bit) tmpchar = tmpchar & ~last_byte_neg_mask;
else tmpchar = tmpchar | last_byte_neg_mask;
}
pos = redisBitpos(&tmpchar,1,bit);
pos = redictBitpos(&tmpchar,1,bit);
/* If there are no more bytes or we get valid pos, we can exit early */
if (bytes == 1 || (pos != -1 && pos != 8)) goto result;
start++;
@ -975,7 +975,7 @@ void bitposCommand(client *c) {
/* If the last byte has not bits in the range, we should exclude it */
long curbytes = bytes - (last_byte_neg_mask ? 1 : 0);
if (curbytes > 0) {
pos = redisBitpos(p+start,curbytes,bit);
pos = redictBitpos(p+start,curbytes,bit);
/* If there is no more bytes or we get valid pos, we can exit early */
if (bytes == curbytes || (pos != -1 && pos != (long long)curbytes<<3)) goto result;
start += curbytes;
@ -983,14 +983,14 @@ void bitposCommand(client *c) {
}
if (bit) tmpchar = p[end] & ~last_byte_neg_mask;
else tmpchar = p[end] | last_byte_neg_mask;
pos = redisBitpos(&tmpchar,1,bit);
pos = redictBitpos(&tmpchar,1,bit);
result:
/* If we are looking for clear bits, and the user specified an exact
* range with start-end, we can't consider the right of the range as
* zero padded (as we do when no explicit end is given).
*
* So if redisBitpos() returns the first bit outside the range,
* So if redictBitpos() returns the first bit outside the range,
* we return -1 to the caller, to mean, in the specified range there
* is not a single "0" bit. */
if (end_given && bit == 0 && pos == (long long)bytes<<3) {

View File

@ -237,7 +237,7 @@ void disconnectAllBlockedClients(void) {
}
}
/* This function should be called by Redis every time a single command,
/* This function should be called by Redict every time a single command,
* a MULTI/EXEC block, or a Lua script, terminated its execution after
* being called by a client. It handles serving clients blocked in all scenarios
* where a specific key access requires to block until that key is available.
@ -255,7 +255,7 @@ void disconnectAllBlockedClients(void) {
* do client side, indeed!). Because mismatching clients (blocking for
* a different type compared to the current key type) are moved in the
* other side of the linked list. However as long as the key starts to
* be used only for a single type, like virtually any Redis application will
* be used only for a single type, like virtually any Redict application will
* do, the function is already fair. */
void handleClientsBlockedOnKeys(void) {

View File

@ -503,7 +503,7 @@ list *callReplyDeferredErrorList(CallReply *rep) {
* callReplyGetPrivateData().
*
* NOTE: The parser used for parsing the reply and producing CallReply is
* designed to handle valid replies created by Redis itself. IT IS NOT
* designed to handle valid replies created by Redict itself. IT IS NOT
* DESIGNED TO HANDLE USER INPUT and using it to parse invalid replies is
* unsafe.
*/

View File

@ -705,7 +705,7 @@ int clusterSaveConfig(int do_fsync) {
if (do_fsync) {
server.cluster->todo_before_sleep &= ~CLUSTER_TODO_FSYNC_CONFIG;
if (redis_fsync(fd) == -1) {
if (redict_fsync(fd) == -1) {
serverLog(LL_WARNING,"Could not sync tmp cluster config file: %s",strerror(errno));
goto cleanup;
}
@ -861,7 +861,7 @@ void clusterUpdateMyselfIp(void) {
* duplicating the string. This way later we can check if
* the address really changed. */
prev_ip = zstrdup(prev_ip);
redis_strlcpy(myself->ip,server.cluster_announce_ip,NET_IP_STR_LEN);
redict_strlcpy(myself->ip,server.cluster_announce_ip,NET_IP_STR_LEN);
} else {
myself->ip[0] = '\0'; /* Force autodetection. */
}
@ -3497,7 +3497,7 @@ static void clusterBuildMessageHdr(clusterMsg *hdr, int type, size_t msglen) {
* first byte is zero, they'll do auto discovery. */
memset(hdr->myip,0,NET_IP_STR_LEN);
if (server.cluster_announce_ip) {
redis_strlcpy(hdr->myip,server.cluster_announce_ip,NET_IP_STR_LEN);
redict_strlcpy(hdr->myip,server.cluster_announce_ip,NET_IP_STR_LEN);
}
/* Handle cluster-announce-[tls-|bus-]port. */

View File

@ -1975,7 +1975,7 @@ static int enumConfigSet(standardConfig *config, sds *argv, int argc, const char
}
sdsrange(enumerr,0,-3); /* Remove final ", ". */
redis_strlcpy(loadbuf, enumerr, LOADBUF_SIZE);
redict_strlcpy(loadbuf, enumerr, LOADBUF_SIZE);
sdsfree(enumerr);
*err = loadbuf;

View File

@ -92,13 +92,13 @@
#endif
#endif
/* Define redis_fsync to fdatasync() in Linux and fsync() for all the rest */
/* Define redict_fsync to fdatasync() in Linux and fsync() for all the rest */
#if defined(__linux__)
#define redis_fsync(fd) fdatasync(fd)
#define redict_fsync(fd) fdatasync(fd)
#elif defined(__APPLE__)
#define redis_fsync(fd) fcntl(fd, F_FULLFSYNC)
#define redict_fsync(fd) fcntl(fd, F_FULLFSYNC)
#else
#define redis_fsync(fd) fsync(fd)
#define redict_fsync(fd) fsync(fd)
#endif
#if defined(__FreeBSD__)
@ -263,26 +263,26 @@ void setproctitle(const char *fmt, ...);
#define USE_ALIGNED_ACCESS
#endif
/* Define for redis_set_thread_title */
/* Define for redict_set_thread_title */
#ifdef __linux__
#define redis_set_thread_title(name) pthread_setname_np(pthread_self(), name)
#define redict_set_thread_title(name) pthread_setname_np(pthread_self(), name)
#else
#if (defined __FreeBSD__ || defined __OpenBSD__)
#include <pthread_np.h>
#define redis_set_thread_title(name) pthread_set_name_np(pthread_self(), name)
#define redict_set_thread_title(name) pthread_set_name_np(pthread_self(), name)
#elif defined __NetBSD__
#include <pthread.h>
#define redis_set_thread_title(name) pthread_setname_np(pthread_self(), "%s", name)
#define redict_set_thread_title(name) pthread_setname_np(pthread_self(), "%s", name)
#elif defined __HAIKU__
#include <kernel/OS.h>
#define redis_set_thread_title(name) rename_thread(find_thread(0), name)
#define redict_set_thread_title(name) rename_thread(find_thread(0), name)
#else
#if (defined __APPLE__ && defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
int pthread_setname_np(const char *name);
#include <pthread.h>
#define redis_set_thread_title(name) pthread_setname_np(name)
#define redict_set_thread_title(name) pthread_setname_np(name)
#else
#define redis_set_thread_title(name)
#define redict_set_thread_title(name)
#endif
#endif
#endif

View File

@ -9033,7 +9033,7 @@ int RM_GetClusterNodeInfo(RedisModuleCtx *ctx, const char *id, char *ip, char *m
return REDISMODULE_ERR;
}
if (ip) redis_strlcpy(ip, clusterNodeIp(node),NET_IP_STR_LEN);
if (ip) redict_strlcpy(ip, clusterNodeIp(node),NET_IP_STR_LEN);
if (master_id) {
/* If the information is not available, the function will set the
@ -12572,7 +12572,7 @@ int moduleVerifyResourceName(const char *name) {
static char configerr[CONFIG_ERR_SIZE];
static void propagateErrorString(RedisModuleString *err_in, const char **err) {
if (err_in) {
redis_strlcpy(configerr, err_in->ptr, CONFIG_ERR_SIZE);
redict_strlcpy(configerr, err_in->ptr, CONFIG_ERR_SIZE);
decrRefCount(err_in);
*err = configerr;
}

View File

@ -4203,7 +4203,7 @@ void *IOThreadMain(void *myid) {
char thdname[16];
snprintf(thdname, sizeof(thdname), "io_thd_%ld", id);
redis_set_thread_title(thdname);
redict_set_thread_title(thdname);
redictSetCpuAffinity(server.server_cpulist);
makeThreadKillable();

View File

@ -1592,7 +1592,7 @@ void rdbRemoveTempFile(pid_t childpid, int from_signal) {
/* Generate temp rdb file name using async-signal safe functions. */
ll2string(pid, sizeof(pid), childpid);
redis_strlcpy(tmpfile, "temp-", sizeof(tmpfile));
redict_strlcpy(tmpfile, "temp-", sizeof(tmpfile));
redis_strlcat(tmpfile, pid, sizeof(tmpfile));
redis_strlcat(tmpfile, ".rdb", sizeof(tmpfile));

View File

@ -273,7 +273,7 @@ static long getLongInfoField(char *info, char *field);
/*------------------------------------------------------------------------------
* Utility functions
*--------------------------------------------------------------------------- */
size_t redis_strlcpy(char *dst, const char *src, size_t dsize);
size_t redict_strlcpy(char *dst, const char *src, size_t dsize);
static void cliPushHandler(void *, void *);
@ -4020,7 +4020,7 @@ static int clusterManagerCheckRedisReply(clusterManagerNode *n,
if (is_err) {
if (err != NULL) {
*err = zmalloc((r->len + 1) * sizeof(char));
redis_strlcpy(*err, r->str,(r->len + 1));
redict_strlcpy(*err, r->str,(r->len + 1));
} else CLUSTER_MANAGER_PRINT_REPLY_ERROR(n, r->str);
}
return 0;
@ -4180,7 +4180,7 @@ static redisReply *clusterManagerGetNodeRedisInfo(clusterManagerNode *node,
if (info->type == REDIS_REPLY_ERROR) {
if (err != NULL) {
*err = zmalloc((info->len + 1) * sizeof(char));
redis_strlcpy(*err, info->str,(info->len + 1));
redict_strlcpy(*err, info->str,(info->len + 1));
}
freeReplyObject(info);
return NULL;
@ -4757,7 +4757,7 @@ static int clusterManagerSetSlot(clusterManagerNode *node1,
success = 0;
if (err != NULL) {
*err = zmalloc((reply->len + 1) * sizeof(char));
redis_strlcpy(*err, reply->str,(reply->len + 1));
redict_strlcpy(*err, reply->str,(reply->len + 1));
} else CLUSTER_MANAGER_PRINT_REPLY_ERROR(node1, reply->str);
goto cleanup;
}
@ -5031,7 +5031,7 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source,
success = 0;
if (err != NULL) {
*err = zmalloc((reply->len + 1) * sizeof(char));
redis_strlcpy(*err, reply->str,(reply->len + 1));
redict_strlcpy(*err, reply->str,(reply->len + 1));
CLUSTER_MANAGER_PRINT_REPLY_ERROR(source, *err);
}
goto next;
@ -5143,7 +5143,7 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source,
if (migrate_reply != NULL) {
if (err) {
*err = zmalloc((migrate_reply->len + 1) * sizeof(char));
redis_strlcpy(*err, migrate_reply->str, (migrate_reply->len + 1));
redict_strlcpy(*err, migrate_reply->str, (migrate_reply->len + 1));
}
printf("\n");
CLUSTER_MANAGER_PRINT_REPLY_ERROR(source,
@ -5260,7 +5260,7 @@ static int clusterManagerFlushNodeConfig(clusterManagerNode *node, char **err) {
if (reply == NULL || (is_err = (reply->type == REDIS_REPLY_ERROR))) {
if (is_err && err != NULL) {
*err = zmalloc((reply->len + 1) * sizeof(char));
redis_strlcpy(*err, reply->str, (reply->len + 1));
redict_strlcpy(*err, reply->str, (reply->len + 1));
}
success = 0;
/* If the cluster did not already joined it is possible that

View File

@ -110,7 +110,7 @@ static size_t rioFileWrite(rio *r, const void *buf, size_t len) {
return 0;
}
#else
if (redis_fsync(fileno(r->io.file.fp)) == -1) return 0;
if (redict_fsync(fileno(r->io.file.fp)) == -1) return 0;
#endif
if (r->io.file.reclaim_cache) {
/* In Linux sync_file_range just issue a writeback request to

View File

@ -22,8 +22,8 @@
extern char **environ;
#if USE_OPENSSL == 1 /* BUILD_YES */
extern SSL_CTX *redis_tls_ctx;
extern SSL_CTX *redis_tls_client_ctx;
extern SSL_CTX *redict_tls_ctx;
extern SSL_CTX *redict_tls_client_ctx;
#endif
#define REDICT_SENTINEL_PORT 26379
@ -2355,8 +2355,8 @@ void sentinelSetClientName(sentinelRedisInstance *ri, redisAsyncContext *c, char
static int instanceLinkNegotiateTLS(redisAsyncContext *context) {
#if USE_OPENSSL == 1 /* BUILD_YES */
if (!redis_tls_ctx) return C_ERR;
SSL *ssl = SSL_new(redis_tls_client_ctx ? redis_tls_client_ctx : redis_tls_ctx);
if (!redict_tls_ctx) return C_ERR;
SSL *ssl = SSL_new(redict_tls_client_ctx ? redict_tls_client_ctx : redict_tls_ctx);
if (!ssl) return C_ERR;
if (redisInitiateSSL(&context->c, ssl) == REDIS_ERR) {

View File

@ -245,7 +245,7 @@ void exitFromChild(int retcode) {
/*====================== Hash table type implementation ==================== */
/* This is a hash table type that uses the SDS dynamic strings library as
* keys and redis objects as values (objects can hold SDS strings,
* keys and redict objects as values (objects can hold SDS strings,
* lists, sets). */
void dictVanillaFree(dict *d, void *val)
@ -401,10 +401,10 @@ uint64_t dictEncObjHash(const void *key) {
}
/* Return 1 if currently we allow dict to expand. Dict may allocate huge
* memory to contain hash buckets when dict expands, that may lead redis
* memory to contain hash buckets when dict expands, that may lead redict
* rejects user's requests or evicts some keys, we can stop dict to expand
* provisionally if used memory will be over maxmemory after dict expands,
* but to guarantee the performance of redis, we still allow dict to expand
* but to guarantee the performance of redict, we still allow dict to expand
* if dict load factor exceeds HASHTABLE_MAX_LOAD_FACTOR. */
int dictResizeAllowed(size_t moreMem, double usedRatio) {
/* for debug purposes: dict is not allowed to be resized. */
@ -520,7 +520,7 @@ dictType sdsReplyDictType = {
NULL /* allow to expand */
};
/* Keylist hash table type has unencoded redis objects as keys and
/* Keylist hash table type has unencoded redict objects as keys and
* lists as values. It's used for blocking operations (BLPOP) and to
* map swapped keys to a list of clients waiting for this keys to be loaded. */
dictType keylistDictType = {
@ -533,7 +533,7 @@ dictType keylistDictType = {
NULL /* allow to expand */
};
/* KeyDict hash table type has unencoded redis objects as keys and
/* KeyDict hash table type has unencoded redict objects as keys and
* dicts as values. It's used for PUBSUB command to track clients subscribing the channels. */
dictType objToDictDictType = {
dictObjHash, /* hash function */
@ -2215,7 +2215,7 @@ int setOOMScoreAdj(int process_class) {
* when another configuration parameter was invalid and causes a rollback after
* applying a new oom-score) we can return to the oom-score value from before our
* adjustments. */
static int oom_score_adjusted_by_redis = 0;
static int oom_score_adjusted_by_redict = 0;
static int oom_score_adj_base = 0;
int fd;
@ -2223,8 +2223,8 @@ int setOOMScoreAdj(int process_class) {
char buf[64];
if (server.oom_score_adj != OOM_SCORE_ADJ_NO) {
if (!oom_score_adjusted_by_redis) {
oom_score_adjusted_by_redis = 1;
if (!oom_score_adjusted_by_redict) {
oom_score_adjusted_by_redict = 1;
/* Backup base value before enabling Redict control over oom score */
fd = open("/proc/self/oom_score_adj", O_RDONLY);
if (fd < 0 || read(fd, buf, sizeof(buf)) < 0) {
@ -2241,8 +2241,8 @@ int setOOMScoreAdj(int process_class) {
val += oom_score_adj_base;
if (val > 1000) val = 1000;
if (val < -1000) val = -1000;
} else if (oom_score_adjusted_by_redis) {
oom_score_adjusted_by_redis = 0;
} else if (oom_score_adjusted_by_redict) {
oom_score_adjusted_by_redict = 0;
val = oom_score_adj_base;
}
else {
@ -2888,7 +2888,7 @@ void populateCommandLegacyRangeSpec(struct redictCommand *c) {
memset(&c->legacy_range_key_spec, 0, sizeof(c->legacy_range_key_spec));
/* Set the movablekeys flag if we have a GETKEYS flag for modules.
* Note that for native redis commands, we always have keyspecs,
* Note that for native redict commands, we always have keyspecs,
* with enough information to rely on for movablekeys. */
if (c->flags & CMD_MODULE_GETKEYS)
c->flags |= CMD_MOVABLE_KEYS;
@ -2974,7 +2974,7 @@ void commandAddSubcommand(struct redictCommand *parent, struct redictCommand *su
}
/* Set implicit ACl categories (see comment above the definition of
* struct redisCommand). */
* struct redictCommand). */
void setImplicitACLCategories(struct redictCommand *c) {
if (c->flags & CMD_WRITE)
c->acl_categories |= ACL_CATEGORY_WRITE;
@ -3095,7 +3095,7 @@ void resetErrorTableStats(void) {
/* ========================== Redict OP Array API ============================ */
int redisOpArrayAppend(redictOpArray *oa, int dbid, robj **argv, int argc, int target) {
int redictOpArrayAppend(redictOpArray *oa, int dbid, robj **argv, int argc, int target) {
redictOp *op;
int prev_capacity = oa->capacity;
@ -3281,7 +3281,7 @@ static void propagateNow(int dbid, robj **argv, int argc, int target) {
* after the current command is propagated to AOF / Replication.
*
* dbid is the database ID the command should be propagated into.
* Arguments of the command to propagate are passed as an array of redis
* Arguments of the command to propagate are passed as an array of redict
* objects pointers of len 'argc', using the 'argv' vector.
*
* The function does not take a reference to the passed 'argv' vector,
@ -3300,7 +3300,7 @@ void alsoPropagate(int dbid, robj **argv, int argc, int target) {
argvcopy[j] = argv[j];
incrRefCount(argv[j]);
}
redisOpArrayAppend(&server.also_propagate,dbid,argvcopy,argc,target);
redictOpArrayAppend(&server.also_propagate,dbid,argvcopy,argc,target);
}
/* It is possible to call the function forceCommandPropagation() inside a
@ -4410,7 +4410,7 @@ int finishShutdown(void) {
* doing it's cleanup, but in this case this code will not be reached,
* so we need to call rdbRemoveTempFile which will close fd(in order
* to unlink file actually) in background thread.
* The temp rdb file fd may won't be closed when redis exits quickly,
* The temp rdb file fd may won't be closed when redict exits quickly,
* but OS will close this fd when process exits. */
rdbRemoveTempFile(server.child_pid, 0);
}
@ -4444,7 +4444,7 @@ int finishShutdown(void) {
/* Append only file: flush buffers and fsync() the AOF at exit */
serverLog(LL_NOTICE,"Calling fsync() on the AOF file.");
flushAppendOnlyFile(1);
if (redis_fsync(server.aof_fd) == -1) {
if (redict_fsync(server.aof_fd) == -1) {
serverLog(LL_WARNING,"Fail to fsync the AOF file: %s.",
strerror(errno));
}
@ -4677,7 +4677,7 @@ void addReplyFlagsForKeyArgs(client *c, uint64_t flags) {
addReplyCommandFlags(c, flags, docFlagNames);
}
/* Must match redisCommandArgType */
/* Must match redictCommandArgType */
const char *ARG_TYPE_STR[] = {
"string",
"integer",
@ -5382,7 +5382,7 @@ const char *getSafeInfoString(const char *s, size_t len, char **tmp) {
sizeof(unsafe_info_chars)-1);
}
sds genRedisInfoStringCommandStats(sds info, dict *commands) {
sds genRedictInfoStringCommandStats(sds info, dict *commands) {
struct redictCommand *c;
dictEntry *de;
dictIterator *di;
@ -5400,7 +5400,7 @@ sds genRedisInfoStringCommandStats(sds info, dict *commands) {
if (tmpsafe != NULL) zfree(tmpsafe);
}
if (c->subcommands_dict) {
info = genRedisInfoStringCommandStats(info, c->subcommands_dict);
info = genRedictInfoStringCommandStats(info, c->subcommands_dict);
}
}
dictReleaseIterator(di);
@ -5422,7 +5422,7 @@ sds genRedictInfoStringACLStats(sds info) {
return info;
}
sds genRedisInfoStringLatencyStats(sds info, dict *commands) {
sds genRedictInfoStringLatencyStats(sds info, dict *commands) {
struct redictCommand *c;
dictEntry *de;
dictIterator *di;
@ -5437,7 +5437,7 @@ sds genRedisInfoStringLatencyStats(sds info, dict *commands) {
if (tmpsafe != NULL) zfree(tmpsafe);
}
if (c->subcommands_dict) {
info = genRedisInfoStringLatencyStats(info, c->subcommands_dict);
info = genRedictInfoStringLatencyStats(info, c->subcommands_dict);
}
}
dictReleaseIterator(di);
@ -5463,7 +5463,7 @@ void releaseInfoSectionDict(dict *sec) {
dictRelease(sec);
}
/* Create a dictionary with unique section names to be used by genRedisInfoString.
/* Create a dictionary with unique section names to be used by genRedictInfoString.
* 'argv' and 'argc' are list of arguments for INFO.
* 'defaults' is an optional null terminated list of default sections.
* 'out_all' and 'out_everything' are optional.
@ -6039,7 +6039,7 @@ sds genRedictInfoString(dict *section_dict, int all_sections, int everything) {
if (all_sections || (dictFind(section_dict,"commandstats") != NULL)) {
if (sections++) info = sdscat(info,"\r\n");
info = sdscatprintf(info, "# Commandstats\r\n");
info = genRedisInfoStringCommandStats(info, server.commands);
info = genRedictInfoStringCommandStats(info, server.commands);
}
/* Error statistics */
@ -6066,7 +6066,7 @@ sds genRedictInfoString(dict *section_dict, int all_sections, int everything) {
if (sections++) info = sdscat(info,"\r\n");
info = sdscatprintf(info, "# Latencystats\r\n");
if (server.latency_tracking_enabled) {
info = genRedisInfoStringLatencyStats(info, server.commands);
info = genRedictInfoStringLatencyStats(info, server.commands);
}
}
@ -6273,7 +6273,7 @@ void usage(void) {
exit(1);
}
void redisAsciiArt(void) {
void redictAsciiArt(void) {
#include "asciilogo.h"
char *buf = zmalloc(1024*16);
char *mode;
@ -6671,7 +6671,7 @@ void loadDataFromDisk(void) {
}
}
void redisOutOfMemoryHandler(size_t allocation_size) {
void redictOutOfMemoryHandler(size_t allocation_size) {
serverLog(LL_WARNING,"Out Of Memory allocating %zu bytes!",
allocation_size);
serverPanic("Redict aborting for OUT OF MEMORY. Allocating %zu bytes!",
@ -6681,7 +6681,7 @@ void redisOutOfMemoryHandler(size_t allocation_size) {
/* Callback for sdstemplate on proc-title-template. See redict.conf for
* supported variables.
*/
static sds redisProcTitleGetVariable(const sds varname, void *arg)
static sds redictProcTitleGetVariable(const sds varname, void *arg)
{
if (!strcmp(varname, "title")) {
return sdsnew(arg);
@ -6711,7 +6711,7 @@ static sds redisProcTitleGetVariable(const sds varname, void *arg)
/* Expand the specified proc-title-template string and return a newly
* allocated sds, or NULL. */
static sds expandProcTitleTemplate(const char *template, const char *title) {
sds res = sdstemplate(template, redisProcTitleGetVariable, (void *) title);
sds res = sdstemplate(template, redictProcTitleGetVariable, (void *) title);
if (!res)
return NULL;
return sdstrim(res, " ");
@ -6768,7 +6768,7 @@ int redictCommunicateSystemd(const char *sd_notify_msg) {
}
/* Attempt to set up upstart supervision. Returns 1 if successful. */
static int redisSupervisedUpstart(void) {
static int redictSupervisedUpstart(void) {
const char *upstart_job = getenv("UPSTART_JOB");
if (!upstart_job) {
@ -6784,13 +6784,13 @@ static int redisSupervisedUpstart(void) {
}
/* Attempt to set up systemd supervision. Returns 1 if successful. */
static int redisSupervisedSystemd(void) {
static int redictSupervisedSystemd(void) {
#ifndef HAVE_LIBSYSTEMD
serverLog(LL_WARNING,
"systemd supervision requested or auto-detected, but Redict is compiled without libsystemd support!");
return 0;
#else
if (redisCommunicateSystemd("STATUS=Redict is loading...\n") <= 0)
if (redictCommunicateSystemd("STATUS=Redict is loading...\n") <= 0)
return 0;
serverLog(LL_NOTICE,
"Supervised by systemd. Please make sure you set appropriate values for TimeoutStartSec and TimeoutStopSec in your service unit.");
@ -6798,7 +6798,7 @@ static int redisSupervisedSystemd(void) {
#endif
}
int redisIsSupervised(int mode) {
int redictIsSupervised(int mode) {
int ret = 0;
if (mode == SUPERVISED_AUTODETECT) {
@ -6813,10 +6813,10 @@ int redisIsSupervised(int mode) {
switch (mode) {
case SUPERVISED_UPSTART:
ret = redisSupervisedUpstart();
ret = redictSupervisedUpstart();
break;
case SUPERVISED_SYSTEMD:
ret = redisSupervisedSystemd();
ret = redictSupervisedSystemd();
break;
default:
break;
@ -6926,7 +6926,7 @@ int main(int argc, char **argv) {
spt_init(argc, argv);
#endif
tzset(); /* Populates 'timezone' global. */
zmalloc_set_oom_handler(redisOutOfMemoryHandler);
zmalloc_set_oom_handler(redictOutOfMemoryHandler);
/* To achieve entropy, in case of containers, their time() and getpid() can
* be the same. But value of tv_usec is fast enough to make the difference */
@ -7126,7 +7126,7 @@ int main(int argc, char **argv) {
#endif /* __linux__ */
/* Daemonize if needed */
server.supervised = redisIsSupervised(server.supervised_mode);
server.supervised = redictIsSupervised(server.supervised_mode);
int background = server.daemonize && !server.supervised;
if (background) daemonize();
@ -7148,7 +7148,7 @@ int main(int argc, char **argv) {
initServer();
if (background || server.pidfile) createPidFile();
if (server.set_proc_title) redictSetProcTitle(NULL);
redisAsciiArt();
redictAsciiArt();
checkTcpBacklogSettings();
if (server.cluster_enabled) {
clusterInit();

View File

@ -13,7 +13,7 @@
* Returns strlen(src); if retval >= dsize, truncation occurred.
*/
size_t
redis_strlcpy(char *dst, const char *src, size_t dsize)
redict_strlcpy(char *dst, const char *src, size_t dsize)
{
const char *osrc = src;
size_t nleft = dsize;

View File

@ -5,7 +5,7 @@
// SPDX-License-Identifier: BSD-3-Clause
// SPDX-License-Identifier: GPL-3.0-only
#define REDISMODULE_CORE_MODULE /* A module that's part of the redis core, uses server.h too. */
#define REDISMODULE_CORE_MODULE /* A module that's part of the redict core, uses server.h too. */
#include "server.h"
#include "connhelpers.h"
@ -36,8 +36,8 @@
#define REDICT_TLS_PROTO_DEFAULT (REDICT_TLS_PROTO_TLSv1_2)
#endif
SSL_CTX *redis_tls_ctx = NULL;
SSL_CTX *redis_tls_client_ctx = NULL;
SSL_CTX *redict_tls_ctx = NULL;
SSL_CTX *redict_tls_client_ctx = NULL;
static int parseProtocolsConfig(const char *str) {
int i, count = 0;
@ -148,13 +148,13 @@ static void tlsInit(void) {
}
static void tlsCleanup(void) {
if (redis_tls_ctx) {
SSL_CTX_free(redis_tls_ctx);
redis_tls_ctx = NULL;
if (redict_tls_ctx) {
SSL_CTX_free(redict_tls_ctx);
redict_tls_ctx = NULL;
}
if (redis_tls_client_ctx) {
SSL_CTX_free(redis_tls_client_ctx);
redis_tls_client_ctx = NULL;
if (redict_tls_client_ctx) {
SSL_CTX_free(redict_tls_client_ctx);
redict_tls_client_ctx = NULL;
}
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
@ -181,7 +181,7 @@ static int tlsPasswordCallback(char *buf, int size, int rwflag, void *u) {
/* Create a *base* SSL_CTX using the SSL configuration provided. The base context
* includes everything that's common for both client-side and server-side connections.
*/
static SSL_CTX *createSSLContext(redisTLSContextConfig *ctx_config, int protocols, int client) {
static SSL_CTX *createSSLContext(redictTLSContextConfig *ctx_config, int protocols, int client) {
const char *cert_file = client ? ctx_config->client_cert_file : ctx_config->cert_file;
const char *key_file = client ? ctx_config->client_key_file : ctx_config->key_file;
const char *key_file_pass = client ? ctx_config->client_key_file_pass : ctx_config->key_file_pass;
@ -260,17 +260,17 @@ error:
/* Attempt to configure/reconfigure TLS. This operation is atomic and will
* leave the SSL_CTX unchanged if fails.
* @priv: config of redisTLSContextConfig.
* @priv: config of redictTLSContextConfig.
* @reconfigure: if true, ignore the previous configure; if false, only
* configure from @ctx_config if redis_tls_ctx is NULL.
* configure from @ctx_config if redict_tls_ctx is NULL.
*/
static int tlsConfigure(void *priv, int reconfigure) {
redisTLSContextConfig *ctx_config = (redisTLSContextConfig *)priv;
redictTLSContextConfig *ctx_config = (redictTLSContextConfig *)priv;
char errbuf[256];
SSL_CTX *ctx = NULL;
SSL_CTX *client_ctx = NULL;
if (!reconfigure && redis_tls_ctx) {
if (!reconfigure && redict_tls_ctx) {
return C_OK;
}
@ -380,10 +380,10 @@ static int tlsConfigure(void *priv, int reconfigure) {
if (!client_ctx) goto error;
}
SSL_CTX_free(redis_tls_ctx);
SSL_CTX_free(redis_tls_client_ctx);
redis_tls_ctx = ctx;
redis_tls_client_ctx = client_ctx;
SSL_CTX_free(redict_tls_ctx);
SSL_CTX_free(redict_tls_client_ctx);
redict_tls_ctx = ctx;
redict_tls_client_ctx = client_ctx;
return C_OK;
@ -435,9 +435,9 @@ typedef struct tls_connection {
} tls_connection;
static connection *createTLSConnection(int client_side) {
SSL_CTX *ctx = redis_tls_ctx;
if (client_side && redis_tls_client_ctx)
ctx = redis_tls_client_ctx;
SSL_CTX *ctx = redict_tls_ctx;
if (client_side && redict_tls_client_ctx)
ctx = redict_tls_client_ctx;
tls_connection *conn = zcalloc(sizeof(tls_connection));
conn->c.type = &CT_TLS;
conn->c.fd = -1;

View File

@ -1139,7 +1139,7 @@ int fsyncFileDir(const char *filename) {
}
/* Some OSs don't allow us to fsync directories at all, so we can ignore
* those errors. */
if (redis_fsync(dir_fd) == -1 && !(errno == EBADF || errno == EINVAL)) {
if (redict_fsync(dir_fd) == -1 && !(errno == EBADF || errno == EINVAL)) {
int save_errno = errno;
close(dir_fd);
errno = save_errno;
@ -1598,7 +1598,7 @@ static void test_reclaimFilePageCache(void) {
char buf[4] = "foo";
assert(write(fd, buf, sizeof(buf)) > 0);
assert(cache_exist(fd));
assert(redis_fsync(fd) == 0);
assert(redict_fsync(fd) == 0);
assert(reclaimFilePageCache(fd, 0, 0) == 0);
assert(!cache_exist(fd));

View File

@ -75,7 +75,7 @@ int snprintf_async_signal_safe(char *to, size_t n, const char *fmt, ...)
#else
int snprintf_async_signal_safe(char *to, size_t n, const char *fmt, ...);
#endif
size_t redis_strlcpy(char *dst, const char *src, size_t dsize);
size_t redict_strlcpy(char *dst, const char *src, size_t dsize);
size_t redis_strlcat(char *dst, const char *src, size_t dsize);
#ifdef REDICT_TEST