-
Notifications
You must be signed in to change notification settings - Fork 23.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent struct
definition between commands.h
and redismodule.h
#12378
Comments
@oranagra please take a look.
|
i think that warning ( cmd->args = moduleCopyCommandArgs(info->args, version);
/* Populate arg.num_args with the number of subargs, recursively */
cmd->num_args = populateArgsStructure(cmd->args); maybe instead of warning that they should be the same, we should give a reference to moduleCopyCommandArgs in that comment? |
How about an inline comment like this? @@ -29,7 +29,7 @@ typedef struct redisCommandArg {
const char *since;
int flags;
const char *deprecated_since;
- int num_args;
+ int num_args; /* computed at runtime, no need to sync with RedisModuleCommandArg */
struct redisCommandArg *subargs;
const char *display_text;
} redisCommandArg; |
it seems good, but if we'll have other runtime fields it can become messy. |
Sure, here is another attempt. What do you think? @@ -19,7 +19,8 @@ typedef enum {
#define CMD_ARG_MULTIPLE (1<<1)
#define CMD_ARG_MULTIPLE_TOKEN (1<<2)
-/* WARNING! This struct must match RedisModuleCommandArg */
+/* Must be compatible with RedisModuleCommandArg. Make use of moduleCopyCommandArgs
+ * for converting between the two. */
typedef struct redisCommandArg {
const char *name;
redisCommandArgType type; |
LGTM, maybe "make use of" is inaccurate (converts in just one direction, and we don't have to encourage people to do that conversion). |
fixed in #12415 |
Which one below is telling the truth?
commands.h
:redismodule.h
:Notice
int num_args;
is missing fromredismodule.h
.The text was updated successfully, but these errors were encountered: