Skip to content

Commit 6d9255f

Browse files
authored
Added Redis 6.2 and some decorations (#51)
1 parent f9d3aa1 commit 6d9255f

File tree

5 files changed

+1280
-11
lines changed

5 files changed

+1280
-11
lines changed

5.0/redismodule.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
#ifndef REDISMODULE_H
22
#define REDISMODULE_H
33

4+
// clang-format off
5+
46
#include <sys/types.h>
57
#include <stdint.h>
68
#include <stdio.h>
79

10+
#ifdef __cplusplus
11+
extern "C" {
12+
#endif
13+
814
/* ---------------- Defines common between core and modules --------------- */
915

1016
/* Error status return values. */
@@ -565,4 +571,9 @@ static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int
565571
#define RedisModuleString robj
566572

567573
#endif /* REDISMODULE_CORE */
574+
575+
#ifdef __cplusplus
576+
}
577+
#endif
578+
568579
#endif /* REDISMOUDLE_H */

6.0/redismodule.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
#ifndef REDISMODULE_H
22
#define REDISMODULE_H
33

4+
// clang-format off
5+
46
#include <sys/types.h>
57
#include <stdint.h>
68
#include <stdio.h>
79

10+
#ifdef __cplusplus
11+
extern "C" {
12+
#endif
13+
814
/* ---------------- Defines common between core and modules --------------- */
915

1016
/* Error status return values. */
@@ -510,6 +516,10 @@ typedef struct RedisModuleTypeMethods {
510516
RedisModule_GetApi("RedisModule_" #name, ((void **)&RedisModule_ ## name))
511517

512518
/* Default API declaration prefix (not 'extern' for backwards compatibility) */
519+
#ifndef REDISMODULE_MAIN
520+
#define REDISMODULE_API extern
521+
#endif
522+
513523
#ifndef REDISMODULE_API
514524
#define REDISMODULE_API
515525
#endif
@@ -1018,13 +1028,18 @@ static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int
10181028

10191029
#define RedisModule_Assert(_e) ((_e)?(void)0 : (RedisModule__Assert(#_e,__FILE__,__LINE__),exit(1)))
10201030

1031+
#define RMAPI_FUNC_SUPPORTED(func) (func != NULL)
1032+
10211033
#else
10221034

10231035
/* Things only defined for the modules core, not exported to modules
10241036
* including this file. */
10251037
#define RedisModuleString robj
10261038

1027-
#define RMAPI_FUNC_SUPPORTED(func) (func != NULL)
1028-
10291039
#endif /* REDISMODULE_CORE */
1040+
1041+
#ifdef __cplusplus
1042+
}
1043+
#endif
1044+
10301045
#endif /* REDISMODULE_H */

6.0/redismodulex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,14 +831,14 @@ static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int
831831

832832
#define RedisModule_Assert(_e) ((_e)?(void)0 : (RedisModule__Assert(#_e,__FILE__,__LINE__),exit(1)))
833833

834+
#define RMAPI_FUNC_SUPPORTED(func) (func != NULL)
835+
834836
#else
835837

836838
/* Things only defined for the modules core, not exported to modules
837839
* including this file. */
838840
#define RedisModuleString robj
839841

840-
#define RMAPI_FUNC_SUPPORTED(func) (func != NULL)
841-
842842
#endif /* REDISMODULE_CORE */
843843

844844
#ifdef __cplusplus

0 commit comments

Comments
 (0)