|
72 | 72 | #define OUTPUT_CSV 2 |
73 | 73 | #define OUTPUT_JSON 3 |
74 | 74 | #define OUTPUT_QUOTED_JSON 4 |
75 | | -#define REDIS_CLI_KEEPALIVE_INTERVAL 15 /* seconds */ |
76 | | -#define REDIS_CLI_DEFAULT_PIPE_TIMEOUT 30 /* seconds */ |
77 | | -#define REDIS_CLI_HISTFILE_ENV "REDISCLI_HISTFILE" |
| 75 | +#define CLI_KEEPALIVE_INTERVAL 15 /* seconds */ |
| 76 | +#define CLI_DEFAULT_PIPE_TIMEOUT 30 /* seconds */ |
| 77 | +#define CLI_HISTFILE_ENV "REDISCLI_HISTFILE" |
78 | 78 | #define CLI_HISTFILE_DEFAULT ".valkeycli_history" |
79 | | -#define REDIS_CLI_RCFILE_ENV "REDISCLI_RCFILE" |
| 79 | +#define CLI_RCFILE_ENV "REDISCLI_RCFILE" |
80 | 80 | #define CLI_RCFILE_DEFAULT ".valkeyclirc" |
81 | | -#define REDIS_CLI_AUTH_ENV "REDISCLI_AUTH" |
82 | | -#define REDIS_CLI_CLUSTER_YES_ENV "REDISCLI_CLUSTER_YES" |
| 81 | +#define CLI_AUTH_ENV "REDISCLI_AUTH" |
| 82 | +#define CLI_CLUSTER_YES_ENV "REDISCLI_CLUSTER_YES" |
83 | 83 |
|
84 | 84 | #define CLUSTER_MANAGER_SLOTS 16384 |
85 | 85 | #define CLUSTER_MANAGER_PORT_INCR 10000 /* same as CLUSTER_PORT_INCR */ |
@@ -296,7 +296,7 @@ static long getLongInfoField(char *info, char *field); |
296 | 296 | /*------------------------------------------------------------------------------ |
297 | 297 | * Utility functions |
298 | 298 | *--------------------------------------------------------------------------- */ |
299 | | -size_t redis_strlcpy(char *dst, const char *src, size_t dsize); |
| 299 | +size_t valkey_strlcpy(char *dst, const char *src, size_t dsize); |
300 | 300 |
|
301 | 301 | static void cliPushHandler(void *, void *); |
302 | 302 |
|
@@ -1693,7 +1693,7 @@ static int cliConnect(int flags) { |
1693 | 1693 | * in order to prevent timeouts caused by the execution of long |
1694 | 1694 | * commands. At the same time this improves the detection of real |
1695 | 1695 | * errors. */ |
1696 | | - anetKeepAlive(NULL, context->fd, REDIS_CLI_KEEPALIVE_INTERVAL); |
| 1696 | + anetKeepAlive(NULL, context->fd, CLI_KEEPALIVE_INTERVAL); |
1697 | 1697 |
|
1698 | 1698 | /* State of the current connection. */ |
1699 | 1699 | config.current_resp3 = 0; |
@@ -2985,12 +2985,12 @@ static int parseOptions(int argc, char **argv) { |
2985 | 2985 |
|
2986 | 2986 | static void parseEnv(void) { |
2987 | 2987 | /* Set auth from env, but do not overwrite CLI arguments if passed */ |
2988 | | - char *auth = getenv(REDIS_CLI_AUTH_ENV); |
| 2988 | + char *auth = getenv(CLI_AUTH_ENV); |
2989 | 2989 | if (auth != NULL && config.conn_info.auth == NULL) { |
2990 | 2990 | config.conn_info.auth = auth; |
2991 | 2991 | } |
2992 | 2992 |
|
2993 | | - char *cluster_yes = getenv(REDIS_CLI_CLUSTER_YES_ENV); |
| 2993 | + char *cluster_yes = getenv(CLI_CLUSTER_YES_ENV); |
2994 | 2994 | if (cluster_yes != NULL && !strcmp(cluster_yes, "1")) { |
2995 | 2995 | config.cluster_manager_command.flags |= CLUSTER_MANAGER_CMD_FLAG_YES; |
2996 | 2996 | } |
@@ -3032,13 +3032,13 @@ static void usage(int err) { |
3032 | 3032 | " Default timeout is 0, meaning no limit, depending on the OS.\n" |
3033 | 3033 | " -s <socket> Server socket (overrides hostname and port).\n" |
3034 | 3034 | " -a <password> Password to use when connecting to the server.\n" |
3035 | | -" You can also use the " REDIS_CLI_AUTH_ENV " environment\n" |
| 3035 | +" You can also use the " CLI_AUTH_ENV " environment\n" |
3036 | 3036 | " variable to pass this password more safely\n" |
3037 | 3037 | " (if both are used, this argument takes precedence).\n" |
3038 | 3038 | " --user <username> Used to send ACL style 'AUTH username pass'. Needs -a.\n" |
3039 | 3039 | " --pass <password> Alias of -a for consistency with the new --user option.\n" |
3040 | 3040 | " --askpass Force user to input password with mask from STDIN.\n" |
3041 | | -" If this argument is used, '-a' and " REDIS_CLI_AUTH_ENV "\n" |
| 3041 | +" If this argument is used, '-a' and " CLI_AUTH_ENV "\n" |
3042 | 3042 | " environment variable will be ignored.\n" |
3043 | 3043 | " -u <uri> Server URI on format redis://user:password@host:port/dbnum\n" |
3044 | 3044 | " User, password and dbnum are optional. For authentication\n" |
@@ -3095,7 +3095,7 @@ version,tls_usage); |
3095 | 3095 | " --pipe-timeout <n> In --pipe mode, abort with error if after sending all data.\n" |
3096 | 3096 | " no reply is received within <n> seconds.\n" |
3097 | 3097 | " Default timeout: %d. Use 0 to wait forever.\n", |
3098 | | - REDIS_CLI_DEFAULT_PIPE_TIMEOUT); |
| 3098 | + CLI_DEFAULT_PIPE_TIMEOUT); |
3099 | 3099 | fprintf(target, |
3100 | 3100 | " --bigkeys Sample keys looking for keys with many elements (complexity).\n" |
3101 | 3101 | " --memkeys Sample keys looking for keys consuming a lot of memory.\n" |
@@ -3258,7 +3258,7 @@ void cliSetPreferences(char **argv, int argc, int interactive) { |
3258 | 3258 |
|
3259 | 3259 | /* Load the ~/.valkeyclirc file if any. */ |
3260 | 3260 | void cliLoadPreferences(void) { |
3261 | | - sds rcfile = getDotfilePath(REDIS_CLI_RCFILE_ENV,CLI_RCFILE_DEFAULT); |
| 3261 | + sds rcfile = getDotfilePath(CLI_RCFILE_ENV,CLI_RCFILE_DEFAULT); |
3262 | 3262 | if (rcfile == NULL) return; |
3263 | 3263 | FILE *fp = fopen(rcfile,"r"); |
3264 | 3264 | char buf[1024]; |
@@ -3379,7 +3379,7 @@ static void repl(void) { |
3379 | 3379 |
|
3380 | 3380 | /* Only use history and load the rc file when stdin is a tty. */ |
3381 | 3381 | if (isatty(fileno(stdin))) { |
3382 | | - historyfile = getDotfilePath(REDIS_CLI_HISTFILE_ENV,CLI_HISTFILE_DEFAULT); |
| 3382 | + historyfile = getDotfilePath(CLI_HISTFILE_ENV,CLI_HISTFILE_DEFAULT); |
3383 | 3383 | //keep in-memory history always regardless if history file can be determined |
3384 | 3384 | history = 1; |
3385 | 3385 | if (historyfile != NULL) { |
@@ -4043,7 +4043,7 @@ static int clusterManagerCheckRedisReply(clusterManagerNode *n, |
4043 | 4043 | if (is_err) { |
4044 | 4044 | if (err != NULL) { |
4045 | 4045 | *err = zmalloc((r->len + 1) * sizeof(char)); |
4046 | | - redis_strlcpy(*err, r->str,(r->len + 1)); |
| 4046 | + valkey_strlcpy(*err, r->str,(r->len + 1)); |
4047 | 4047 | } else CLUSTER_MANAGER_PRINT_REPLY_ERROR(n, r->str); |
4048 | 4048 | } |
4049 | 4049 | return 0; |
@@ -4113,7 +4113,7 @@ static int clusterManagerNodeConnect(clusterManagerNode *node) { |
4113 | 4113 | * in order to prevent timeouts caused by the execution of long |
4114 | 4114 | * commands. At the same time this improves the detection of real |
4115 | 4115 | * errors. */ |
4116 | | - anetKeepAlive(NULL, node->context->fd, REDIS_CLI_KEEPALIVE_INTERVAL); |
| 4116 | + anetKeepAlive(NULL, node->context->fd, CLI_KEEPALIVE_INTERVAL); |
4117 | 4117 | if (config.conn_info.auth) { |
4118 | 4118 | redisReply *reply; |
4119 | 4119 | if (config.conn_info.user == NULL) |
@@ -4203,7 +4203,7 @@ static redisReply *clusterManagerGetNodeRedisInfo(clusterManagerNode *node, |
4203 | 4203 | if (info->type == REDIS_REPLY_ERROR) { |
4204 | 4204 | if (err != NULL) { |
4205 | 4205 | *err = zmalloc((info->len + 1) * sizeof(char)); |
4206 | | - redis_strlcpy(*err, info->str,(info->len + 1)); |
| 4206 | + valkey_strlcpy(*err, info->str,(info->len + 1)); |
4207 | 4207 | } |
4208 | 4208 | freeReplyObject(info); |
4209 | 4209 | return NULL; |
@@ -4780,7 +4780,7 @@ static int clusterManagerSetSlot(clusterManagerNode *node1, |
4780 | 4780 | success = 0; |
4781 | 4781 | if (err != NULL) { |
4782 | 4782 | *err = zmalloc((reply->len + 1) * sizeof(char)); |
4783 | | - redis_strlcpy(*err, reply->str,(reply->len + 1)); |
| 4783 | + valkey_strlcpy(*err, reply->str,(reply->len + 1)); |
4784 | 4784 | } else CLUSTER_MANAGER_PRINT_REPLY_ERROR(node1, reply->str); |
4785 | 4785 | goto cleanup; |
4786 | 4786 | } |
@@ -5054,7 +5054,7 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source, |
5054 | 5054 | success = 0; |
5055 | 5055 | if (err != NULL) { |
5056 | 5056 | *err = zmalloc((reply->len + 1) * sizeof(char)); |
5057 | | - redis_strlcpy(*err, reply->str,(reply->len + 1)); |
| 5057 | + valkey_strlcpy(*err, reply->str,(reply->len + 1)); |
5058 | 5058 | CLUSTER_MANAGER_PRINT_REPLY_ERROR(source, *err); |
5059 | 5059 | } |
5060 | 5060 | goto next; |
@@ -5166,7 +5166,7 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source, |
5166 | 5166 | if (migrate_reply != NULL) { |
5167 | 5167 | if (err) { |
5168 | 5168 | *err = zmalloc((migrate_reply->len + 1) * sizeof(char)); |
5169 | | - redis_strlcpy(*err, migrate_reply->str, (migrate_reply->len + 1)); |
| 5169 | + valkey_strlcpy(*err, migrate_reply->str, (migrate_reply->len + 1)); |
5170 | 5170 | } |
5171 | 5171 | printf("\n"); |
5172 | 5172 | CLUSTER_MANAGER_PRINT_REPLY_ERROR(source, |
@@ -5283,7 +5283,7 @@ static int clusterManagerFlushNodeConfig(clusterManagerNode *node, char **err) { |
5283 | 5283 | if (reply == NULL || (is_err = (reply->type == REDIS_REPLY_ERROR))) { |
5284 | 5284 | if (is_err && err != NULL) { |
5285 | 5285 | *err = zmalloc((reply->len + 1) * sizeof(char)); |
5286 | | - redis_strlcpy(*err, reply->str, (reply->len + 1)); |
| 5286 | + valkey_strlcpy(*err, reply->str, (reply->len + 1)); |
5287 | 5287 | } |
5288 | 5288 | success = 0; |
5289 | 5289 | /* If the cluster did not already joined it is possible that |
@@ -9881,7 +9881,7 @@ int main(int argc, char **argv) { |
9881 | 9881 | config.pattern = NULL; |
9882 | 9882 | config.rdb_filename = NULL; |
9883 | 9883 | config.pipe_mode = 0; |
9884 | | - config.pipe_timeout = REDIS_CLI_DEFAULT_PIPE_TIMEOUT; |
| 9884 | + config.pipe_timeout = CLI_DEFAULT_PIPE_TIMEOUT; |
9885 | 9885 | config.bigkeys = 0; |
9886 | 9886 | config.memkeys = 0; |
9887 | 9887 | config.hotkeys = 0; |
|
0 commit comments