Closed ret2libc closed 6 years ago
I intend to sync radare2 after merging this commit, so that in next PRs I can change
struct SdbKv {
//sub of HtKv so we can cast safely
char *key;
char *value;
ut32 key_len;
ut32 value_len;
ut32 cas;
ut64 expire;
};
to
typedef struct sdb_kv {
//sub of HtKv so we can cast safely
HtKv base;
ut32 cas;
ut64 expire;
} SdbKv;
easily, without rewriting everything. Also, this will be helpful because key/value are both char*
in SdbKv, but not in HtKv, so a cast will be needed.
We probably dont need those macros at all
On 4 Oct 2018, at 12:05, Riccardo Schirone notifications@github.com wrote:
@ret2libc commented on this pull request.
In src/sdbht.h:
@@ -14,6 +14,11 @@ typedef struct sdb_kv { ut64 expire; } SdbKv;
+#define SDBKV_KEY(kv) ((kv)->key) @radare Do you prefer static inline functions instead of these macros?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
We probably dont need those macros at all
See this comment https://github.com/radare/sdb/pull/162#issuecomment-426960357
This PR is based on https://github.com/radare/sdb/pull/158 .The only difference is the last commits.The commit introduces helper macros in the sdbht.h file to access SdbKv->key/value/key_len/value_len since they are fields of the "base structure" HtKv. In another PR i'm going to change those fields, so I want to introduce these helpers to make those change easier.