Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
60204694
Commit
60204694
authored
Mar 31, 2016
by
antirez
Browse files
Modules: remove warnings due to void/function pointer conversion.
parent
34f2fb7d
Changes
1
Show whitespace changes
Inline
Side-by-side
src/module.c
View file @
60204694
...
@@ -53,7 +53,7 @@ struct RedisModuleCtx {
...
@@ -53,7 +53,7 @@ struct RedisModuleCtx {
};
};
typedef
struct
RedisModuleCtx
RedisModuleCtx
;
typedef
struct
RedisModuleCtx
RedisModuleCtx
;
#define REDISMODULE_CTX_INIT {(void*)&RedisModule_GetApi, NULL, NULL, NULL, 0, 0, 0}
#define REDISMODULE_CTX_INIT {(void*)
(unsigned long)
&RedisModule_GetApi, NULL, NULL, NULL, 0, 0, 0}
#define REDISMODULE_CTX_MULTI_EMITTED (1<<0)
#define REDISMODULE_CTX_MULTI_EMITTED (1<<0)
#define REDISMODULE_CTX_AUTO_MEMORY (1<<1)
#define REDISMODULE_CTX_AUTO_MEMORY (1<<1)
...
@@ -201,7 +201,7 @@ int RedisModule_GetApi(const char *funcname, void **targetPtrPtr) {
...
@@ -201,7 +201,7 @@ int RedisModule_GetApi(const char *funcname, void **targetPtrPtr) {
/* This Redis command binds the normal Redis command invocation with commands
/* This Redis command binds the normal Redis command invocation with commands
* exported by modules. */
* exported by modules. */
void
RedisModuleCommandDispatcher
(
client
*
c
)
{
void
RedisModuleCommandDispatcher
(
client
*
c
)
{
RedisModuleCommandProxy
*
cp
=
(
void
*
)
c
->
cmd
->
getkeys_proc
;
RedisModuleCommandProxy
*
cp
=
(
void
*
)
(
unsigned
long
)
c
->
cmd
->
getkeys_proc
;
RedisModuleCtx
ctx
=
REDISMODULE_CTX_INIT
;
RedisModuleCtx
ctx
=
REDISMODULE_CTX_INIT
;
ctx
.
module
=
cp
->
module
;
ctx
.
module
=
cp
->
module
;
...
@@ -251,7 +251,7 @@ int RedisModule_CreateCommand(RedisModuleCtx *ctx, const char *name, RedisModule
...
@@ -251,7 +251,7 @@ int RedisModule_CreateCommand(RedisModuleCtx *ctx, const char *name, RedisModule
cp
->
rediscmd
->
proc
=
RedisModuleCommandDispatcher
;
cp
->
rediscmd
->
proc
=
RedisModuleCommandDispatcher
;
cp
->
rediscmd
->
arity
=
-
1
;
cp
->
rediscmd
->
arity
=
-
1
;
cp
->
rediscmd
->
flags
=
0
;
cp
->
rediscmd
->
flags
=
0
;
cp
->
rediscmd
->
getkeys_proc
=
(
redisGetKeysProc
*
)
cp
;
cp
->
rediscmd
->
getkeys_proc
=
(
redisGetKeysProc
*
)
(
unsigned
long
)
cp
;
cp
->
rediscmd
->
firstkey
=
1
;
cp
->
rediscmd
->
firstkey
=
1
;
cp
->
rediscmd
->
lastkey
=
1
;
cp
->
rediscmd
->
lastkey
=
1
;
cp
->
rediscmd
->
keystep
=
1
;
cp
->
rediscmd
->
keystep
=
1
;
...
@@ -1177,7 +1177,7 @@ int moduleRegisterApi(const char *funcname, void *funcptr) {
...
@@ -1177,7 +1177,7 @@ int moduleRegisterApi(const char *funcname, void *funcptr) {
}
}
#define REGISTER_API(name) \
#define REGISTER_API(name) \
moduleRegisterApi("RedisModule_" #name, (void *)RedisModule_ ## name)
moduleRegisterApi("RedisModule_" #name, (void *)
(unsigned long)
RedisModule_ ## name)
/* Register all the APIs we export. */
/* Register all the APIs we export. */
void
moduleRegisterCoreAPI
(
void
)
{
void
moduleRegisterCoreAPI
(
void
)
{
...
@@ -1268,7 +1268,7 @@ int moduleLoad(const char *path) {
...
@@ -1268,7 +1268,7 @@ int moduleLoad(const char *path) {
handle
=
dlopen
(
path
,
RTLD_LAZY
);
handle
=
dlopen
(
path
,
RTLD_LAZY
);
if
(
handle
==
NULL
)
return
C_ERR
;
if
(
handle
==
NULL
)
return
C_ERR
;
onload
=
(
int
(
*
)(
void
*
))
dlsym
(
handle
,
"RedisModule_OnLoad"
);
onload
=
(
int
(
*
)(
void
*
))
(
unsigned
long
)
dlsym
(
handle
,
"RedisModule_OnLoad"
);
if
(
onload
==
NULL
)
{
if
(
onload
==
NULL
)
{
serverLog
(
LL_WARNING
,
serverLog
(
LL_WARNING
,
"Module %s does not export RedisModule_OnLoad() "
"Module %s does not export RedisModule_OnLoad() "
...
@@ -1308,7 +1308,8 @@ int moduleUnload(sds name) {
...
@@ -1308,7 +1308,8 @@ int moduleUnload(sds name) {
while
((
de
=
dictNext
(
di
))
!=
NULL
)
{
while
((
de
=
dictNext
(
di
))
!=
NULL
)
{
struct
redisCommand
*
cmd
=
dictGetVal
(
de
);
struct
redisCommand
*
cmd
=
dictGetVal
(
de
);
if
(
cmd
->
proc
==
RedisModuleCommandDispatcher
)
{
if
(
cmd
->
proc
==
RedisModuleCommandDispatcher
)
{
RedisModuleCommandProxy
*
cp
=
(
void
*
)
cmd
->
getkeys_proc
;
RedisModuleCommandProxy
*
cp
=
(
void
*
)(
unsigned
long
)
cmd
->
getkeys_proc
;
sds
cmdname
=
cp
->
rediscmd
->
name
;
sds
cmdname
=
cp
->
rediscmd
->
name
;
if
(
cp
->
module
==
module
)
{
if
(
cp
->
module
==
module
)
{
dictDelete
(
server
.
commands
,
cmdname
);
dictDelete
(
server
.
commands
,
cmdname
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment