Moved RMAPI_FUNC_SUPPORTED location such that it will be visible to modules (#8037)
The RMAPI_FUNC_SUPPORTED was defined in the wrong place on redismodule.h and was not visible to modules.
This commit is contained in:
parent
bcc46a2f25
commit
97d647a139
@ -1020,13 +1020,13 @@ static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int
|
|||||||
|
|
||||||
#define RedisModule_Assert(_e) ((_e)?(void)0 : (RedisModule__Assert(#_e,__FILE__,__LINE__),exit(1)))
|
#define RedisModule_Assert(_e) ((_e)?(void)0 : (RedisModule__Assert(#_e,__FILE__,__LINE__),exit(1)))
|
||||||
|
|
||||||
|
#define RMAPI_FUNC_SUPPORTED(func) (func != NULL)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* Things only defined for the modules core, not exported to modules
|
/* Things only defined for the modules core, not exported to modules
|
||||||
* including this file. */
|
* including this file. */
|
||||||
#define RedisModuleString robj
|
#define RedisModuleString robj
|
||||||
|
|
||||||
#define RMAPI_FUNC_SUPPORTED(func) (func != NULL)
|
|
||||||
|
|
||||||
#endif /* REDISMODULE_CORE */
|
#endif /* REDISMODULE_CORE */
|
||||||
#endif /* REDISMODULE_H */
|
#endif /* REDISMODULE_H */
|
||||||
|
@ -28,6 +28,12 @@ int fork_create(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
|
|||||||
RedisModule_WrongArity(ctx);
|
RedisModule_WrongArity(ctx);
|
||||||
return REDISMODULE_OK;
|
return REDISMODULE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!RMAPI_FUNC_SUPPORTED(RedisModule_Fork)){
|
||||||
|
RedisModule_ReplyWithError(ctx, "Fork api is not supported in the current redis version");
|
||||||
|
return REDISMODULE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
RedisModule_StringToLongLong(argv[1], &code_to_exit_with);
|
RedisModule_StringToLongLong(argv[1], &code_to_exit_with);
|
||||||
exitted_with_code = -1;
|
exitted_with_code = -1;
|
||||||
child_pid = RedisModule_Fork(done_handler, (void*)0xdeadbeef);
|
child_pid = RedisModule_Fork(done_handler, (void*)0xdeadbeef);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user