Skip to content

Commit 56a5749

Browse files
authored
Merge pull request #1 from obieq/make-cpp-compatible
resolve c++ compilation issue
2 parents bad0019 + bd65a6d commit 56a5749

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sds.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ struct __attribute__ ((__packed__)) sdshdr64 {
8080
#define SDS_TYPE_64 4
8181
#define SDS_TYPE_MASK 7
8282
#define SDS_TYPE_BITS 3
83+
#ifdef __cplusplus
84+
#define SDS_HDR_VAR(T, s) struct sdshdr##T *sh = (struct sdshdr##T *)((s) - (sizeof(struct sdshdr##T)));
85+
#else
8386
#define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T)));
87+
#endif
8488
#define SDS_HDR(T,s) ((struct sdshdr##T *)((s)-(sizeof(struct sdshdr##T))))
8589
#define SDS_TYPE_5_LEN(f) ((f)>>SDS_TYPE_BITS)
8690

0 commit comments

Comments
 (0)