rename redisCommandArgType serverCommandArgType (#182)
redisCommandArgType -> serverCommandArgType redisCommandArg -> serverCommandArg https://github.com/valkey-io/valkey/issues/144 Signed-off-by: 0del <bany.y0599@gmail.com>
This commit is contained in:
parent
edee864b34
commit
3a0ba0ad93
@ -11,7 +11,7 @@
|
||||
/* Syntax specifications for a command argument. */
|
||||
typedef struct cliCommandArg {
|
||||
char *name;
|
||||
redisCommandArgType type;
|
||||
serverCommandArgType type;
|
||||
char *token;
|
||||
char *since;
|
||||
int flags;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#define MAKE_CMD(name,summary,complexity,since,doc_flags,replaced,deprecated,group,group_enum,history,num_history,tips,num_tips,function,arity,flags,acl,key_specs,key_specs_num,get_keys,numargs) name,summary,complexity,since,doc_flags,replaced,deprecated,group_enum,history,num_history,tips,num_tips,function,arity,flags,acl,key_specs,key_specs_num,get_keys,numargs
|
||||
#define MAKE_ARG(name,type,key_spec_index,token,summary,since,flags,numsubargs,deprecated_since) name,type,key_spec_index,token,summary,since,flags,deprecated_since,numsubargs
|
||||
#define COMMAND_STRUCT serverCommand
|
||||
#define COMMAND_ARG redisCommandArg
|
||||
#define COMMAND_ARG serverCommandArg
|
||||
|
||||
#ifdef LOG_REQ_RES
|
||||
#include "commands_with_reply_schema.def"
|
||||
|
@ -12,7 +12,7 @@ typedef enum {
|
||||
ARG_TYPE_PURE_TOKEN,
|
||||
ARG_TYPE_ONEOF, /* Has subargs */
|
||||
ARG_TYPE_BLOCK /* Has subargs */
|
||||
} redisCommandArgType;
|
||||
} serverCommandArgType;
|
||||
|
||||
#define CMD_ARG_NONE (0)
|
||||
#define CMD_ARG_OPTIONAL (1<<0)
|
||||
@ -20,9 +20,9 @@ typedef enum {
|
||||
#define CMD_ARG_MULTIPLE_TOKEN (1<<2)
|
||||
|
||||
/* Must be compatible with RedisModuleCommandArg. See moduleCopyCommandArgs. */
|
||||
typedef struct redisCommandArg {
|
||||
typedef struct serverCommandArg {
|
||||
const char *name;
|
||||
redisCommandArgType type;
|
||||
serverCommandArgType type;
|
||||
int key_spec_index;
|
||||
const char *token;
|
||||
const char *summary;
|
||||
@ -30,9 +30,9 @@ typedef struct redisCommandArg {
|
||||
int flags;
|
||||
const char *deprecated_since;
|
||||
int num_args;
|
||||
struct redisCommandArg *subargs;
|
||||
struct serverCommandArg *subargs;
|
||||
const char *display_text;
|
||||
} redisCommandArg;
|
||||
} serverCommandArg;
|
||||
|
||||
/* Returns the command group name by group number. */
|
||||
const char *commandGroupStr(int index);
|
||||
|
18
src/module.c
18
src/module.c
@ -500,9 +500,9 @@ static int moduleValidateCommandInfo(const RedisModuleCommandInfo *info);
|
||||
static int64_t moduleConvertKeySpecsFlags(int64_t flags, int from_api);
|
||||
static int moduleValidateCommandArgs(RedisModuleCommandArg *args,
|
||||
const RedisModuleCommandInfoVersion *version);
|
||||
static struct redisCommandArg *moduleCopyCommandArgs(RedisModuleCommandArg *args,
|
||||
static struct serverCommandArg *moduleCopyCommandArgs(RedisModuleCommandArg *args,
|
||||
const RedisModuleCommandInfoVersion *version);
|
||||
static redisCommandArgType moduleConvertArgType(RedisModuleCommandArgType type, int *error);
|
||||
static serverCommandArgType moduleConvertArgType(RedisModuleCommandArgType type, int *error);
|
||||
static int moduleConvertArgFlags(int flags);
|
||||
void moduleCreateContext(RedisModuleCtx *out_ctx, RedisModule *module, int ctx_flags);
|
||||
|
||||
@ -1450,7 +1450,7 @@ moduleCmdArgAt(const RedisModuleCommandInfoVersion *version,
|
||||
|
||||
/* Recursively populate the args structure (setting num_args to the number of
|
||||
* subargs) and return the number of args. */
|
||||
int populateArgsStructure(struct redisCommandArg *args) {
|
||||
int populateArgsStructure(struct serverCommandArg *args) {
|
||||
if (!args)
|
||||
return 0;
|
||||
int count = 0;
|
||||
@ -2197,13 +2197,13 @@ static int moduleValidateCommandArgs(RedisModuleCommandArg *args,
|
||||
}
|
||||
|
||||
/* Converts an array of RedisModuleCommandArg into a freshly allocated array of
|
||||
* struct redisCommandArg. */
|
||||
static struct redisCommandArg *moduleCopyCommandArgs(RedisModuleCommandArg *args,
|
||||
* struct serverCommandArg. */
|
||||
static struct serverCommandArg *moduleCopyCommandArgs(RedisModuleCommandArg *args,
|
||||
const RedisModuleCommandInfoVersion *version) {
|
||||
size_t count = 0;
|
||||
while (moduleCmdArgAt(version, args, count)->name) count++;
|
||||
serverAssert(count < SIZE_MAX / sizeof(struct redisCommandArg));
|
||||
struct redisCommandArg *realargs = zcalloc((count+1) * sizeof(redisCommandArg));
|
||||
serverAssert(count < SIZE_MAX / sizeof(struct serverCommandArg));
|
||||
struct serverCommandArg *realargs = zcalloc((count+1) * sizeof(serverCommandArg));
|
||||
|
||||
for (size_t j = 0; j < count; j++) {
|
||||
RedisModuleCommandArg *arg = moduleCmdArgAt(version, args, j);
|
||||
@ -2224,7 +2224,7 @@ static struct redisCommandArg *moduleCopyCommandArgs(RedisModuleCommandArg *args
|
||||
return realargs;
|
||||
}
|
||||
|
||||
static redisCommandArgType moduleConvertArgType(RedisModuleCommandArgType type, int *error) {
|
||||
static serverCommandArgType moduleConvertArgType(RedisModuleCommandArgType type, int *error) {
|
||||
if (error) *error = 0;
|
||||
switch (type) {
|
||||
case REDISMODULE_ARG_TYPE_STRING: return ARG_TYPE_STRING;
|
||||
@ -12132,7 +12132,7 @@ void moduleFreeModuleStructure(struct RedisModule *module) {
|
||||
zfree(module);
|
||||
}
|
||||
|
||||
void moduleFreeArgs(struct redisCommandArg *args, int num_args) {
|
||||
void moduleFreeArgs(struct serverCommandArg *args, int num_args) {
|
||||
for (int j = 0; j < num_args; j++) {
|
||||
zfree((char *)args[j].name);
|
||||
zfree((char *)args[j].token);
|
||||
|
@ -4699,7 +4699,7 @@ void addReplyFlagsForKeyArgs(client *c, uint64_t flags) {
|
||||
addReplyCommandFlags(c, flags, docFlagNames);
|
||||
}
|
||||
|
||||
/* Must match redisCommandArgType */
|
||||
/* Must match serverCommandArgType */
|
||||
const char *ARG_TYPE_STR[] = {
|
||||
"string",
|
||||
"integer",
|
||||
@ -4722,7 +4722,7 @@ void addReplyFlagsForArg(client *c, uint64_t flags) {
|
||||
addReplyCommandFlags(c, flags, argFlagNames);
|
||||
}
|
||||
|
||||
void addReplyCommandArgList(client *c, struct redisCommandArg *args, int num_args) {
|
||||
void addReplyCommandArgList(client *c, struct serverCommandArg *args, int num_args) {
|
||||
addReplyArrayLen(c, num_args);
|
||||
for (int j = 0; j<num_args; j++) {
|
||||
/* Count our reply len so we don't have to use deferred reply. */
|
||||
|
@ -2361,7 +2361,7 @@ struct serverCommand {
|
||||
/* Array of subcommands (may be NULL) */
|
||||
struct serverCommand *subcommands;
|
||||
/* Array of arguments (may be NULL) */
|
||||
struct redisCommandArg *args;
|
||||
struct serverCommandArg *args;
|
||||
#ifdef LOG_REQ_RES
|
||||
/* Reply schema */
|
||||
struct jsonObject *reply_schema;
|
||||
|
Loading…
x
Reference in New Issue
Block a user