mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
all: rename defines
This commit is contained in:
parent
04036567cc
commit
3fe17f47ba
@ -14,8 +14,8 @@ Redict is a free software key/value database based on Redis.
|
||||
* [ ] Fork Redis modules API
|
||||
* [ ] Rename Lua API symbols (w/compat shim)
|
||||
* [ ] Update strings (in progress...)
|
||||
* [ ] Update symbols
|
||||
* [ ] Update comments et al
|
||||
* [ ] Update symbols (in progress...)
|
||||
* [ ] Update comments et al (in progress...)
|
||||
* [ ] Update documentation
|
||||
* [ ] Write migration guide
|
||||
* [ ] Create website
|
||||
|
@ -2345,7 +2345,7 @@ int rewriteAppendOnlyFile(char *filename) {
|
||||
rioInitWithFile(&aof,fp);
|
||||
|
||||
if (server.aof_rewrite_incremental_fsync) {
|
||||
rioSetAutoSync(&aof,REDIS_AUTOSYNC_BYTES);
|
||||
rioSetAutoSync(&aof,REDICT_AUTOSYNC_BYTES);
|
||||
rioSetReclaimCache(&aof,1);
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@
|
||||
atomic_store_explicit(&var,value,memory_order_seq_cst)
|
||||
#define atomicFlagGetSet(var,oldvalue_var) \
|
||||
oldvalue_var = atomic_exchange_explicit(&var,1,memory_order_relaxed)
|
||||
#define REDIS_ATOMIC_API "c11-builtin"
|
||||
#define REDICT_ATOMIC_API "c11-builtin"
|
||||
|
||||
#elif !defined(__ATOMIC_VAR_FORCE_SYNC_MACROS) && \
|
||||
(!defined(__clang__) || !defined(__APPLE__) || __apple_build_version__ > 4210057) && \
|
||||
@ -88,7 +88,7 @@
|
||||
__atomic_store_n(&var,value,__ATOMIC_SEQ_CST)
|
||||
#define atomicFlagGetSet(var,oldvalue_var) \
|
||||
oldvalue_var = __atomic_exchange_n(&var,1,__ATOMIC_RELAXED)
|
||||
#define REDIS_ATOMIC_API "atomic-builtin"
|
||||
#define REDICT_ATOMIC_API "atomic-builtin"
|
||||
|
||||
#elif defined(HAVE_ATOMIC)
|
||||
/* Implementation using __sync macros. */
|
||||
@ -117,7 +117,7 @@
|
||||
} while(0)
|
||||
#define atomicFlagGetSet(var,oldvalue_var) \
|
||||
oldvalue_var = __sync_val_compare_and_swap(&var,0,1)
|
||||
#define REDIS_ATOMIC_API "sync-builtin"
|
||||
#define REDICT_ATOMIC_API "sync-builtin"
|
||||
|
||||
#else
|
||||
#error "Unable to determine atomic operations for your platform"
|
||||
|
@ -58,7 +58,7 @@ void *bioProcessBackgroundJobs(void *arg);
|
||||
|
||||
/* Make sure we have enough stack to perform all the things we do in the
|
||||
* main thread. */
|
||||
#define REDIS_THREAD_STACK_SIZE (1024*1024*4)
|
||||
#define REDICT_THREAD_STACK_SIZE (1024*1024*4)
|
||||
|
||||
/* Initialize the background system, spawning the thread. */
|
||||
void bioInit(void) {
|
||||
@ -78,7 +78,7 @@ void bioInit(void) {
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_getstacksize(&attr,&stacksize);
|
||||
if (!stacksize) stacksize = 1; /* The world is full of Solaris Fixes */
|
||||
while (stacksize < REDIS_THREAD_STACK_SIZE) stacksize *= 2;
|
||||
while (stacksize < REDICT_THREAD_STACK_SIZE) stacksize *= 2;
|
||||
pthread_attr_setstacksize(&attr, stacksize);
|
||||
|
||||
/* Ready to spawn our threads. We use the single argument the thread
|
||||
|
@ -580,7 +580,7 @@ void getbitCommand(client *c) {
|
||||
}
|
||||
|
||||
/* BITOP op_name target_key src_key1 src_key2 src_key3 ... src_keyN */
|
||||
REDIS_NO_SANITIZE("alignment")
|
||||
REDICT_NO_SANITIZE("alignment")
|
||||
void bitopCommand(client *c) {
|
||||
char *opname = c->argv[1]->ptr;
|
||||
robj *o, *targetkey = c->argv[2];
|
||||
|
@ -8,8 +8,8 @@
|
||||
* It contains alternative structs which omit the parts of the commands table
|
||||
* that are not suitable for redict-cli, e.g. the command proc. */
|
||||
|
||||
#ifndef __REDIS_CLI_COMMANDS_H
|
||||
#define __REDIS_CLI_COMMANDS_H
|
||||
#ifndef __REDICT_CLI_COMMANDS_H
|
||||
#define __REDICT_CLI_COMMANDS_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include "commands.h"
|
||||
|
@ -3735,7 +3735,7 @@ void clusterBroadcastPong(int target) {
|
||||
* As all the struct is used as a buffer, when more than 8 bytes are copied into
|
||||
* the 'bulk_data', sanitizer generates an out-of-bounds error which is a false
|
||||
* positive in this context. */
|
||||
REDIS_NO_SANITIZE("bounds")
|
||||
REDICT_NO_SANITIZE("bounds")
|
||||
clusterMsgSendBlock *clusterCreatePublishMsgBlock(robj *channel, robj *message, uint16_t type) {
|
||||
|
||||
uint32_t channel_len, message_len;
|
||||
|
@ -4,8 +4,8 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#ifndef __REDIS_COMMANDS_H
|
||||
#define __REDIS_COMMANDS_H
|
||||
#ifndef __REDICT_COMMANDS_H
|
||||
#define __REDICT_COMMANDS_H
|
||||
|
||||
/* Must be synced with ARG_TYPE_STR and generate-command-code.py */
|
||||
typedef enum {
|
||||
|
@ -996,7 +996,7 @@ void configGetCommand(client *c) {
|
||||
* CONFIG REWRITE implementation
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#define REDIS_CONFIG_REWRITE_SIGNATURE "# Generated by CONFIG REWRITE"
|
||||
#define REDICT_CONFIG_REWRITE_SIGNATURE "# Generated by CONFIG REWRITE"
|
||||
|
||||
/* We use the following dictionary type to store where a configuration
|
||||
* option is mentioned in the old configuration file, so it's
|
||||
@ -1137,7 +1137,7 @@ struct rewriteConfigState *rewriteConfigReadOldFile(char *path) {
|
||||
|
||||
/* Handle comments and empty lines. */
|
||||
if (line[0] == '#' || line[0] == '\0') {
|
||||
if (state->needs_signature && !strcmp(line,REDIS_CONFIG_REWRITE_SIGNATURE))
|
||||
if (state->needs_signature && !strcmp(line,REDICT_CONFIG_REWRITE_SIGNATURE))
|
||||
state->needs_signature = 0;
|
||||
rewriteConfigAppendLine(state,line);
|
||||
continue;
|
||||
@ -1242,7 +1242,7 @@ int rewriteConfigRewriteLine(struct rewriteConfigState *state, const char *optio
|
||||
/* Append a new line. */
|
||||
if (state->needs_signature) {
|
||||
rewriteConfigAppendLine(state,
|
||||
sdsnew(REDIS_CONFIG_REWRITE_SIGNATURE));
|
||||
sdsnew(REDICT_CONFIG_REWRITE_SIGNATURE));
|
||||
state->needs_signature = 0;
|
||||
}
|
||||
rewriteConfigAppendLine(state,line);
|
||||
|
@ -131,11 +131,11 @@
|
||||
|
||||
#if defined(__has_attribute)
|
||||
#if __has_attribute(no_sanitize)
|
||||
#define REDIS_NO_SANITIZE(sanitizer) __attribute__((no_sanitize(sanitizer)))
|
||||
#define REDICT_NO_SANITIZE(sanitizer) __attribute__((no_sanitize(sanitizer)))
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(REDIS_NO_SANITIZE)
|
||||
#define REDIS_NO_SANITIZE(sanitizer)
|
||||
#if !defined(REDICT_NO_SANITIZE)
|
||||
#define REDICT_NO_SANITIZE(sanitizer)
|
||||
#endif
|
||||
|
||||
/* Define rdb_fsync_range to sync_file_range() on Linux, otherwise we use
|
||||
|
@ -5,8 +5,8 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#ifndef __REDIS_CONNECTION_H
|
||||
#define __REDIS_CONNECTION_H
|
||||
#ifndef __REDICT_CONNECTION_H
|
||||
#define __REDICT_CONNECTION_H
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
@ -427,4 +427,4 @@ static inline int connIsTLS(connection *conn) {
|
||||
return conn && conn->type == connectionTypeTls();
|
||||
}
|
||||
|
||||
#endif /* __REDIS_CONNECTION_H */
|
||||
#endif /* __REDICT_CONNECTION_H */
|
||||
|
@ -5,8 +5,8 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#ifndef __REDIS_CONNHELPERS_H
|
||||
#define __REDIS_CONNHELPERS_H
|
||||
#ifndef __REDICT_CONNHELPERS_H
|
||||
#define __REDICT_CONNHELPERS_H
|
||||
|
||||
#include "connection.h"
|
||||
|
||||
@ -62,4 +62,4 @@ static inline int callHandler(connection *conn, ConnectionCallbackFunc handler)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* __REDIS_CONNHELPERS_H */
|
||||
#endif /* __REDICT_CONNHELPERS_H */
|
||||
|
@ -103,7 +103,7 @@ uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l) {
|
||||
}
|
||||
|
||||
/* Test main */
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
#include <stdio.h>
|
||||
|
||||
#define UNUSED(x) (void)(x)
|
||||
@ -133,7 +133,7 @@ int crc64Test(int argc, char *argv[], int flags) {
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef REDIS_TEST_MAIN
|
||||
#ifdef REDICT_TEST_MAIN
|
||||
int main(int argc, char *argv[]) {
|
||||
return crc64Test(argc, argv);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
void crc64_init(void);
|
||||
uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l);
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
int crc64Test(int argc, char *argv[], int flags);
|
||||
#endif
|
||||
|
||||
|
@ -1238,7 +1238,7 @@ static void* getAndSetMcontextEip(ucontext_t *uc, void *eip) {
|
||||
#undef NOT_SUPPORTED
|
||||
}
|
||||
|
||||
REDIS_NO_SANITIZE("address")
|
||||
REDICT_NO_SANITIZE("address")
|
||||
void logStackContent(void **sp) {
|
||||
int i;
|
||||
for (i = 15; i >= 0; i--) {
|
||||
|
@ -5,8 +5,8 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#ifndef _REDIS_DEBUGMACRO_H_
|
||||
#define _REDIS_DEBUGMACRO_H_
|
||||
#ifndef _REDICT_DEBUGMACRO_H_
|
||||
#define _REDICT_DEBUGMACRO_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#define D(...) \
|
||||
@ -18,4 +18,4 @@
|
||||
fclose(fp); \
|
||||
} while (0)
|
||||
|
||||
#endif /* _REDIS_DEBUGMACRO_H_ */
|
||||
#endif /* _REDICT_DEBUGMACRO_H_ */
|
||||
|
@ -1727,7 +1727,7 @@ void dictGetStats(char *buf, size_t bufsize, dict *d, int full) {
|
||||
|
||||
/* ------------------------------- Benchmark ---------------------------------*/
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
#include "testhelp.h"
|
||||
|
||||
#define UNUSED(V) ((void) V)
|
||||
@ -1789,7 +1789,7 @@ int dictTest(int argc, char **argv, int flags) {
|
||||
dict *dict = dictCreate(&BenchmarkDictType);
|
||||
long count = 0;
|
||||
unsigned long new_dict_size, current_dict_used, remain_keys;
|
||||
int accurate = (flags & REDIS_TEST_ACCURATE);
|
||||
int accurate = (flags & REDICT_TEST_ACCURATE);
|
||||
|
||||
if (argc == 4) {
|
||||
if (accurate) {
|
||||
|
@ -221,7 +221,7 @@ dictStats* dictGetStatsHt(dict *d, int htidx, int full);
|
||||
void dictCombineStats(dictStats *from, dictStats *into);
|
||||
void dictFreeStats(dictStats *stats);
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
int dictTest(int argc, char *argv[], int flags);
|
||||
#endif
|
||||
|
||||
|
@ -64,7 +64,7 @@ uint64_t intrev64(uint64_t v) {
|
||||
return v;
|
||||
}
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
#include <stdio.h>
|
||||
|
||||
#define UNUSED(x) (void)(x)
|
||||
|
@ -46,7 +46,7 @@ uint64_t intrev64(uint64_t v);
|
||||
#define ntohu64(v) intrev64(v)
|
||||
#endif
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
int endianconvTest(int argc, char *argv[], int flags);
|
||||
#endif
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#ifndef _REDIS_FMACRO_H
|
||||
#define _REDIS_FMACRO_H
|
||||
#ifndef _REDICT_FMACRO_H
|
||||
#define _REDICT_FMACRO_H
|
||||
|
||||
#define _BSD_SOURCE
|
||||
|
||||
|
@ -417,7 +417,7 @@ int luaEngineInitEngine(void) {
|
||||
luaRegisterVersion(lua_engine_ctx->lua);
|
||||
|
||||
luaSetErrorMetatable(lua_engine_ctx->lua);
|
||||
lua_setfield(lua_engine_ctx->lua, -2, REDIS_API_NAME);
|
||||
lua_setfield(lua_engine_ctx->lua, -2, REDICT_API_NAME);
|
||||
|
||||
luaSetErrorMetatable(lua_engine_ctx->lua);
|
||||
luaSetTableProtectionRecursively(lua_engine_ctx->lua); /* protect load library globals */
|
||||
|
@ -369,7 +369,7 @@ static char *invalid_hll_err = "-INVALIDOBJ Corrupted HLL object detected";
|
||||
/* Our hash function is MurmurHash2, 64 bit version.
|
||||
* It was modified for Redis in order to provide the same result in
|
||||
* big and little endian archs (endian neutral). */
|
||||
REDIS_NO_SANITIZE("alignment")
|
||||
REDICT_NO_SANITIZE("alignment")
|
||||
uint64_t MurmurHash64A (const void * key, int len, unsigned int seed) {
|
||||
const uint64_t m = 0xc6a4a7935bd1e995;
|
||||
const int r = 47;
|
||||
|
@ -320,7 +320,7 @@ int intsetValidateIntegrity(const unsigned char *p, size_t size, int deep) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
|
@ -28,7 +28,7 @@ uint32_t intsetLen(const intset *is);
|
||||
size_t intsetBlobLen(intset *is);
|
||||
int intsetValidateIntegrity(const unsigned char *is, size_t size, int deep);
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
int intsetTest(int argc, char *argv[], int flags);
|
||||
#endif
|
||||
|
||||
|
@ -835,7 +835,7 @@ int kvstoreDictDelete(kvstore *kvs, int didx, const void *key) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
#include <stdio.h>
|
||||
#include "testhelp.h"
|
||||
|
||||
|
@ -78,7 +78,7 @@ dictEntry *kvstoreDictTwoPhaseUnlinkFind(kvstore *kvs, int didx, const void *key
|
||||
void kvstoreDictTwoPhaseUnlinkFree(kvstore *kvs, int didx, dictEntry *he, dictEntry **plink, int table_index);
|
||||
int kvstoreDictDelete(kvstore *kvs, int didx, const void *key);
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
int kvstoreTest(int argc, char *argv[], int flags);
|
||||
#endif
|
||||
|
||||
|
@ -1652,7 +1652,7 @@ void lpRepr(unsigned char *lp) {
|
||||
printf("{end}\n\n");
|
||||
}
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
|
||||
#include <sys/time.h>
|
||||
#include "adlist.h"
|
||||
@ -1790,7 +1790,7 @@ int listpackTest(int argc, char *argv[], int flags) {
|
||||
unsigned char *lp, *p, *vstr;
|
||||
int64_t vlen;
|
||||
unsigned char intbuf[LP_INTBUF_SIZE];
|
||||
int accurate = (flags & REDIS_TEST_ACCURATE);
|
||||
int accurate = (flags & REDICT_TEST_ACCURATE);
|
||||
|
||||
TEST("Create int list") {
|
||||
lp = createIntList();
|
||||
|
@ -72,7 +72,7 @@ unsigned char *lpNextRandom(unsigned char *lp, unsigned char *p, unsigned int *i
|
||||
int lpSafeToAdd(unsigned char* lp, size_t add);
|
||||
void lpRepr(unsigned char *lp);
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
int listpackTest(int argc, char *argv[], int flags);
|
||||
#endif
|
||||
|
||||
|
@ -12,9 +12,9 @@ fi
|
||||
test -f release.h || touch release.h
|
||||
(cat release.h | grep SHA1 | grep $GIT_SHA1) && \
|
||||
(cat release.h | grep DIRTY | grep $GIT_DIRTY) && exit 0 # Already up-to-date
|
||||
echo "#define REDIS_GIT_SHA1 \"$GIT_SHA1\"" > release.h
|
||||
echo "#define REDIS_GIT_DIRTY \"$GIT_DIRTY\"" >> release.h
|
||||
echo "#define REDIS_BUILD_ID \"$BUILD_ID\"" >> release.h
|
||||
echo "#define REDICT_GIT_SHA1 \"$GIT_SHA1\"" > release.h
|
||||
echo "#define REDICT_GIT_DIRTY \"$GIT_DIRTY\"" >> release.h
|
||||
echo "#define REDICT_BUILD_ID \"$BUILD_ID\"" >> release.h
|
||||
echo "#include \"version.h\"" >> release.h
|
||||
echo "#define REDIS_BUILD_ID_RAW REDICT_VERSION REDIS_BUILD_ID REDIS_GIT_DIRTY REDIS_GIT_SHA1" >> release.h
|
||||
echo "#define REDICT_BUILD_ID_RAW REDICT_VERSION REDICT_BUILD_ID REDICT_GIT_DIRTY REDICT_GIT_SHA1" >> release.h
|
||||
touch release.c # Force recompile of release.c
|
||||
|
@ -305,7 +305,7 @@ int prepareClientToWrite(client *c) {
|
||||
* Sanitizer suppression: client->buf_usable_size determined by
|
||||
* zmalloc_usable_size() call. Writing beyond client->buf boundaries confuses
|
||||
* sanitizer and generates a false positive out-of-bounds error */
|
||||
REDIS_NO_SANITIZE("bounds")
|
||||
REDICT_NO_SANITIZE("bounds")
|
||||
size_t _addReplyToBuffer(client *c, const char *s, size_t len) {
|
||||
size_t available = c->buf_usable_size - c->bufpos;
|
||||
|
||||
|
12
src/object.c
12
src/object.c
@ -710,11 +710,11 @@ robj *getDecodedObject(robj *o) {
|
||||
* use ll2string() to get a string representation of the numbers on the stack
|
||||
* and compare the strings, it's much faster than calling getDecodedObject().
|
||||
*
|
||||
* Important note: when REDIS_COMPARE_BINARY is used a binary-safe comparison
|
||||
* Important note: when REDICT_COMPARE_BINARY is used a binary-safe comparison
|
||||
* is used. */
|
||||
|
||||
#define REDIS_COMPARE_BINARY (1<<0)
|
||||
#define REDIS_COMPARE_COLL (1<<1)
|
||||
#define REDICT_COMPARE_BINARY (1<<0)
|
||||
#define REDICT_COMPARE_COLL (1<<1)
|
||||
|
||||
int compareStringObjectsWithFlags(const robj *a, const robj *b, int flags) {
|
||||
serverAssertWithInfo(NULL,a,a->type == OBJ_STRING && b->type == OBJ_STRING);
|
||||
@ -736,7 +736,7 @@ int compareStringObjectsWithFlags(const robj *a, const robj *b, int flags) {
|
||||
blen = ll2string(bufb,sizeof(bufb),(long) b->ptr);
|
||||
bstr = bufb;
|
||||
}
|
||||
if (flags & REDIS_COMPARE_COLL) {
|
||||
if (flags & REDICT_COMPARE_COLL) {
|
||||
return strcoll(astr,bstr);
|
||||
} else {
|
||||
int cmp;
|
||||
@ -750,12 +750,12 @@ int compareStringObjectsWithFlags(const robj *a, const robj *b, int flags) {
|
||||
|
||||
/* Wrapper for compareStringObjectsWithFlags() using binary comparison. */
|
||||
int compareStringObjects(const robj *a, const robj *b) {
|
||||
return compareStringObjectsWithFlags(a,b,REDIS_COMPARE_BINARY);
|
||||
return compareStringObjectsWithFlags(a,b,REDICT_COMPARE_BINARY);
|
||||
}
|
||||
|
||||
/* Wrapper for compareStringObjectsWithFlags() using collation. */
|
||||
int collateStringObjects(const robj *a, const robj *b) {
|
||||
return compareStringObjectsWithFlags(a,b,REDIS_COMPARE_COLL);
|
||||
return compareStringObjectsWithFlags(a,b,REDICT_COMPARE_COLL);
|
||||
}
|
||||
|
||||
/* Equal string objects return 1 if the two objects are the same from the
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include "lzf.h"
|
||||
#include "redictassert.h"
|
||||
|
||||
#ifndef REDIS_STATIC
|
||||
#define REDIS_STATIC static
|
||||
#ifndef REDICT_STATIC
|
||||
#define REDICT_STATIC static
|
||||
#endif
|
||||
|
||||
/* Optimization levels for size-based filling.
|
||||
@ -60,7 +60,7 @@ int quicklistSetPackedThreshold(size_t sz) {
|
||||
#define MIN_COMPRESS_IMPROVE 8
|
||||
|
||||
/* If not verbose testing, remove all debug printing. */
|
||||
#ifndef REDIS_TEST_VERBOSE
|
||||
#ifndef REDICT_TEST_VERBOSE
|
||||
#define D(...)
|
||||
#else
|
||||
#define D(...) \
|
||||
@ -77,8 +77,8 @@ quicklistBookmark *_quicklistBookmarkFindByName(quicklist *ql, const char *name)
|
||||
quicklistBookmark *_quicklistBookmarkFindByNode(quicklist *ql, quicklistNode *node);
|
||||
void _quicklistBookmarkDelete(quicklist *ql, quicklistBookmark *bm);
|
||||
|
||||
REDIS_STATIC quicklistNode *_quicklistSplitNode(quicklistNode *node, int offset, int after);
|
||||
REDIS_STATIC quicklistNode *_quicklistMergeNodes(quicklist *quicklist, quicklistNode *center);
|
||||
REDICT_STATIC quicklistNode *_quicklistSplitNode(quicklistNode *node, int offset, int after);
|
||||
REDICT_STATIC quicklistNode *_quicklistMergeNodes(quicklist *quicklist, quicklistNode *center);
|
||||
|
||||
/* Simple way to give quicklistEntry structs default values with one call. */
|
||||
#define initEntry(e) \
|
||||
@ -146,7 +146,7 @@ quicklist *quicklistNew(int fill, int compress) {
|
||||
return quicklist;
|
||||
}
|
||||
|
||||
REDIS_STATIC quicklistNode *quicklistCreateNode(void) {
|
||||
REDICT_STATIC quicklistNode *quicklistCreateNode(void) {
|
||||
quicklistNode *node;
|
||||
node = zmalloc(sizeof(*node));
|
||||
node->entry = NULL;
|
||||
@ -188,8 +188,8 @@ void quicklistRelease(quicklist *quicklist) {
|
||||
/* Compress the listpack in 'node' and update encoding details.
|
||||
* Returns 1 if listpack compressed successfully.
|
||||
* Returns 0 if compression failed or if listpack too small to compress. */
|
||||
REDIS_STATIC int __quicklistCompressNode(quicklistNode *node) {
|
||||
#ifdef REDIS_TEST
|
||||
REDICT_STATIC int __quicklistCompressNode(quicklistNode *node) {
|
||||
#ifdef REDICT_TEST
|
||||
node->attempted_compress = 1;
|
||||
#endif
|
||||
if (node->dont_compress) return 0;
|
||||
@ -230,8 +230,8 @@ REDIS_STATIC int __quicklistCompressNode(quicklistNode *node) {
|
||||
|
||||
/* Uncompress the listpack in 'node' and update encoding details.
|
||||
* Returns 1 on successful decode, 0 on failure to decode. */
|
||||
REDIS_STATIC int __quicklistDecompressNode(quicklistNode *node) {
|
||||
#ifdef REDIS_TEST
|
||||
REDICT_STATIC int __quicklistDecompressNode(quicklistNode *node) {
|
||||
#ifdef REDICT_TEST
|
||||
node->attempted_compress = 0;
|
||||
#endif
|
||||
node->recompress = 0;
|
||||
@ -281,7 +281,7 @@ size_t quicklistGetLzf(const quicklistNode *node, void **data) {
|
||||
* The only way to guarantee interior nodes get compressed is to iterate
|
||||
* to our "interior" compress depth then compress the next node we find.
|
||||
* If compress depth is larger than the entire list, we return immediately. */
|
||||
REDIS_STATIC void __quicklistCompress(const quicklist *quicklist,
|
||||
REDICT_STATIC void __quicklistCompress(const quicklist *quicklist,
|
||||
quicklistNode *node) {
|
||||
if (quicklist->len == 0) return;
|
||||
|
||||
@ -382,7 +382,7 @@ REDIS_STATIC void __quicklistCompress(const quicklist *quicklist,
|
||||
* Insert 'new_node' before 'old_node' if 'after' is 0.
|
||||
* Note: 'new_node' is *always* uncompressed, so if we assign it to
|
||||
* head or tail, we do not need to uncompress it. */
|
||||
REDIS_STATIC void __quicklistInsertNode(quicklist *quicklist,
|
||||
REDICT_STATIC void __quicklistInsertNode(quicklist *quicklist,
|
||||
quicklistNode *old_node,
|
||||
quicklistNode *new_node, int after) {
|
||||
if (after) {
|
||||
@ -421,13 +421,13 @@ REDIS_STATIC void __quicklistInsertNode(quicklist *quicklist,
|
||||
}
|
||||
|
||||
/* Wrappers for node inserting around existing node. */
|
||||
REDIS_STATIC void _quicklistInsertNodeBefore(quicklist *quicklist,
|
||||
REDICT_STATIC void _quicklistInsertNodeBefore(quicklist *quicklist,
|
||||
quicklistNode *old_node,
|
||||
quicklistNode *new_node) {
|
||||
__quicklistInsertNode(quicklist, old_node, new_node, 0);
|
||||
}
|
||||
|
||||
REDIS_STATIC void _quicklistInsertNodeAfter(quicklist *quicklist,
|
||||
REDICT_STATIC void _quicklistInsertNodeAfter(quicklist *quicklist,
|
||||
quicklistNode *old_node,
|
||||
quicklistNode *new_node) {
|
||||
__quicklistInsertNode(quicklist, old_node, new_node, 1);
|
||||
@ -490,7 +490,7 @@ static int isLargeElement(size_t sz, int fill) {
|
||||
return sz > quicklistNodeNegFillLimit(fill);
|
||||
}
|
||||
|
||||
REDIS_STATIC int _quicklistNodeAllowInsert(const quicklistNode *node,
|
||||
REDICT_STATIC int _quicklistNodeAllowInsert(const quicklistNode *node,
|
||||
const int fill, const size_t sz) {
|
||||
if (unlikely(!node))
|
||||
return 0;
|
||||
@ -509,7 +509,7 @@ REDIS_STATIC int _quicklistNodeAllowInsert(const quicklistNode *node,
|
||||
return 1;
|
||||
}
|
||||
|
||||
REDIS_STATIC int _quicklistNodeAllowMerge(const quicklistNode *a,
|
||||
REDICT_STATIC int _quicklistNodeAllowMerge(const quicklistNode *a,
|
||||
const quicklistNode *b,
|
||||
const int fill) {
|
||||
if (!a || !b)
|
||||
@ -646,7 +646,7 @@ void quicklistAppendPlainNode(quicklist *quicklist, unsigned char *data, size_t
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
REDIS_STATIC void __quicklistDelNode(quicklist *quicklist,
|
||||
REDICT_STATIC void __quicklistDelNode(quicklist *quicklist,
|
||||
quicklistNode *node) {
|
||||
/* Update the bookmark if any */
|
||||
quicklistBookmark *bm = _quicklistBookmarkFindByNode(quicklist, node);
|
||||
@ -690,7 +690,7 @@ REDIS_STATIC void __quicklistDelNode(quicklist *quicklist,
|
||||
*
|
||||
* Returns 1 if the entire node was deleted, 0 if node still exists.
|
||||
* Also updates in/out param 'p' with the next offset in the listpack. */
|
||||
REDIS_STATIC int quicklistDelIndex(quicklist *quicklist, quicklistNode *node,
|
||||
REDICT_STATIC int quicklistDelIndex(quicklist *quicklist, quicklistNode *node,
|
||||
unsigned char **p) {
|
||||
int gone = 0;
|
||||
|
||||
@ -839,7 +839,7 @@ int quicklistReplaceAtIndex(quicklist *quicklist, long index, void *data,
|
||||
*
|
||||
* Returns the input node picked to merge against or NULL if
|
||||
* merging was not possible. */
|
||||
REDIS_STATIC quicklistNode *_quicklistListpackMerge(quicklist *quicklist,
|
||||
REDICT_STATIC quicklistNode *_quicklistListpackMerge(quicklist *quicklist,
|
||||
quicklistNode *a,
|
||||
quicklistNode *b) {
|
||||
D("Requested merge (a,b) (%u, %u)", a->count, b->count);
|
||||
@ -881,7 +881,7 @@ REDIS_STATIC quicklistNode *_quicklistListpackMerge(quicklist *quicklist,
|
||||
*
|
||||
* Returns the new 'center' after merging.
|
||||
*/
|
||||
REDIS_STATIC quicklistNode *_quicklistMergeNodes(quicklist *quicklist, quicklistNode *center) {
|
||||
REDICT_STATIC quicklistNode *_quicklistMergeNodes(quicklist *quicklist, quicklistNode *center) {
|
||||
int fill = quicklist->fill;
|
||||
quicklistNode *prev, *prev_prev, *next, *next_next, *target;
|
||||
prev = prev_prev = next = next_next = target = NULL;
|
||||
@ -945,7 +945,7 @@ REDIS_STATIC quicklistNode *_quicklistMergeNodes(quicklist *quicklist, quicklist
|
||||
* The input node keeps all elements not taken by the returned node.
|
||||
*
|
||||
* Returns newly created node or NULL if split not possible. */
|
||||
REDIS_STATIC quicklistNode *_quicklistSplitNode(quicklistNode *node, int offset,
|
||||
REDICT_STATIC quicklistNode *_quicklistSplitNode(quicklistNode *node, int offset,
|
||||
int after) {
|
||||
size_t zl_sz = node->sz;
|
||||
|
||||
@ -983,7 +983,7 @@ REDIS_STATIC quicklistNode *_quicklistSplitNode(quicklistNode *node, int offset,
|
||||
*
|
||||
* If after==1, the new value is inserted after 'entry', otherwise
|
||||
* the new value is inserted before 'entry'. */
|
||||
REDIS_STATIC void _quicklistInsert(quicklistIter *iter, quicklistEntry *entry,
|
||||
REDICT_STATIC void _quicklistInsert(quicklistIter *iter, quicklistEntry *entry,
|
||||
void *value, const size_t sz, int after)
|
||||
{
|
||||
quicklist *quicklist = iter->quicklist;
|
||||
@ -1601,7 +1601,7 @@ int quicklistPopCustom(quicklist *quicklist, int where, unsigned char **data,
|
||||
}
|
||||
|
||||
/* Return a malloc'd copy of data passed in */
|
||||
REDIS_STATIC void *_quicklistSaver(unsigned char *data, size_t sz) {
|
||||
REDICT_STATIC void *_quicklistSaver(unsigned char *data, size_t sz) {
|
||||
unsigned char *vstr;
|
||||
if (data) {
|
||||
vstr = zmalloc(sz);
|
||||
@ -1768,7 +1768,7 @@ void quicklistBookmarksClear(quicklist *ql) {
|
||||
}
|
||||
|
||||
/* The rest of this file is test cases and test helpers. */
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
#include <stdint.h>
|
||||
#include <sys/time.h>
|
||||
#include "testhelp.h"
|
||||
@ -1996,7 +1996,7 @@ int quicklistTest(int argc, char *argv[], int flags) {
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
|
||||
int accurate = (flags & REDIS_TEST_ACCURATE);
|
||||
int accurate = (flags & REDICT_TEST_ACCURATE);
|
||||
unsigned int err = 0;
|
||||
int optimize_start =
|
||||
-(int)(sizeof(optimization_level) / sizeof(*optimization_level));
|
||||
@ -3236,7 +3236,7 @@ int quicklistTest(int argc, char *argv[], int flags) {
|
||||
quicklistRelease(ql);
|
||||
}
|
||||
|
||||
if (flags & REDIS_TEST_LARGE_MEMORY) {
|
||||
if (flags & REDICT_TEST_LARGE_MEMORY) {
|
||||
TEST("compress and decompress quicklist listpack node") {
|
||||
quicklistNode *node = quicklistCreateNode();
|
||||
node->entry = lpNew(0);
|
||||
|
@ -181,7 +181,7 @@ quicklistNode *quicklistBookmarkFind(quicklist *ql, const char *name);
|
||||
void quicklistBookmarksClear(quicklist *ql);
|
||||
int quicklistSetPackedThreshold(size_t sz);
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
int quicklistTest(int argc, char *argv[], int flags);
|
||||
#endif
|
||||
|
||||
|
@ -5,12 +5,12 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#ifndef REDIS_RANDOM_H
|
||||
#define REDIS_RANDOM_H
|
||||
#ifndef REDICT_RANDOM_H
|
||||
#define REDICT_RANDOM_H
|
||||
|
||||
int32_t redisLrand48(void);
|
||||
void redisSrand48(int32_t seedval);
|
||||
|
||||
#define REDIS_LRAND48_MAX INT32_MAX
|
||||
#define REDICT_LRAND48_MAX INT32_MAX
|
||||
|
||||
#endif
|
||||
|
@ -1457,7 +1457,7 @@ static int rdbSaveInternal(int req, const char *filename, rdbSaveInfo *rsi, int
|
||||
rioInitWithFile(&rdb,fp);
|
||||
|
||||
if (server.rdb_save_incremental_fsync) {
|
||||
rioSetAutoSync(&rdb,REDIS_AUTOSYNC_BYTES);
|
||||
rioSetAutoSync(&rdb,REDICT_AUTOSYNC_BYTES);
|
||||
if (!(rdbflags & RDBFLAGS_KEEP_CACHE)) rioSetReclaimCache(&rdb,1);
|
||||
}
|
||||
|
||||
|
@ -49,14 +49,14 @@
|
||||
#define OUTPUT_CSV 2
|
||||
#define OUTPUT_JSON 3
|
||||
#define OUTPUT_QUOTED_JSON 4
|
||||
#define REDIS_CLI_KEEPALIVE_INTERVAL 15 /* seconds */
|
||||
#define REDIS_CLI_DEFAULT_PIPE_TIMEOUT 30 /* seconds */
|
||||
#define REDIS_CLI_HISTFILE_ENV "REDICTCLI_HISTFILE"
|
||||
#define REDIS_CLI_HISTFILE_DEFAULT ".redictcli_history"
|
||||
#define REDIS_CLI_RCFILE_ENV "REDICTCLI_RCFILE"
|
||||
#define REDIS_CLI_RCFILE_DEFAULT ".redictlirc"
|
||||
#define REDIS_CLI_AUTH_ENV "REDICTCLI_AUTH"
|
||||
#define REDIS_CLI_CLUSTER_YES_ENV "REDICTCLI_CLUSTER_YES"
|
||||
#define REDICT_CLI_KEEPALIVE_INTERVAL 15 /* seconds */
|
||||
#define REDICT_CLI_DEFAULT_PIPE_TIMEOUT 30 /* seconds */
|
||||
#define REDICT_CLI_HISTFILE_ENV "REDICTCLI_HISTFILE"
|
||||
#define REDICT_CLI_HISTFILE_DEFAULT ".redictcli_history"
|
||||
#define REDICT_CLI_RCFILE_ENV "REDICTCLI_RCFILE"
|
||||
#define REDICT_CLI_RCFILE_DEFAULT ".redictlirc"
|
||||
#define REDICT_CLI_AUTH_ENV "REDICTCLI_AUTH"
|
||||
#define REDICT_CLI_CLUSTER_YES_ENV "REDICTCLI_CLUSTER_YES"
|
||||
|
||||
#define CLUSTER_MANAGER_SLOTS 16384
|
||||
#define CLUSTER_MANAGER_PORT_INCR 10000 /* same as CLUSTER_PORT_INCR */
|
||||
@ -1670,7 +1670,7 @@ static int cliConnect(int flags) {
|
||||
* in order to prevent timeouts caused by the execution of long
|
||||
* commands. At the same time this improves the detection of real
|
||||
* errors. */
|
||||
anetKeepAlive(NULL, context->fd, REDIS_CLI_KEEPALIVE_INTERVAL);
|
||||
anetKeepAlive(NULL, context->fd, REDICT_CLI_KEEPALIVE_INTERVAL);
|
||||
|
||||
/* State of the current connection. */
|
||||
config.current_resp3 = 0;
|
||||
@ -2962,12 +2962,12 @@ static int parseOptions(int argc, char **argv) {
|
||||
|
||||
static void parseEnv(void) {
|
||||
/* Set auth from env, but do not overwrite CLI arguments if passed */
|
||||
char *auth = getenv(REDIS_CLI_AUTH_ENV);
|
||||
char *auth = getenv(REDICT_CLI_AUTH_ENV);
|
||||
if (auth != NULL && config.conn_info.auth == NULL) {
|
||||
config.conn_info.auth = auth;
|
||||
}
|
||||
|
||||
char *cluster_yes = getenv(REDIS_CLI_CLUSTER_YES_ENV);
|
||||
char *cluster_yes = getenv(REDICT_CLI_CLUSTER_YES_ENV);
|
||||
if (cluster_yes != NULL && !strcmp(cluster_yes, "1")) {
|
||||
config.cluster_manager_command.flags |= CLUSTER_MANAGER_CMD_FLAG_YES;
|
||||
}
|
||||
@ -3009,13 +3009,13 @@ static void usage(int err) {
|
||||
" Default timeout is 0, meaning no limit, depending on the OS.\n"
|
||||
" -s <socket> Server socket (overrides hostname and port).\n"
|
||||
" -a <password> Password to use when connecting to the server.\n"
|
||||
" You can also use the " REDIS_CLI_AUTH_ENV " environment\n"
|
||||
" You can also use the " REDICT_CLI_AUTH_ENV " environment\n"
|
||||
" variable to pass this password more safely\n"
|
||||
" (if both are used, this argument takes precedence).\n"
|
||||
" --user <username> Used to send ACL style 'AUTH username pass'. Needs -a.\n"
|
||||
" --pass <password> Alias of -a for consistency with the new --user option.\n"
|
||||
" --askpass Force user to input password with mask from STDIN.\n"
|
||||
" If this argument is used, '-a' and " REDIS_CLI_AUTH_ENV "\n"
|
||||
" If this argument is used, '-a' and " REDICT_CLI_AUTH_ENV "\n"
|
||||
" environment variable will be ignored.\n"
|
||||
" -u <uri> Server URI on format redict://user:password@host:port/dbnum\n"
|
||||
" User, password and dbnum are optional. For authentication\n"
|
||||
@ -3072,7 +3072,7 @@ version,tls_usage);
|
||||
" --pipe-timeout <n> In --pipe mode, abort with error if after sending all data.\n"
|
||||
" no reply is received within <n> seconds.\n"
|
||||
" Default timeout: %d. Use 0 to wait forever.\n",
|
||||
REDIS_CLI_DEFAULT_PIPE_TIMEOUT);
|
||||
REDICT_CLI_DEFAULT_PIPE_TIMEOUT);
|
||||
fprintf(target,
|
||||
" --bigkeys Sample Redict keys looking for keys with many elements (complexity).\n"
|
||||
" --memkeys Sample Redict keys looking for keys consuming a lot of memory.\n"
|
||||
@ -3235,7 +3235,7 @@ void cliSetPreferences(char **argv, int argc, int interactive) {
|
||||
|
||||
/* Load the ~/.redisclirc file if any. */
|
||||
void cliLoadPreferences(void) {
|
||||
sds rcfile = getDotfilePath(REDIS_CLI_RCFILE_ENV,REDIS_CLI_RCFILE_DEFAULT);
|
||||
sds rcfile = getDotfilePath(REDICT_CLI_RCFILE_ENV,REDICT_CLI_RCFILE_DEFAULT);
|
||||
if (rcfile == NULL) return;
|
||||
FILE *fp = fopen(rcfile,"r");
|
||||
char buf[1024];
|
||||
@ -3356,7 +3356,7 @@ static void repl(void) {
|
||||
|
||||
/* Only use history and load the rc file when stdin is a tty. */
|
||||
if (isatty(fileno(stdin))) {
|
||||
historyfile = getDotfilePath(REDIS_CLI_HISTFILE_ENV,REDIS_CLI_HISTFILE_DEFAULT);
|
||||
historyfile = getDotfilePath(REDICT_CLI_HISTFILE_ENV,REDICT_CLI_HISTFILE_DEFAULT);
|
||||
//keep in-memory history always regardless if history file can be determined
|
||||
history = 1;
|
||||
if (historyfile != NULL) {
|
||||
@ -4090,7 +4090,7 @@ static int clusterManagerNodeConnect(clusterManagerNode *node) {
|
||||
* in order to prevent timeouts caused by the execution of long
|
||||
* commands. At the same time this improves the detection of real
|
||||
* errors. */
|
||||
anetKeepAlive(NULL, node->context->fd, REDIS_CLI_KEEPALIVE_INTERVAL);
|
||||
anetKeepAlive(NULL, node->context->fd, REDICT_CLI_KEEPALIVE_INTERVAL);
|
||||
if (config.conn_info.auth) {
|
||||
redisReply *reply;
|
||||
if (config.conn_info.user == NULL)
|
||||
@ -9858,7 +9858,7 @@ int main(int argc, char **argv) {
|
||||
config.pattern = NULL;
|
||||
config.rdb_filename = NULL;
|
||||
config.pipe_mode = 0;
|
||||
config.pipe_timeout = REDIS_CLI_DEFAULT_PIPE_TIMEOUT;
|
||||
config.pipe_timeout = REDICT_CLI_DEFAULT_PIPE_TIMEOUT;
|
||||
config.bigkeys = 0;
|
||||
config.memkeys = 0;
|
||||
config.hotkeys = 0;
|
||||
|
@ -5,8 +5,8 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#ifndef __REDIS_ASSERT_H__
|
||||
#define __REDIS_ASSERT_H__
|
||||
#ifndef __REDICT_ASSERT_H__
|
||||
#define __REDICT_ASSERT_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
@ -16,19 +16,19 @@
|
||||
#include "crc64.h"
|
||||
|
||||
char *redisGitSHA1(void) {
|
||||
return REDIS_GIT_SHA1;
|
||||
return REDICT_GIT_SHA1;
|
||||
}
|
||||
|
||||
char *redisGitDirty(void) {
|
||||
return REDIS_GIT_DIRTY;
|
||||
return REDICT_GIT_DIRTY;
|
||||
}
|
||||
|
||||
const char *redisBuildIdRaw(void) {
|
||||
return REDIS_BUILD_ID_RAW;
|
||||
return REDICT_BUILD_ID_RAW;
|
||||
}
|
||||
|
||||
uint64_t redisBuildId(void) {
|
||||
char *buildid = REDIS_BUILD_ID_RAW;
|
||||
char *buildid = REDICT_BUILD_ID_RAW;
|
||||
|
||||
return crc64(0,(unsigned char*)buildid,strlen(buildid));
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#ifndef __REDIS_RIO_H
|
||||
#define __REDIS_RIO_H
|
||||
#ifndef __REDICT_RIO_H
|
||||
#define __REDICT_RIO_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
@ -1469,7 +1469,7 @@ void luaRegisterRedisAPI(lua_State* lua) {
|
||||
lua_settable(lua,-3);
|
||||
|
||||
/* Finally set the table as 'redis' global var. */
|
||||
lua_setglobal(lua,REDIS_API_NAME);
|
||||
lua_setglobal(lua,REDICT_API_NAME);
|
||||
|
||||
/* Replace math.random and math.randomseed with our implementations. */
|
||||
lua_getglobal(lua,"math");
|
||||
@ -1510,8 +1510,8 @@ static void luaCreateArray(lua_State *lua, robj **elev, int elec) {
|
||||
static int redis_math_random (lua_State *L) {
|
||||
/* the `%' avoids the (rare) case of r==1, and is needed also because on
|
||||
some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */
|
||||
lua_Number r = (lua_Number)(redisLrand48()%REDIS_LRAND48_MAX) /
|
||||
(lua_Number)REDIS_LRAND48_MAX;
|
||||
lua_Number r = (lua_Number)(redisLrand48()%REDICT_LRAND48_MAX) /
|
||||
(lua_Number)REDICT_LRAND48_MAX;
|
||||
switch (lua_gettop(L)) { /* check number of arguments */
|
||||
case 0: { /* no arguments */
|
||||
lua_pushnumber(L, r); /* Number between 0 and 1 */
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#define REGISTRY_RUN_CTX_NAME "__RUN_CTX__"
|
||||
#define REGISTRY_SET_GLOBALS_PROTECTION_NAME "__GLOBAL_PROTECTION__"
|
||||
#define REDIS_API_NAME "redis"
|
||||
#define REDICT_API_NAME "redis"
|
||||
|
||||
typedef struct errorInfo {
|
||||
sds msg;
|
||||
|
@ -1206,7 +1206,7 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include "testhelp.h"
|
||||
|
@ -257,7 +257,7 @@ void *sds_malloc(size_t size);
|
||||
void *sds_realloc(void *ptr, size_t size);
|
||||
void sds_free(void *ptr);
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
int sdsTest(int argc, char *argv[], int flags);
|
||||
#endif
|
||||
|
||||
|
@ -26,7 +26,7 @@ extern SSL_CTX *redis_tls_ctx;
|
||||
extern SSL_CTX *redis_tls_client_ctx;
|
||||
#endif
|
||||
|
||||
#define REDIS_SENTINEL_PORT 26379
|
||||
#define REDICT_SENTINEL_PORT 26379
|
||||
|
||||
/* ======================== Sentinel global state =========================== */
|
||||
|
||||
@ -457,7 +457,7 @@ const char *preMonitorCfgName[] = {
|
||||
/* This function overwrites a few normal Redis config default with Sentinel
|
||||
* specific defaults. */
|
||||
void initSentinelConfig(void) {
|
||||
server.port = REDIS_SENTINEL_PORT;
|
||||
server.port = REDICT_SENTINEL_PORT;
|
||||
server.protected_mode = 0; /* Sentinel must be exposed. */
|
||||
}
|
||||
|
||||
|
12
src/server.c
12
src/server.c
@ -5573,7 +5573,7 @@ sds genRedisInfoString(dict *section_dict, int all_sections, int everything) {
|
||||
"arch_bits:%i\r\n", server.arch_bits,
|
||||
"monotonic_clock:%s\r\n", monotonicInfoString(),
|
||||
"multiplexing_api:%s\r\n", aeGetApiName(),
|
||||
"atomicvar_api:%s\r\n", REDIS_ATOMIC_API,
|
||||
"atomicvar_api:%s\r\n", REDICT_ATOMIC_API,
|
||||
"gcc_version:%s\r\n", GNUC_VERSION_STR,
|
||||
"process_id:%I\r\n", (int64_t) getpid(),
|
||||
"process_supervised:%s\r\n", supervised,
|
||||
@ -6833,7 +6833,7 @@ int iAmMaster(void) {
|
||||
(server.cluster_enabled && clusterNodeIsMaster(getMyClusterNode())));
|
||||
}
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
#include "testhelp.h"
|
||||
#include "intset.h" /* Compact integer set structure */
|
||||
|
||||
@ -6879,15 +6879,15 @@ int main(int argc, char **argv) {
|
||||
int j;
|
||||
char config_from_stdin = 0;
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
monotonicInit(); /* Required for dict tests, that are relying on monotime during dict rehashing. */
|
||||
if (argc >= 3 && !strcasecmp(argv[1], "test")) {
|
||||
int flags = 0;
|
||||
for (j = 3; j < argc; j++) {
|
||||
char *arg = argv[j];
|
||||
if (!strcasecmp(arg, "--accurate")) flags |= REDIS_TEST_ACCURATE;
|
||||
else if (!strcasecmp(arg, "--large-memory")) flags |= REDIS_TEST_LARGE_MEMORY;
|
||||
else if (!strcasecmp(arg, "--valgrind")) flags |= REDIS_TEST_VALGRIND;
|
||||
if (!strcasecmp(arg, "--accurate")) flags |= REDICT_TEST_ACCURATE;
|
||||
else if (!strcasecmp(arg, "--large-memory")) flags |= REDICT_TEST_LARGE_MEMORY;
|
||||
else if (!strcasecmp(arg, "--valgrind")) flags |= REDICT_TEST_VALGRIND;
|
||||
}
|
||||
|
||||
if (!strcasecmp(argv[2], "all")) {
|
||||
|
@ -5,8 +5,8 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#ifndef __REDIS_H
|
||||
#define __REDIS_H
|
||||
#ifndef __REDICT_H
|
||||
#define __REDICT_H
|
||||
|
||||
#include "fmacros.h"
|
||||
#include "config.h"
|
||||
@ -159,7 +159,7 @@ struct hdr_histogram;
|
||||
#define PROTO_MBULK_BIG_ARG (1024*32)
|
||||
#define PROTO_RESIZE_THRESHOLD (1024*32) /* Threshold for determining whether to resize query buffer */
|
||||
#define PROTO_REPLY_MIN_BYTES (1024) /* the lower limit on reply buffer size */
|
||||
#define REDIS_AUTOSYNC_BYTES (1024*1024*4) /* Sync file every 4MB. */
|
||||
#define REDICT_AUTOSYNC_BYTES (1024*1024*4) /* Sync file every 4MB. */
|
||||
|
||||
#define REPLY_BUFFER_DEFAULT_PEAK_RESET_TIME 5000 /* 5 seconds */
|
||||
|
||||
|
@ -213,7 +213,7 @@ void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
|
||||
}
|
||||
/* ================ end of sha1.c ================ */
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
#define BUFSIZE 4096
|
||||
|
||||
#define UNUSED(x) (void)(x)
|
||||
|
@ -27,7 +27,7 @@ void SHA1Init(SHA1_CTX* context);
|
||||
__attribute__((noinline)) void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32_t len);
|
||||
void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
int sha1Test(int argc, char **argv, int flags);
|
||||
#endif
|
||||
#endif
|
||||
|
20
src/t_zset.c
20
src/t_zset.c
@ -2386,21 +2386,21 @@ static int zuiCompareByRevCardinality(const void *s1, const void *s2) {
|
||||
return zuiCompareByCardinality(s1, s2) * -1;
|
||||
}
|
||||
|
||||
#define REDIS_AGGR_SUM 1
|
||||
#define REDIS_AGGR_MIN 2
|
||||
#define REDIS_AGGR_MAX 3
|
||||
#define REDICT_AGGR_SUM 1
|
||||
#define REDICT_AGGR_MIN 2
|
||||
#define REDICT_AGGR_MAX 3
|
||||
#define zunionInterDictValue(_e) (dictGetVal(_e) == NULL ? 1.0 : *(double*)dictGetVal(_e))
|
||||
|
||||
inline static void zunionInterAggregate(double *target, double val, int aggregate) {
|
||||
if (aggregate == REDIS_AGGR_SUM) {
|
||||
if (aggregate == REDICT_AGGR_SUM) {
|
||||
*target = *target + val;
|
||||
/* The result of adding two doubles is NaN when one variable
|
||||
* is +inf and the other is -inf. When these numbers are added,
|
||||
* we maintain the convention of the result being 0.0. */
|
||||
if (isnan(*target)) *target = 0.0;
|
||||
} else if (aggregate == REDIS_AGGR_MIN) {
|
||||
} else if (aggregate == REDICT_AGGR_MIN) {
|
||||
*target = val < *target ? val : *target;
|
||||
} else if (aggregate == REDIS_AGGR_MAX) {
|
||||
} else if (aggregate == REDICT_AGGR_MAX) {
|
||||
*target = val > *target ? val : *target;
|
||||
} else {
|
||||
/* safety net */
|
||||
@ -2615,7 +2615,7 @@ void zunionInterDiffGenericCommand(client *c, robj *dstkey, int numkeysIndex, in
|
||||
int cardinality_only) {
|
||||
int i, j;
|
||||
long setnum;
|
||||
int aggregate = REDIS_AGGR_SUM;
|
||||
int aggregate = REDICT_AGGR_SUM;
|
||||
zsetopsrc *src;
|
||||
zsetopval zval;
|
||||
sds tmp;
|
||||
@ -2695,11 +2695,11 @@ void zunionInterDiffGenericCommand(client *c, robj *dstkey, int numkeysIndex, in
|
||||
{
|
||||
j++; remaining--;
|
||||
if (!strcasecmp(c->argv[j]->ptr,"sum")) {
|
||||
aggregate = REDIS_AGGR_SUM;
|
||||
aggregate = REDICT_AGGR_SUM;
|
||||
} else if (!strcasecmp(c->argv[j]->ptr,"min")) {
|
||||
aggregate = REDIS_AGGR_MIN;
|
||||
aggregate = REDICT_AGGR_MIN;
|
||||
} else if (!strcasecmp(c->argv[j]->ptr,"max")) {
|
||||
aggregate = REDIS_AGGR_MAX;
|
||||
aggregate = REDICT_AGGR_MAX;
|
||||
} else {
|
||||
zfree(src);
|
||||
addReplyErrorObject(c,shared.syntaxerr);
|
||||
|
@ -8,9 +8,9 @@
|
||||
#ifndef __TESTHELP_H
|
||||
#define __TESTHELP_H
|
||||
|
||||
#define REDIS_TEST_ACCURATE (1<<0)
|
||||
#define REDIS_TEST_LARGE_MEMORY (1<<1)
|
||||
#define REDIS_TEST_VALGRIND (1<<2)
|
||||
#define REDICT_TEST_ACCURATE (1<<0)
|
||||
#define REDICT_TEST_LARGE_MEMORY (1<<1)
|
||||
#define REDICT_TEST_VALGRIND (1<<2)
|
||||
|
||||
extern int __failed_tests;
|
||||
extern int __test_num;
|
||||
|
32
src/tls.c
32
src/tls.c
@ -24,16 +24,16 @@
|
||||
#include <sys/uio.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#define REDIS_TLS_PROTO_TLSv1 (1<<0)
|
||||
#define REDIS_TLS_PROTO_TLSv1_1 (1<<1)
|
||||
#define REDIS_TLS_PROTO_TLSv1_2 (1<<2)
|
||||
#define REDIS_TLS_PROTO_TLSv1_3 (1<<3)
|
||||
#define REDICT_TLS_PROTO_TLSv1 (1<<0)
|
||||
#define REDICT_TLS_PROTO_TLSv1_1 (1<<1)
|
||||
#define REDICT_TLS_PROTO_TLSv1_2 (1<<2)
|
||||
#define REDICT_TLS_PROTO_TLSv1_3 (1<<3)
|
||||
|
||||
/* Use safe defaults */
|
||||
#ifdef TLS1_3_VERSION
|
||||
#define REDIS_TLS_PROTO_DEFAULT (REDIS_TLS_PROTO_TLSv1_2|REDIS_TLS_PROTO_TLSv1_3)
|
||||
#define REDICT_TLS_PROTO_DEFAULT (REDICT_TLS_PROTO_TLSv1_2|REDICT_TLS_PROTO_TLSv1_3)
|
||||
#else
|
||||
#define REDIS_TLS_PROTO_DEFAULT (REDIS_TLS_PROTO_TLSv1_2)
|
||||
#define REDICT_TLS_PROTO_DEFAULT (REDICT_TLS_PROTO_TLSv1_2)
|
||||
#endif
|
||||
|
||||
SSL_CTX *redis_tls_ctx = NULL;
|
||||
@ -43,7 +43,7 @@ static int parseProtocolsConfig(const char *str) {
|
||||
int i, count = 0;
|
||||
int protocols = 0;
|
||||
|
||||
if (!str) return REDIS_TLS_PROTO_DEFAULT;
|
||||
if (!str) return REDICT_TLS_PROTO_DEFAULT;
|
||||
sds *tokens = sdssplitlen(str, strlen(str), " ", 1, &count);
|
||||
|
||||
if (!tokens) {
|
||||
@ -51,12 +51,12 @@ static int parseProtocolsConfig(const char *str) {
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!strcasecmp(tokens[i], "tlsv1")) protocols |= REDIS_TLS_PROTO_TLSv1;
|
||||
else if (!strcasecmp(tokens[i], "tlsv1.1")) protocols |= REDIS_TLS_PROTO_TLSv1_1;
|
||||
else if (!strcasecmp(tokens[i], "tlsv1.2")) protocols |= REDIS_TLS_PROTO_TLSv1_2;
|
||||
if (!strcasecmp(tokens[i], "tlsv1")) protocols |= REDICT_TLS_PROTO_TLSv1;
|
||||
else if (!strcasecmp(tokens[i], "tlsv1.1")) protocols |= REDICT_TLS_PROTO_TLSv1_1;
|
||||
else if (!strcasecmp(tokens[i], "tlsv1.2")) protocols |= REDICT_TLS_PROTO_TLSv1_2;
|
||||
else if (!strcasecmp(tokens[i], "tlsv1.3")) {
|
||||
#ifdef TLS1_3_VERSION
|
||||
protocols |= REDIS_TLS_PROTO_TLSv1_3;
|
||||
protocols |= REDICT_TLS_PROTO_TLSv1_3;
|
||||
#else
|
||||
serverLog(LL_WARNING, "TLSv1.3 is specified in tls-protocols but not supported by OpenSSL.");
|
||||
protocols = -1;
|
||||
@ -197,16 +197,16 @@ static SSL_CTX *createSSLContext(redisTLSContextConfig *ctx_config, int protocol
|
||||
SSL_CTX_set_options(ctx, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS);
|
||||
#endif
|
||||
|
||||
if (!(protocols & REDIS_TLS_PROTO_TLSv1))
|
||||
if (!(protocols & REDICT_TLS_PROTO_TLSv1))
|
||||
SSL_CTX_set_options(ctx, SSL_OP_NO_TLSv1);
|
||||
if (!(protocols & REDIS_TLS_PROTO_TLSv1_1))
|
||||
if (!(protocols & REDICT_TLS_PROTO_TLSv1_1))
|
||||
SSL_CTX_set_options(ctx, SSL_OP_NO_TLSv1_1);
|
||||
#ifdef SSL_OP_NO_TLSv1_2
|
||||
if (!(protocols & REDIS_TLS_PROTO_TLSv1_2))
|
||||
if (!(protocols & REDICT_TLS_PROTO_TLSv1_2))
|
||||
SSL_CTX_set_options(ctx, SSL_OP_NO_TLSv1_2);
|
||||
#endif
|
||||
#ifdef SSL_OP_NO_TLSv1_3
|
||||
if (!(protocols & REDIS_TLS_PROTO_TLSv1_3))
|
||||
if (!(protocols & REDICT_TLS_PROTO_TLSv1_3))
|
||||
SSL_CTX_set_options(ctx, SSL_OP_NO_TLSv1_3);
|
||||
#endif
|
||||
|
||||
@ -1154,7 +1154,7 @@ int RedisModule_OnLoad(void *ctx, RedisModuleString **argv, int argc) {
|
||||
UNUSED(argc);
|
||||
|
||||
/* Connection modules must be part of the same build as redis. */
|
||||
if (strcmp(REDIS_BUILD_ID_RAW, redisBuildIdRaw())) {
|
||||
if (strcmp(REDICT_BUILD_ID_RAW, redisBuildIdRaw())) {
|
||||
serverLog(LL_NOTICE, "Connection type %s was not built together with the redict-server used.", CONN_TYPE_TLS);
|
||||
return REDISMODULE_ERR;
|
||||
}
|
||||
|
@ -1353,7 +1353,7 @@ int snprintf_async_signal_safe(char *to, size_t n, const char *fmt, ...) {
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
#include <assert.h>
|
||||
#include <sys/mman.h>
|
||||
#include "testhelp.h"
|
||||
@ -1624,7 +1624,7 @@ int utilTest(int argc, char **argv, int flags) {
|
||||
test_ld2string();
|
||||
test_fixedpoint_d2string();
|
||||
#if defined(__linux__)
|
||||
if (!(flags & REDIS_TEST_VALGRIND)) {
|
||||
if (!(flags & REDICT_TEST_VALGRIND)) {
|
||||
test_reclaimFilePageCache();
|
||||
}
|
||||
#endif
|
||||
|
@ -5,8 +5,8 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#ifndef __REDIS_UTIL_H
|
||||
#define __REDIS_UTIL_H
|
||||
#ifndef __REDICT_UTIL_H
|
||||
#define __REDICT_UTIL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "sds.h"
|
||||
@ -78,7 +78,7 @@ int snprintf_async_signal_safe(char *to, size_t n, const char *fmt, ...);
|
||||
size_t redis_strlcpy(char *dst, const char *src, size_t dsize);
|
||||
size_t redis_strlcat(char *dst, const char *src, size_t dsize);
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
int utilTest(int argc, char **argv, int flags);
|
||||
#endif
|
||||
|
||||
|
@ -1513,7 +1513,7 @@ unsigned int ziplistRandomPairsUnique(unsigned char *zl, unsigned int count, zip
|
||||
return picked;
|
||||
}
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
#include <sys/time.h>
|
||||
#include "adlist.h"
|
||||
#include "sds.h"
|
||||
@ -1674,7 +1674,7 @@ static size_t strEntryBytesLarge(size_t slen) {
|
||||
|
||||
/* ./redict-server test ziplist <randomseed> */
|
||||
int ziplistTest(int argc, char **argv, int flags) {
|
||||
int accurate = (flags & REDIS_TEST_ACCURATE);
|
||||
int accurate = (flags & REDICT_TEST_ACCURATE);
|
||||
unsigned char *zl, *p;
|
||||
unsigned char *entry;
|
||||
unsigned int elen;
|
||||
|
@ -45,7 +45,7 @@ void ziplistRandomPairs(unsigned char *zl, unsigned int count, ziplistEntry *key
|
||||
unsigned int ziplistRandomPairsUnique(unsigned char *zl, unsigned int count, ziplistEntry *keys, ziplistEntry *vals);
|
||||
int ziplistSafeToAdd(unsigned char* zl, size_t add);
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
int ziplistTest(int argc, char *argv[], int flags);
|
||||
#endif
|
||||
|
||||
|
@ -406,7 +406,7 @@ int zipmapValidateIntegrity(unsigned char *zm, size_t size, int deep) {
|
||||
#undef OUT_OF_RANGE
|
||||
}
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
static void zipmapRepr(unsigned char *p) {
|
||||
unsigned int l;
|
||||
|
||||
|
@ -20,7 +20,7 @@ size_t zipmapBlobLen(unsigned char *zm);
|
||||
void zipmapRepr(unsigned char *p);
|
||||
int zipmapValidateIntegrity(unsigned char *zm, size_t size, int deep);
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
int zipmapTest(int argc, char *argv[], int flags);
|
||||
#endif
|
||||
|
||||
|
@ -885,7 +885,7 @@ size_t zmalloc_get_memory_size(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
#include "testhelp.h"
|
||||
#include "redictassert.h"
|
||||
|
||||
|
@ -145,7 +145,7 @@ __attribute__((alloc_size(2),noinline)) void *extend_to_usable(void *ptr, size_t
|
||||
|
||||
int get_proc_stat_ll(int i, long long *res);
|
||||
|
||||
#ifdef REDIS_TEST
|
||||
#ifdef REDICT_TEST
|
||||
int zmalloc_test(int argc, char **argv, int flags);
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user